From 2ee007e08a456e37ca720db22f6cac2a5b816a42 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Mon, 23 Jul 2018 17:48:24 +1000 Subject: [PATCH] * Subtitle::SSA : event line not only 'Dialogue' --- lib/Subtitle/SSA/Event.pm | 2 +- lib/Subtitle/SSA/Record.pm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Subtitle/SSA/Event.pm b/lib/Subtitle/SSA/Event.pm index ca158a6..75b8807 100644 --- a/lib/Subtitle/SSA/Event.pm +++ b/lib/Subtitle/SSA/Event.pm @@ -32,7 +32,7 @@ sub new { _type => 'ass', _fields => \%FIELDS, _format => \@FIELDS_ASS, - _prefix => 'Dialogue', + _prefix => qr/(Dialogue|Comment|Picture|Sound|Movie|Command)/, }; if (my $t = $opts{type}) { diff --git a/lib/Subtitle/SSA/Record.pm b/lib/Subtitle/SSA/Record.pm index da2a4db..f358be8 100644 --- a/lib/Subtitle/SSA/Record.pm +++ b/lib/Subtitle/SSA/Record.pm @@ -64,6 +64,8 @@ sub parse { my $PREFIX = $self->{_prefix}; return $self->error("not looks like $PREFIX line") unless $line and $line =~ m{^$PREFIX:}i; + $self->{_prefix} = $1 + if ref($self->{_prefix}) eq 'Regexp'; return $self->error("passed custom fields order not ARRAY ref") unless $format and ref($format) eq 'ARRAY';