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

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

Thread Previous | Thread Next
From:
Dan Book
Date:
April 15, 2019 16:04
Subject:
Re: [RFC] File::TVShow::Parse
Message ID:
CABMkAVXBnA+RVC7SYmVu1rZ+T=kmA4PDCjTeO4s+nyBess-z8w@mail.gmail.com
Best practice is to $VERSION all modules in your distribution, because then
other distributions can depend on a certain version of any module they are
using rather than only the main module. You can bump versions in modules
separately based on when each is updated, but generally it ends up being
simpler in the long run if you keep all versions the same, thus matching
the distribution version, and bump all of them each release. Authoring
tools like Dist::Zilla/Milla/Minilla can manage these versions for you (see
the Starter bundle's managed_versions option for Dist::Zilla), and
otherwise I wrote a tool that may be helpful:
https://metacpan.org/pod/perl-bump-version

As a side note, remember that the X.Y.Z form of versions (with more than
one decimal point) is a sequence of integers, thus leading zeroes in any
section are insignificant. Make sure not to accidentally use the X.Y form,
which in Perl is treated as a decimal number that isn't directly
compatible. Further reading:
http://blogs.perl.org/users/grinnz/2018/04/a-guide-to-versions-in-perl.html

-Dan

On Mon, Apr 15, 2019 at 9:35 AM Adam Spann <baspann@gmail.com> wrote:

> 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
>     E.G File:TVShow::EpisodeName.pm
>     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 0.01.0.0 so if EpsiodeName is updated
>    Info would become 0.01.0.1 and a minor update to Info would make
> the version 0.01.1.0 with a major code change resulting in 0.02.0.0
>
>
> I look forward to hearing some feedback.
>
> Kind Regards,
> Adam Spann
>
> NAME
>
>     File::TVShow::Info - Perl meta data extractor from file name for TV
>     Show file.
>
> VERSION
>
>     Version 0.01.0.0
>
> 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
>
>  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, <baspann at gmail.com>
>
> On Thu, 21 Mar 2019 at 00:13, Adam Spann <baspann@gmail.com> 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 <jgamble@ripco.com> 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
> >> > name.yyyy.mm.dd.ext
> >> >
> >> >
> >> > 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 Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About