++ed by:

1 PAUSE user

Behan Webster
and 1 contributors


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


  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

  # Movie




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.


Returns true if the object represents a DVD episode.


Returns true if the object represents a TV episode.


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


Returns true if the object represents a Movie.


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


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


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.


Behan Webster <behanw@websterwood.com>