3 # ./bin/srt2yaml.pl media/_editing/captions.srt > media/_editing/video.srt.yaml
9 use Data::Dump qw(dump);
18 $txt =~ s/,/./; # fix decimal
19 my @t = split(/:/,$txt);
20 my $t = ( $t[0] * 60 * 60 ) + ( $t[1] * 60 ) + $t[2];
21 warn "# $txt -> $t\n";
26 s/^\xEF\xBB\xBF//; # strip utf-8 marker
29 if ( length($_) == 0 ) {
33 my ( $f,$t ) = split(/\s*-->\s*/, $s[1], 2);
35 $subtitles[ $s[0] ] = [ to_t($f), to_t($t), join(" ", @s[ 2 .. $#s ]) ];
44 $subtitles[0] ||= [ 0, 0.001, "[1]" ]; # fake first slide
46 print Dump @subtitles;