#!/usr/bin/perl # # mkSummary.pl # # Version 1.0 # # (C) Copyright 1999, Chr. Draxler # # creates summary file for SpeechDat-Car recordings from # the SAM files in the SpeechDat-Car file system hierarchy # # History # 1.0: initial release # -- change the following variables to suit your language and system ----- $langCode = 'DE'; # German $dbName = 'VEHIC1' . $langCode; # Database name $dbPrefix = 'V1'; # DB prefix for file name $fileDlm = ':'; # OS file system delimiter (UNIX:/, Windows:\) # -- command line arguments for work (=source) root directory and target directory --- # #if (int(@ARGV) < 3) { # die "\nusage: mkSummary.pl (0|1|2|3|Y) WORKDIR TARGETDIR\n\n"; #} else { # $channelID = $ARGV[0]; # $workDir = $ARGV[1]; # $targetDir = $ARGV[2]; #} # -- on the Mac, ask for these values interactively ------------------------ # $channelID = MacPerl::Ask('Transcription channel (0|1|2|3|Y)','0'); $workDir = MacPerl::Ask('SAM label file root directory',':SAMFiles:VEHIC1DE:PLTM_V:' . $dbName . $fileDlm); $targetDir = MacPerl::Ask('Target directory',':SAMFiles:VEHIC1DE:DOC:'); # --- compute signal file extension from channel ID ------------------------ if ($channelID eq 'Y') { $sigExt = ".$langCode" . 'A'; } else { $sigExt = ".$langCode" . 'V'; } # -- create summary file in target directory ------------------------------- # -- target directory must exist! $outFile = $targetDir . "SUMMAR$channelID.TXT"; $outFileOrg = $outFile; $cnt=0; while(-e $outFile) { $cnt++; $outFile = $outFileOrg . '.' . $cnt; } open(OUT,'>' . $outFile) || die "could not open $outFile"; @ccdCodes=( 'A1','A2', 'B1', 'C1','C2','C3','C4','C5','C6','C7', 'D1','D2','D3', 'E1','E2', 'I1','I2','I3','I4', 'L1','L2','L3','L4','L5','L6','L7', 'M1', 'N1', 'O1','O2','O3','O4','O5','O6','O7', 'S1','S2','S3','S4','S5','S6','S7','S8','S9', 'T1','T2', 'W1','W2','W3','W4', 'P1','P2', 'Z0','Z1','Z2','Z3','Z4','Z5','Z6','Z7','Z8','Z9', '00','01','02','03','04','05','06','07','08','09', '10','11','12','13','14','15','16','17','18','19', '20','21','22','23','24','25','26','27','28','29', '30','31','32','33','34','35','36','37','38','39', '40','41','42','43','44','45','46','47','48','49', '50','51','52','53','54','55','56','57','58','59', '60','61','62','63','64','65','66' ); @months = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); $signalFileCnt=0; # -- descend SpeechDat-Car directory BLOCKnn/SESSnnMM/ --------------------- $blockGlob = $workDir . 'BLOCK*'; while($blockDir = <${blockGlob}>) { $sessGlob = $blockDir . $fileDlm . 'SES*'; while($sessDir = <${sessGlob}>) { $creaDate = (stat($sessDir))[9]; ($sec,$min,$hrs,$day,$mth,$year,$wday,$yday,$isdst) = localtime($creaDate); if ($year < 100) { $year = 1900 + $year; } $printSessDir = $sessDir; $printSessDir =~ s/$workDir/$dbName\\/g; $printSessDir =~ s/$fileDlm/\\/g; $sessNo = $sessDir; $sessNo =~ s/.+SES//g; print "$sessDir\n"; printf OUT "%s %s ", $printSessDir, $sessNo; foreach $ccd (sort(@ccdCodes)) { $signalFile = $sessDir . $fileDlm . $dbPrefix . $sessNo . $ccd . $sigExt; if (-e $signalFile) { print OUT "$ccd"; } else { print OUT "--"; } $signalFileCnt++; } printf OUT " %02d/%s/%04d %02d:%02d:%02d\015\012",$day,$months[$mth],$year,$hrs,$min,$sec; } } print "$signalFileCnt signal files done\n"; close(OUT); exit(0);