Blame view

tools/SIGMUND/bin/myConvert.pl 737 Bytes
e6be5137b   Jean-François Rey   reinitialized pro...
1
2
3
4
5
6
7
8
9
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
  #!/usr/bin/perl 
  
  if($#ARGV != 1){
  	print("usage : cat <fichierLIUM.seg> | ./myConvert <fichier.ctm> <fichier.txt>");
  	exit(1);
  }
  
  open(TXT, ">$ARGV[1]");
  while(<STDIN>){
  	$ligne = $_;
  	if($ligne !~ m/;;.*/){
  		chomp($ligne);
  		@tempo = split(/ /, $ligne);
  		$debut = $tempo[2]/100;
  		$duree = $tempo[3]/100;	
  		$fin = $debut + $duree;
  		$debutMilli = $debut * 100;
  		$finMilli = $fin * 100;
  		print TXT "#$debutMilli-$finMilli# ";
  		open(CTM, "<$ARGV[0]");
  		while($ligne2 = <CTM>){
  			chomp($ligne2);
  			@tempo2 = split(/ /, $ligne2);
  			$temps = $tempo2[2];
  			if($temps >= $debut && $temps < $fin ){
  				if($tempo2[4] !~ m/<\/?[a-zA-Z:]+>/){ print TXT "$tempo2[4] ";}
  			}	
  		}	
  		print TXT "
  ";	
  		close(CTM);
  	}
  }
  close(TXT);