From bd246a75d5e9287ee1a907857cc306a38c274bb6 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Tue, 17 Mar 2015 14:43:59 +1000 Subject: [PATCH] * Subtitle::SSA->*_FMT : Uppercased Field Names --- lib/Subtitle/SSA.pm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/Subtitle/SSA.pm b/lib/Subtitle/SSA.pm index 3119b1b..b6fd2a3 100644 --- a/lib/Subtitle/SSA.pm +++ b/lib/Subtitle/SSA.pm @@ -7,16 +7,16 @@ use utf8; use base 'Subtitle::BASE'; -use constant SSA_STYLE_FMT => [qw(name fontname fontsize primarycolour secondarycolour - tertiarycolour backcolour bold italic - borderstyle outline shadow alignment marginl marginr marginv alphalevel encoding)]; +use constant SSA_STYLE_FMT => [qw(Name Fontname Fontsize PrimaryColour SecondaryColour + TertiaryColour BackColour Bold Italic + BorderStyle Outline Shadow Alignment MarginL MarginR MarginV AlphaLevel Encoding)]; -use constant ASS_STYLE_FMT => [qw(name fontname fontsize primarycolour secondarycolour - outlinecolour backcolour bold italic underline strikeout scalex scaley spacing angle - borderstyle outline shadow alignment marginl marginr marginv encoding)]; +use constant ASS_STYLE_FMT => [qw(Name Fontname Fontsize PrimaryColour SecondaryColour + OutlineColour BackColour Bold Italic Underline Strikeout ScaleX ScaleY Spacing Angle + BorderStyle Outline Shadow Alignment MarginL MarginR MarginV Encoding)]; -use constant SSA_EVENT_FMT => [qw(marked start end style name marginl marginr marginv effect text)]; -use constant ASS_EVENT_FMT => [qw(layer start end style name marginl marginr marginv effect text)]; +use constant SSA_EVENT_FMT => [qw(Marked Start End Style Name MarginL MarginR MarginV Effect Text)]; +use constant ASS_EVENT_FMT => [qw(Layer Start End Style Name MarginL MarginR MarginV Effect Text)]; sub new { my ($class, %args) = @_; @@ -170,8 +170,9 @@ sub parse { } unless ($self->{style_fmt}) { $self->log(warn => "Style format still not set, assuming default for $self->{type} type"); - $self->{style_fmt} = ($self->{type} and $self->{type} eq 'ass') + my @fmt = ($self->{type} and $self->{type} eq 'ass') ? ASS_STYLE_FMT : SSA_STYLE_FMT; + $self->{style_fmt} = [ map { lc($_) } @fmt ] ; } $self->parse_style($linenum, $line); next; @@ -189,8 +190,9 @@ sub parse { } unless ($self->{event_fmt}) { $self->log(warn => "Event format still not set, assuming default for $self->{type} type"); - $self->{event_fmt} = ($self->{type} and $self->{type} eq 'ass') + my @fmt = ($self->{type} and $self->{type} eq 'ass') ? ASS_EVENT_FMT : SSA_EVENT_FMT; + $self->{event_fmt} = [ map { lc($_) } @fmt ]; } $self->parse_event($linenum, $line); next;