develooper Front page | perl.module-authors | Postings from April 2019

Re: [RFC] File::TVShow::Parse

Thread Next
Adam Spann
April 15, 2019 13:35
Re: [RFC] File::TVShow::Parse
Message ID:
I have completed the majority of the code for this module. Renamed it
File::TVShow::Info as well.

There are still a few things to do. But its main function of
extracting key identifying information is complete.

I am including the current README from the pod documentation.

One question however:

1) I have separted some data and arrays containing regex patterns into
seperate files
    Do I need to VERSION this pm file. The expectation would be that
this file would be updated and this would then
   require a minor version update to the File::TVShow::Info Note that
VERSION is so if EpsiodeName is updated
   Info would become and a minor update to Info would make
the version with a major code change resulting in

I look forward to hearing some feedback.

Kind Regards,
Adam Spann


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




    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 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');



    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


    Return the show name found in the file name.


    Return show_name after removing string delimiters


    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}


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


    Return season as an integer


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


    Return episode as an integer


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


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

    This is true if {endep} is defined.


    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.*


    Return 1 if year is defined else return 0


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


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


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


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


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


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


    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.


    Return episode name without delimiters.


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


    Return file extension. {ext}


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


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

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


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

    Must also return 1 for is_tv_subtitle()


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


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

    Must also return 1 for is_tv_subtitle()


    Return 1 if by date. Default is 0

    This will be true where year, month and date are all defined.


    Return 1 if by season. Default is 0

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


    Adam Spann, <baspann at>

On Thu, 21 Mar 2019 at 00:13, Adam Spann <> wrote:
> Thanks for the suggestions. I have decided to go with Info.
> At this point support legacy regex appears pretty straight forward. But I agree. It will be removed.
> I run my code on an old mac mini, late 2009 which has perl 5.14
> Thanks again for the feedback.
> Adam
> On Sun, 17 Mar 2019 at 04:09, John M. Gamble <> wrote:
>> I would tend toward Info myself. The existence of Video::Info is
>> irrelevant except for highlighting that Info is a valid choice. But I also
>> admit that's just me, and I tend to view Parse in a language context.
>> Don't bother trying to support Perl versions less that 5.10. Last I
>> checked the (admittedly unscientific) surveys, 5.10 was the lowest version
>> that had a sizeable usage percentage, and on a personal level, I just
>> don't want to support Perls with flawed security.
>> My current modules either have a minimum required versions of 5.10.1, or
>> 5.16.1, depending on whether I might have to deal with Unicode. I've never
>> had a complaint (I don't write pragmas or system-oriented code, so it's
>> never been anything I've need to worry about).
>>      -john
>> On Thu, March 14, 2019 10:56 pm, Adam Spann wrote:
>> > Hello Everyone,
>> >
>> > I am considering a module to supplement Video::Filename written by
>> > Behan Webster. I have tried reaching out to him in the past couple of
>> > weeks. Submitting a patch to provide support for show
>> >
>> >
>> >
>> > In the mean time I have been considering if a specific module for TV
>> > Shows only might also be worth while, of course with additional
>> > features and support.
>> >
>> > See attached podtotext file.
>> >
>> > I have a few questions.
>> >
>> > 1)
>> > Would it be better to go with Parse, Meta, or Info since we are
>> > attempting to get meta data from from the file naming. There is
>> > already a Video::Info which does the deep dive into the file contents
>> > from what I have read. I have not used the module itself.
>> >
>> > 2)
>> > Should I keep support for perl below version 5.10 as versions below
>> > this do not support named groups in regex. I have seen on PerlMonks
>> > that there are still questions being asked by people using perl
>> > versions less than 5.10
>> >
>> >
>> > Looking forward to hearing back.
>> >
>> > Best,
>> > Adam Spann
>> >

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About