Browse Source

* Subtitle::BASE->build_timing : customizable timing format

master
Alex 'AdUser' Z 10 years ago
parent
commit
2840c2eb91
  1. 2
      lib/Subtitle/BASE.pm
  2. 1
      lib/Subtitle/SRT.pm
  3. 1
      lib/Subtitle/SSA.pm

2
lib/Subtitle/BASE.pm

@ -72,7 +72,7 @@ sub build_timing {
$sec = int($rest / 1);
$msec = sprintf "%.${prec}f", ($rest - ($sec * 1));
$msec =~ s/^0\.//o;
return sprintf("%d:%02d:%02d.%s", $hrs, $min, $sec, $msec);
return sprintf($self->{timing_fmt}, $hrs, $min, $sec, $msec);
}
sub trim {

1
lib/Subtitle/SRT.pm

@ -15,6 +15,7 @@ sub new {
%args,
events => [],
log => [],
timing_fmt => "%02d:%02d:%02d,%s",
};
return bless($self, $class);

1
lib/Subtitle/SSA.pm

@ -29,6 +29,7 @@ sub new {
styles => [],
events => [],
log => [],
timing_fmt => "%d:%02d:%02d.%s",
};
return bless($self, $class);

Loading…
Cancel
Save