Browse Source

* Subtitle::SSA : fixes

master
Alex 'AdUser' Z 9 years ago
parent
commit
bae3510b59
  1. 10
      lib/Subtitle/SSA.pm

10
lib/Subtitle/SSA.pm

@ -54,7 +54,7 @@ sub parse {
$section = 'styles'; $section = 'styles';
unless ($self->{type}) { unless ($self->{type}) {
$self->{type} = ($1) ? 'ass' : 'ssa'; $self->{type} = ($1) ? 'ass' : 'ssa';
$self->log(warn => "Set type to $self->{type} because of $linenum (fallback mode)"); $self->log(warn => "Set type to $self->{type} because of line $linenum (fallback mode)");
} }
} else { } else {
undef $section; undef $section;
@ -83,12 +83,12 @@ sub parse {
push @{ $self->{h_order} }, $key; push @{ $self->{h_order} }, $key;
} }
$self->{headers}->{$key} = $header; $self->{headers}->{$key} = $header;
next;
if ($key eq 'scripttype') { if ($key eq 'scripttype') {
my $type = index($header->{type}, "+") >= 0 ? 'ass' : 'ssa'; my $type = index($header->{value}, "+") >= 0 ? 'ass' : 'ssa';
$self->log(info => "File recognized as '$type' type from header at $linenum"); $self->log(info => "File recognized as '$type' type from header at line $linenum");
$self->{type} = $type; $self->{type} = $type;
} }
next;
} }
if ($section eq 'styles') { if ($section eq 'styles') {
if ($line =~ m/^\s*Format:/oi) { if ($line =~ m/^\s*Format:/oi) {
@ -118,7 +118,7 @@ sub parse {
} }
next; next;
} }
$self->log(warn => "unrecognized line at $linenum: $line"); $self->log(warn => "unrecognized line at line $linenum: $line");
} }
return scalar @{ $self->{events} }; return scalar @{ $self->{events} };

Loading…
Cancel
Save