|
#!/bin/perl
my $at = ();
my $bt = ();
my $kl = ();
open(IN,"m-jane-b.srt");
open(OUT,">m-jane-b.smi");
while($aline=<IN>) {
if($aline=~/^[\s]*$/) {
$at += 21760;
print OUT "<SYNC Start=$at><P Class=ENCC>\n";
print OUT "$kl";
$bt += 21760;
print OUT "<SYNC Start=$bt><P Class=ENCC> \;\n";
}
elsif($aline=~/-->/) {
$kl = ();
($at,$bt)=split(/[\s]*-->[\s]*/,$aline,2);
$bt =~ s/[\s]*$//g;
$at = &chg_time($at);
$bt = &chg_time($bt);
}
else {
if($kl) {
$kl =~ s/[\s]*$//g;
$kl .= "<br>\n";
}
$kl .= $aline;
}
}
close(IN);
close(OUT);
sub chg_time {
my ($aline) = @_;
my ($a,$b,$c,$d) = split(/[:,\s]+/,$aline);
$a = (($a * 60 + $b) * 60 + $c) * 1000 + $d;
return $a;
}
|
|