projects
/
HTML5TV.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c395012
)
reformat simple mm:ss title format to yaml
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 25 Oct 2009 17:12:14 +0000
(18:12 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 25 Oct 2009 17:12:14 +0000
(18:12 +0100)
bin/sync2yaml.pl
[new file with mode: 0755]
patch
|
blob
diff --git a/bin/sync2yaml.pl
b/bin/sync2yaml.pl
new file mode 100755
(executable)
index 0000000..
bb0e393
--- /dev/null
+++ b/
bin/sync2yaml.pl
@@ -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;