Browse Source

+ Subtitle::SRT->build

master
Alex 'AdUser' Z 10 years ago
parent
commit
b851efc8e1
  1. 16
      lib/Subtitle/SRT.pm

16
lib/Subtitle/SRT.pm

@ -115,4 +115,20 @@ sub parse {
return scalar @{ $self->{events} }; return scalar @{ $self->{events} };
} }
sub build {
my ($self) = @_;
my $out = "";
foreach my $e (@{ $self->{events} }) {
$out .= "$e->{id}\n";
$out .= sprintf "%s --> %s\n",
$self->build_timing($e->{timing}->[0], 3, ','),
$self->build_timing($e->{timing}->[1], 3, ',');
$out .= "$e->{text}\n";
$out .= "\n";
}
return $out;
}
1; 1;

Loading…
Cancel
Save