Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ability to parse more filenames

  • Loading branch information...
commit 419eed61a073d8c47bc9a9c725cbde3def356c56 1 parent 1b7389e
@andrewrjones authored
Showing with 13 additions and 2 deletions.
  1. +2 −1  lib/App/MP4Meta/TV.pm
  2. +11 −1 t/lib/Test/App/MP4Meta/TV.pm
View
3  lib/App/MP4Meta/TV.pm
@@ -19,10 +19,11 @@ my @file_regexes = (
qr/^S(?<season>\d)-E(?<episode>\d)\s+-\s+(?<show>.*)$/,
qr/^(?<show>.*)\s+S(?<season>\d\d)(\s|)E(?<episode>\d\d)$/,
qr/^(?<show>.*)\.S(?<season>\d\d)E(?<episode>\d\d)/i,
- qr/^(?<show>.*) - S(?<season>\d\d?)E(?<episode>\d\d?)/i,
+ qr/^(?<show>.*)\s*-?\s*S(?<season>\d\d?)E(?<episode>\d\d?)/i,
qr/^(?<show>.*)-S(?<season>\d\d?)E(?<episode>\d\d?)/,
qr/^(?<show>.*)_S(?<season>\d\d?)E(?<episode>\d\d?)/,
qr/S(?<season>\d\d?)E(?<episode>\d\d?)/,
+ qr/^(?<show>.*)\s*-?\s*(?<season>\d\d?)x(?<episode>\d\d?)/,
);
sub new {
View
12 t/lib/Test/App/MP4Meta/TV.pm
@@ -118,7 +118,7 @@ sub apply_meta_set_title : Test(9) {
}
# test $tv->_parse_filename($filename)
-sub parse_filename : Test(21) {
+sub parse_filename : Test(27) {
my $self = shift;
my $t = $self->{tv};
@@ -153,6 +153,16 @@ sub parse_filename : Test(21) {
is( $title, 'Dexter' );
is( $season, 1 );
is( $episode, 1 );
+ ( $title, $season, $episode ) =
+ $t->_parse_filename('Dexter - 2x12 - The British Invasion.m4v');
+ is( $title, 'Dexter' );
+ is( $season, 2 );
+ is( $episode, 12 );
+ ( $title, $season, $episode ) =
+ $t->_parse_filename('Dexter S02E12 - The British Invasion.m4v');
+ is( $title, 'Dexter' );
+ is( $season, 2 );
+ is( $episode, 12 );
$t->{title} = 'Extras';
( $title, $season, $episode ) = $t->_parse_filename('Foo S01E01.m4v');
is( $title, 'Extras' );

0 comments on commit 419eed6

Please sign in to comment.
Something went wrong with that request. Please try again.