/usr/bin/ssa2srt is in hxtools 20170430-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #!/usr/bin/perl
#
# Rudimentary script to reduce SSA subtitles to SRT format
# written by Jan Engelhardt, 2011
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the WTF Public License version 2 or
# (at your option) any later version.
#
use strict;
my $count;
my @fields;
while (defined(my $line = <>)) {
if ($line =~ m/^\[Events\]/) {
last;
}
}
while (defined(my $line = <>)) {
$line =~ s/[\x0a\x0d]//gs;
if ($line =~ m/^Format:\s*/is) {
@fields = split(/,\s*/, $');
$_ = lc $_ for @fields;
}
if ($line !~ s/^Dialogue:\s*//s) {
next;
}
if (scalar(@fields) == 0) {
die "No Format: line in [Events] section found prior to Dialogue.";
}
my %attr;
@attr{@fields} = split(/,/, $line, scalar(@fields));
print ++$count, "\n";
print $attr{"start"}, " --> ", $attr{"end"}, "\n";
$attr{"text"} =~ s{\\n}{\n}gs;
print $attr{"text"}, "\n\n";
}
|