++ed by:
PERLANCAR

1 PAUSE user

Behan Webster
and 1 contributors

NAME

Video::Filename - Parse filenames for information about the video

SYNOPSIS

  use Video::Filename;

  my $file = Video::Filename::new($filename, [$name, [$season, [$episode]]]);
  my $file = Video::Filename::new($filename, {
                                     name => 'series name',
                                     season => 4,
                                     episode => 5,
                                     spaces => '\s._-',
                                 } );
  # TV or DVD Episode
  $file->{regex}
  $file->{dir}
  $file->{file}
  $file->{name}
  $file->{dvd}
  $file->{season}
  $file->{episode}
  $file->{endep}
  $file->{subep}
  $file->{part}
  $file->{epname}
  $file->{ext}

  # Movie
  $file->{movie}
  $file->{year}
  $file->{imdb}
  $file->{title}

  $file->isDVDshow();
  $file->isTVshow();
  $file->isEpisode();
  $file->isMovie();

  $file->testVideoFilename();

DESCRIPTION

Video::Filename is used to parse information line name/season/episode and such from a video filename. It also does a reasonable job at distinguishing a movie from a tv episode.

$file = Video::Filename::new(FILENAME, [NAME, [SEASON, [EPISODE]]]);

Parse FILENAME and return a Video::Filename object containing the data. If you specify NAME, SEASON, and/or EPISODE it will override what is parsed from FILENAME.

Alternatively, arguments can be passed in a hashref. This also allows the user to specify the option of specifying characters which are replaced with spaces in the parsed 'name', 'epname', 'movie', and 'title' fields.

  my $file = Video::Filename::new('This.is.a.name.s01e01.episode_title.avi', {
                                     season => 4,
                                     spaces => '\s._-',
                                 } );
  print Dumper($file);

  $file = bless( {
                  'epname' => 'episode title',
                  'name' => 'This is a name',
                  'file' => 'This.is.a.name.s01e01.episode_title.avi',
                  'spaces' => '._',
                  'seasonepisode' => 'S04E01',
                  'episode' => 1,
                  'ext' => 'avi',
                  'season' => 4
                }, 'Video::Filename' );

Notice that that the season was overridden in the call to new(), so it's "4" instead of the "1" parsed from the file name.

isDVDshow();

Returns true if the object represents a DVD episode.

isTVshow();

Returns true if the object represents a TV episode.

isEpisode();

Returns true if the object represents an episode (TV or DVD).

isMovie();

Returns true if the object represents a Movie.

testVideoFilename();

Run a series of tests on the rules used to parse filenames. Basically a test harness.

COPYRIGHT

Copyright (c) 2008 by Behan Webster. All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

AUTHOR

Behan Webster <behanw@websterwood.com>