myConvert.pl 737 Bytes
#!/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 "\n";	
		close(CTM);
	}
}
close(TXT);