Expressions/Rules requests (2 Viewers)

superman859

Portal Member
June 20, 2009
14
0
Thanks. I have never used named groups before and always just used numbers for captured references in the past. Knowing about named groups can be handy!

I was thinking that the plugin had something to do with it filling in <series> and <season> by matching them to sections not defined in the regex or something (something like <series> matching (.*) and <season> matching (\d+) or something along those lines...dumb moment!) Named groups definitely makes more sense than my weird ideas.

I should be able to figure it out from there. Thanks.
 

Spragleknas

Moderator
  • Team MediaPortal
  • December 21, 2005
    9,474
    1,822
    Located
    Home Country
    Norway Norway
    Hi. Whenever I do a clean install, I manually have to add a rule to get a couple of shows working. Would it be possible to add this:
    <series>.S<season>.E<episode>(.<ext>)
    ie: Dexter.S02.E07
    :D
     

    BalthazarKitty

    Portal Member
    May 3, 2010
    5
    0
    Home Country
    United States of America United States of America
    Hi All,

    I am having some trouble with my naming convention that i am hopping someone can help me with.

    My biggest issue right now is that I like to have the years for the season and dont know how to write an expression that will ignore them (as mytv doesnt need that information)

    Files system:
    F:\TV Shows\Star Trek Voyager\Season 5 (1998-1999)\514-Bliss.avi
    F:\TV Shows\Star Trek Voyager\Season 5 (1998-1999)\515-516-Dark Frontier.avi

    All of my shows (4000+ episodes) are organized in this fashion and I would rather not have to change them all, i found that the following code will work if i remove the (1998-1999).

    Code:
    (?<series>[\w .,'!&$]*)\\[\w\s0-9]*\\(?<season>[0-9]{1})(?<episode>[0-9]{2}).{3}(?<title>[\w .,'!&$]*)\.

    If someone could let me know how this would need to be modified that would be fantastic. Also if someone knows how to make this work for multiple episodes like the second example that would be nice, but if not there arnt very many like that and i can do them by hand.

    Thanks for any assistance
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    Files system:
    F:\TV Shows\Star Trek Voyager\Season 5 (1998-1999)\514-Bliss.avi
    F:\TV Shows\Star Trek Voyager\Season 5 (1998-1999)\515-516-Dark Frontier.avi

    I used Expresso to build the following:

    (?<series>[^\\$]*)\\Season\s(?<season>\d+)(?:\s?\(\d{4}-\d{4}\))?\\(?:\d{1})(?<episode>\d+)[-]?(?:\d{1})?(?<episode2>\d+)?[-]?(?<title>[^\.]*)\.(?<ext>[^.]*)$​

    and it works on those 2 examples provided, however it will seriously fail if you go into season 10+, as there is no way to detect that.

    The (year-year) is optional, so the same expression will also work if that part doesn't exist.
     

    BalthazarKitty

    Portal Member
    May 3, 2010
    5
    0
    Home Country
    United States of America United States of America
    I used Expresso to build the following:

    (?<series>[^\\$]*)\\Season\s(?<season>\d+)(?:\s?\(\d{4}-\d{4}\))?\\(?:\d{1})(?<episode>\d+)[-]?(?:\d{1})?(?<episode2>\d+)?[-]?(?<title>[^\.]*)\.(?<ext>[^.]*)$​

    and it works on those 2 examples provided, however it will seriously fail if you go into season 10+, as there is no way to detect that.


    This works great and is much appreciated, as far as season 10+ goes, it picked up every season 10+ i have, 10 seasons of the simpsons and the 10th season of stargate sg1

    Thanks again

    PS: For anyone else who organizes this way, ive edited RoChess's expression for series with only one year ie (1999) instead of (1998-1999)

    Code:
    (?<series>[^\\$]*)\\Season\s(?<season>\d+)(?:\s?\(\d{4}\))?\\(?:\d{1})(?<episode>\d+)[-]?(?:\d{1})?(?<episode2>\d+)?[-]?(?<title>[^\.]*)\.(?<ext>[^.]*)$
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    This works great and is much appreciated, as far as season 10+ goes, it picked up every season 10+ i have, 10 seasons of the simpsons and the 10th season of stargate sg1

    Yes, 10th season is ok, because the '0' being added to episode is ignored. So I should have been more clearer that 11+ goes wrong. 1101 is seen as S01E101, due to the fact that only 1 digit is removed on season+episode number, and no divider is provided to tell otherwise. This is a really terrible notation, and would require a lot more code to strip off the season from folder.

    And instead of another regular expression, if you have just provided the example that a single year is possible, I could have immediatly provided you with a single expression that covers all:

    (?<series>[^\\$]*)\\Season\s(?<season>\d+).*?\\(?:\d{1})(?<episode>\d+)[-]?(?:\d{1})?(?<episode2>\d+)?[-]?(?<title>[^\.]*)\.(?<ext>[^.]*)$​

    Infact I just made it accept anything after season number, so it doesn't matter.
     

    BalthazarKitty

    Portal Member
    May 3, 2010
    5
    0
    Home Country
    United States of America United States of America
    Yes, 10th season is ok, because the '0' being added to episode is ignored. So I should have been more clearer that 11+ goes wrong. 1101 is seen as S01E101, due to the fact that only 1 digit is removed on season+episode number, and no divider is provided to tell otherwise. This is a really terrible notation, and would require a lot more code to strip off the season from folder.

    And instead of another regular expression, if you have just provided the example that a single year is possible, I could have immediatly provided you with a single expression that covers all:

    (?<series>[^\\$]*)\\Season\s(?<season>\d+).*?\\(?:\d{1})(?<episode>\d+)[-]?(?:\d{1})?(?<episode2>\d+)?[-]?(?<title>[^\.]*)\.(?<ext>[^.]*)$​

    Infact I just made it accept anything after season number, so it doesn't matter.

    You misunderstand, when I say it worked for 10 seasons of the simpsons i mean that it got seasons 10-20 without a problem, not my field of expertise but i believe it works bc its getting the season from the "Season 11 (1999-2000)" portion and not the "1101-Beyond Blunderdome" portion.

    The reason I didnt include the single year was simply bc it was a variable i hadnt thought about until i was using the expression you built on everything instead of a test season, and instead of asking for more of your time I figured a way to do it myself, but I appreciate the single expression that will do everything.
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    You misunderstand, when I say it worked for 10 seasons of the simpsons i mean that it got seasons 10-20 without a problem, not my field of expertise but i believe it works bc its getting the season from the "Season 11 (1999-2000)" portion and not the "1101-Beyond Blunderdome" portion.

    Yes, season it gets from the foldername, so that part will be correct. But it is the episode that messes up, because in RegExp on the "1101-Beyond Blunderdome" part it skips only the first digit and takes the rest as episode, so you would get Episode #101, which will fail to match (well it should).
     

    BalthazarKitty

    Portal Member
    May 3, 2010
    5
    0
    Home Country
    United States of America United States of America
    Yes, season it gets from the foldername, so that part will be correct. But it is the episode that messes up, because in RegExp on the "1101-Beyond Blunderdome" part it skips only the first digit and takes the rest as episode, so you would get Episode #101, which will fail to match (well it should).

    Ok I see what you are talking about now, is it possible to write an RegExp with an if statment? so if 4 digits exist then remove first 2 else remove first 1

    Thanks for your patients and help
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    Yes, season it gets from the foldername, so that part will be correct. But it is the episode that messes up, because in RegExp on the "1101-Beyond Blunderdome" part it skips only the first digit and takes the rest as episode, so you would get Episode #101, which will fail to match (well it should).

    Ok I see what you are talking about now, is it possible to write an RegExp with an if statment? so if 4 digits exist then remove first 2 else remove first 1

    Thanks for your patients and help

    Impossible as far as I know. You need a seperator. Never seen that format used anywhere, because it is impossible to know what it would be, without AI anyway. There are shows with 100+ episodes on first season as well, so 1101 could mean both S11E01 and S01E101.

    And you can't use a 2nd parsing expression, because you would get a false positive on the one preceeding it.
     

    Users who are viewing this thread

    Top Bottom