Created
October 17, 2009 03:56
-
-
Save res0nat0r/212225 to your computer and use it in GitHub Desktop.
Convert ASS subs to SRT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict qw(subs vars); | |
my $counter; | |
while(<>) { | |
if(/^Dialogue: /) { | |
my ($start, $end, $text) = unpack("x12A10xA10x22A*", $_); | |
my ($hr, $min, $sec) = split(/:/, $start); | |
$hr = sprintf("%02d", $hr); | |
$min = sprintf("%02d", $min); | |
$sec =~ s/\./,/; $sec = $sec . "0"; | |
$counter++; | |
print "$counter\n"; | |
print "$hr:$min:$sec --> "; | |
($hr, $min, $sec) = split(/:/, $end); | |
$hr = sprintf("%02d", $hr); | |
$min = sprintf("%02d", $min); | |
$sec =~ s/\./,/; $sec = $sec . "0"; | |
print "$hr:$min:$sec\n"; | |
$text =~ s/\\N/\n/g; | |
print "$text\n\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment