Parsing invalid episode names

Discussion in 'My TVSeries' started by ultimatejoe, April 21, 2018.

  1. ultimatejoe

    ultimatejoe Portal Member

    Joined:
    October 14, 2007
    Messages:
    39
    Likes Received:
    0
    Ratings:
    +2 / 1
    Home Country:
    Canada Canada
    Show System Specs
    For whatever reason, SchedulesDirect is getting bad EPG data from my service provider (Beanfield in Canada) and as a result I'm getting wonky episode names; it happens for about 10% of the shows I record. That being said, the correct information is IN the filename, I just can't figure out the parsing string I need to use to get it. When I do get bad filenames they come in one of two flavours (below), and I'm hoping the tall foreheads here can help me:



    I use the following format: <SeriesName> - S<SeriesNumber>E<EpisodeNumber> - <EpisodeTitle> which should produce something like: Brooklyn Nine-Nine - S05E18 - DFW

    Issue one:
    \Brooklyn Nine-Nine - SEP01739009E518 - DFW
    The XML has a wonky series number ("EP01739009"), then includes the series number AND epside number as the episode value ("518"). Basically I need to figure out how to ignore the wonky series number, and split out the series and episode numbers from the last three digits in the text string.

    Issue two:
    \S05E518 - DFW
    Sometimes after MCEBuddy has done it's thing it will capture the series number in the episode number. I'm assuming this is related to the bad XML issue I've described above but I can't figure out how to manage on the MCEBuddy side so I'm hoping there's a way I can set up My TvSeries to read this correctly as well.

    Any help would be greatly appreciated.
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Edalex
    • Premium Supporter

    Edalex Community Plugin Dev

    Joined:
    January 3, 2008
    Messages:
    2,906
    Likes Received:
    713
    Gender:
    Male
    Location:
    Saratov
    Ratings:
    +1,229 / 9
    Home Country:
    Russian Federation Russian Federation
    Show System Specs
    If you want to import them in MP-TVSeries you could creare replacement strings in config. If replacement are not so simple you could use regex.
     
  4. ultimatejoe

    ultimatejoe Portal Member

    Joined:
    October 14, 2007
    Messages:
    39
    Likes Received:
    0
    Ratings:
    +2 / 1
    Home Country:
    Canada Canada
    Show System Specs
    Thanks. That much I've figured, where I'm struggling is how to configure the replacement strings. Regex is a bit over my head, and the series number is unique so I can't just use a single value. I'm hoping that someone here can suggest what replacement strings or parsing strings would work.
     
  5. Edalex
    • Premium Supporter

    Edalex Community Plugin Dev

    Joined:
    January 3, 2008
    Messages:
    2,906
    Likes Received:
    713
    Gender:
    Male
    Location:
    Saratov
    Ratings:
    +1,229 / 9
    Home Country:
    Russian Federation Russian Federation
    Show System Specs
    Let's call regex's & mptvseries guru @RoChess
     
  6. RoChess
    • Premium Supporter

    RoChess Extension Developer

    Joined:
    March 10, 2006
    Messages:
    4,186
    Likes Received:
    1,305
    Ratings:
    +1,684 / 2
    @ultimatejoe

    It would have been easy to create one, but no full source filename example was provided, so I cannot build a proper RegExp for it.

    Going on the hypothesis that it would be "Brooklyn Nine-Nine - SEP01739009E518 - DFW.mkv" you can use:

    Code (Text):
    1. (^.*?\\?(?<series>[^\\$]+?)[ .-]+(?:SEP\d+E)?(?<season>\d+)(?<episode>\d{2}))[ .-]*(?<title>(?![^\\]*?(?<!the)[ .(-]sample[ .)-]).*?)\.(?<ext>[^.]*)$

    This will remain effective even when Brooklyn Nine-Nine moves into season 10+

    For the 2nd one, you will have to use string replacement if MCEBuddy at least puts it in the right folder, so you can expand upon that knowledge, or provide better folder+file examples of your situation.
     
    Last edited: April 23, 2018
    • Like Like x 1
  7. ultimatejoe

    ultimatejoe Portal Member

    Joined:
    October 14, 2007
    Messages:
    39
    Likes Received:
    0
    Ratings:
    +2 / 1
    Home Country:
    Canada Canada
    Show System Specs
    Sorry, you're absolutely right. Here's an example of a file with the weird season/episode values, from the root "series" recording folder:

    series\Bob's Burgers\Bob's Burgers - SEP01279298E801 - Go Tina on the Mountain.ts

    Here's the example where the root "TV Recordings" folder:

    TV Recordings\Brooklyn Nine-Nine\Season 05\S05E514-The Puzzle Master.mkv
     
  8. RoChess
    • Premium Supporter

    RoChess Extension Developer

    Joined:
    March 10, 2006
    Messages:
    4,186
    Likes Received:
    1,305
    Ratings:
    +1,684 / 2
    The RegExp provided works on 1st one as:

    Series = Bob's Burgers
    Season = 8
    Episode = 01
    Title = Go Tina on the Mountain
    Extension = ts​

    For The other scenario, use:

    Code (Text):
    1. (^.*?\\?(?<series>[^\\$]+?)\\Season \d+\\S\d+E(?<season>\d+)(?<episode>\d{2}))[ .-]*(?<title>(?![^\\]*?(?<!the)[ .(-]sample[ .)-]).*?)\.(?<ext>[^.]*)$
     
    • Like Like x 1
  9. ultimatejoe

    ultimatejoe Portal Member

    Joined:
    October 14, 2007
    Messages:
    39
    Likes Received:
    0
    Ratings:
    +2 / 1
    Home Country:
    Canada Canada
    Show System Specs
    You are my hero. If you're ever in Toronto I'll buy you a beer. Both strings worked perfectly. I can finally use the plugin to manage TV before AND after I record the episodes. I've been trying to make that work since 2009.
     
  10. RoChess
    • Premium Supporter

    RoChess Extension Developer

    Joined:
    March 10, 2006
    Messages:
    4,186
    Likes Received:
    1,305
    Ratings:
    +1,684 / 2
    Could have done this for you 9 years ago if you made the forum request :)
     
  11. Edalex
    • Premium Supporter

    Edalex Community Plugin Dev

    Joined:
    January 3, 2008
    Messages:
    2,906
    Likes Received:
    713
    Gender:
    Male
    Location:
    Saratov
    Ratings:
    +1,229 / 9
    Home Country:
    Russian Federation Russian Federation
    Show System Specs
    Also you could've asked SchedulesDirect to fix EPG data since you're paying for it.
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!