reformat simple mm:ss title format to yaml
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 25 Oct 2009 17:12:14 +0000 (18:12 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 25 Oct 2009 17:12:14 +0000 (18:12 +0100)
bin/sync2yaml.pl [new file with mode: 0755]

diff --git a/bin/sync2yaml.pl b/bin/sync2yaml.pl
new file mode 100755 (executable)
index 0000000..bb0e393
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+# ./bin/sync2yaml.pl media/_editing/sync.txt > media/_editing/video.srt.yaml
+
+use warnings;
+use strict;
+
+use YAML;
+
+my @subtitles;
+
+my $nr = 0;
+
+while(<>) {
+       chomp;
+       if ( m{(\d+):(\d+)\s+(.+)} ) {
+               my $t = $1 * 60 + $2;
+               $nr++;
+               push @subtitles, [ $t, $t+3, "[$nr] $3" ];
+       } else {
+               die "unknown format: $_";
+       }
+
+}
+
+print Dump @subtitles;