Browse Source

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

master
Alex 'AdUser' Z 9 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 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;

Loading…
Cancel
Save