diff --git a/lib/Subtitle/SSA/Record.pm b/lib/Subtitle/SSA/Record.pm index b5f445f..cbdb051 100644 --- a/lib/Subtitle/SSA/Record.pm +++ b/lib/Subtitle/SSA/Record.pm @@ -53,6 +53,24 @@ sub set { return 1; } +sub parse_format_line { + my ($self, $line) = @_; + + return unless $line and $line =~ m{^Format:}oi; + + chomp $line; + $line =~ s{^Format:\s+}{}oi; + + my @fields; + foreach my $field (split(/,\s*/o, $line)) { + $field = lc($field); + return unless exists $FIELDS{$field}; + push @fields, $field; + } + + return [ @fields ]; +} + # formats: # s - string, use as is # d - decimal, no-zero pad