The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

File::TVShow::Info - Perl meta data extractor from file name for TV Show file.

VERSION

Version 0.01.0.1

SYNOPSIS

This module is intended to identify and extract nformation in the file name of a TV show. These details can then be accessed by calling the relevant methods. It does NOT attempt to read the contents of the file.

Note: This module will be modelled off https://metacpan.org/pod/Video::Filename created by Behan Webster, but will focus on TV Shows only and with additional features.

If the file name is parsed and can not be identified as a TV show then "is_tv_show" will return 0.

    use File::TVShow::Info;
    my $show = File::TVShow::Info->new('file');

Methods

new

Create a Info object to extract meta information from the file name.

    my $show = File::TVShow::Info->new('file');

Object attributes.

Attributes may be accessed through $show->{attribute_name} however methods do exist for all required operations.

  • show_name: Name of the show.

  • original_show_name: This will contain the show name found in the file name without any modifications. This will only be defined if _isolate_name_year has found a year string within the file name such as name.2019, name.(2019), name 2018, name (2018)

  • season: Show season

  • episode: Show episode

  • episode_name

  • country

  • endep: (Naming under consideration) last Episode number found when file name contains SXXEXXEXX

  • year, month, date: Show date e.g 2019.03.03 This can be accessed using the method "ymd" Note: year will be defined in two cases. One: show name contains year. show_name.yyyy or Two: File name contains YYYY.MM.DD that are identified by date. These are mutually exclusive and no conflict is expected.

  • source

  • resolution: Show resolution 480p/720p and so on. This will be '' if not found.

  • release_group

  • is_subtitle

  • subtitle_lang

  • ext: File extension

show_name

Return the show name found in the file name.

strip_show_name

Return show_name after removing string delimiters

clean_show_name

Return complete show name with year and country in brackets if they exist. Also remove any delimiters, replaced with spaces

original_show_name

Return the original show name.

This method will return the orginal show name if original_show_name is defined. This will be defined if show_name contains a year string (YYYY) or YYYY

If not defined it will return {show_name}

season

Return the season found in the file name. Return '' if {season} is not defined.

season_to_int

Return season as an integer

episode

Return the episode found in the file name. Return '' if {episode} is not defined.

episode_to_int

Return episode as an integer

source

Return the source of tv show. Return '' if not defined. Yet to be coded.

is_multi_episode

Return 1 if this is a multi-episode file SXXEXXEXX. Return 0 if false

This is true if {endep} is defined.

season_episode

Return SXXEXX or SXXEXXEXX for single or multi episode files. Return '' if not created

This would only return an empty string if the show_name is not formated as show_name.SXX.*

has_year

Return 1 if year is defined else return 0

year

Return the year found in the file name. Return '' if {year} is not defined.

month

Return the month found in the file name. Return '' if {month} is not defined.

date

Return the date found in the file name. Return '' if {date} is not defined.

ymd

Return the complete date string as 'YYYY.MM.DD' Ruturn '' if attributes {year}, {month}, and {date} are not defined.

resolution

Return resolution found in the file name. Return '' if {resolution} is not defined.

release_group

Return release_group found in the file name. Return '' if {release_group} is not defined.

episode_name

Return episode_name. Return '' if {extra_meta} is not defined or can not determine episode name.

Note: episode name MUST directly follow SXXEXX or it can not be found.

strip_episode_name

Return episode name without delimiters.

country

Return country found in {show_name}. Return '' if not defined

ext

Return file extension. {ext}

is_tv_show

Return 1 if identified as a TV Show. Default is 0

is_tv_subtitle

Return 1 if the file is a subtitle file, 0 if {is_subtitle} is not defined.

The file must also return true for is_tv_show() or the result is 0

has_subtitle_lang

Return 1 if subtitle language was found, Return 0 if {subtitle_lang} is not defined.

Must also return 1 for is_tv_subtitle()

subtitle_lang

Return the language of the subtitle file: eng or en. Return '' if {subtitle_lang} is not defined.

has_country

Return 1 if country was found, Return 0 if {country} is not defined.

Must also return 1 for is_tv_subtitle()

is_by_date

Return 1 if by date. Default is 0

This will be true where year, month and date are all defined. show_name.yyyy.mm.dd.ext

is_by_season

Return 1 if by season. Default is 0

Requires {season} and {episode} to be defined.

AUTHOR

Adam Spann, <bans at cpan.org>

BUGS

Please report any bugs or feature requests to bug-file-tvshow-info at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-TVShow-Info. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc File::TVShow::Info

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2019 Adam Spann.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.