Browse Source

* Subtitle::SSA->*_FMT : Uppercased Field Names

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

22
lib/Subtitle/SSA.pm

@ -7,16 +7,16 @@ use utf8;
use base 'Subtitle::BASE'; use base 'Subtitle::BASE';
use constant SSA_STYLE_FMT => [qw(name fontname fontsize primarycolour secondarycolour use constant SSA_STYLE_FMT => [qw(Name Fontname Fontsize PrimaryColour SecondaryColour
tertiarycolour backcolour bold italic TertiaryColour BackColour Bold Italic
borderstyle outline shadow alignment marginl marginr marginv alphalevel encoding)]; BorderStyle Outline Shadow Alignment MarginL MarginR MarginV AlphaLevel Encoding)];
use constant ASS_STYLE_FMT => [qw(name fontname fontsize primarycolour secondarycolour use constant ASS_STYLE_FMT => [qw(Name Fontname Fontsize PrimaryColour SecondaryColour
outlinecolour backcolour bold italic underline strikeout scalex scaley spacing angle OutlineColour BackColour Bold Italic Underline Strikeout ScaleX ScaleY Spacing Angle
borderstyle outline shadow alignment marginl marginr marginv encoding)]; 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 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 ASS_EVENT_FMT => [qw(Layer Start End Style Name MarginL MarginR MarginV Effect Text)];
sub new { sub new {
my ($class, %args) = @_; my ($class, %args) = @_;
@ -170,8 +170,9 @@ sub parse {
} }
unless ($self->{style_fmt}) { unless ($self->{style_fmt}) {
$self->log(warn => "Style format still not set, assuming default for $self->{type} type"); $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; ? ASS_STYLE_FMT : SSA_STYLE_FMT;
$self->{style_fmt} = [ map { lc($_) } @fmt ] ;
} }
$self->parse_style($linenum, $line); $self->parse_style($linenum, $line);
next; next;
@ -189,8 +190,9 @@ sub parse {
} }
unless ($self->{event_fmt}) { unless ($self->{event_fmt}) {
$self->log(warn => "Event format still not set, assuming default for $self->{type} type"); $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; ? ASS_EVENT_FMT : SSA_EVENT_FMT;
$self->{event_fmt} = [ map { lc($_) } @fmt ];
} }
$self->parse_event($linenum, $line); $self->parse_event($linenum, $line);
next; next;

Loading…
Cancel
Save