Help with samples filter RegEx (1 Viewer)

ajs

Development Group
  • Team MediaPortal
  • February 29, 2008
    15,669
    10,624
    Kyiv
    Home Country
    Ukraine Ukraine
    was expecting a full path+file match, which might explain why searching for \Extras\ or /Extras/ can fail if the folder string does not contain the 'slash' at the end.
    Agree, Then regexp this should work:
    Code:
    ([/\\]((sample)|(extra)|(trailer))s?[/\\]?)
    but it's better to change:
    Code:
    match = expr.Match(file.DirectoryName).Success;
    to:
    Code:
    match = expr.Match(file.FullName).Success;
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,669
    10,624
    Kyiv
    Home Country
    Ukraine Ukraine
    Also I can't remember if .Success works on regular expression arrays, in which case you would have to simplify your expressions to ensure no array results are returned.
    Worked ...
    The Success property is true if at least one substring was captured by this group. It is equivalent to the Boolean expression (Group.Captures.Count > 0).
    PS:
    But you can always get away from creating groups: :coffee:
    Code:
    (?:[/\\](?:(?:sample)|(?:extra)|(?:trailer))s?[/\\]?)
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    @ajs, thanks for the research, I wonder if we scared @kiwijunglist off yet with our tech analysis :)

    @ltfearme might be an idea indeed to use file.FullName to avoid these issues, as it makes more sense I think, and would allow for better regular expressions that avoid false positives.
     

    kiwijunglist

    Super Moderator
  • Team MediaPortal
  • June 10, 2008
    6,746
    1,751
    New Zealand
    Home Country
    New Zealand New Zealand
    @RoChess - Started a new job today at a different hospital =) but yea don't have much understanding of RegEx :D[DOUBLEPOST=1450073672][/DOUBLEPOST]
    Code:
    (?:[/\\](?:(?:sample)|(?:extra)|(?:trailer))s?[/\\]?)

    ^ so this is what i should use for the moment>
     
    Last edited:

    Matt Kirby

    Portal Member
    June 14, 2009
    43
    8
    Home Country
    United Kingdom United Kingdom
    I've worked something out that might be helpful - when changing the sample regex, you also need to look at the file size filter as well - it's not either/or, its both. And restarting Moving Pictures also seems to help - sometimes I made changes that didn't seem to take effect until I did.

    In the advanced settings, the "Settings Details" text for the regex setting suggests that the regex will be used to identify "that the file is a possible sample".

    Then, for the max filesize setting it says "if the filesize of the potential sample file is below this value it will be skipped".

    So - it first uses the regex, and then checks the size - so only files that match regex and are lower than the size will be ignored.

    I have downloaded trailers in the same folder as my films, and I'd rather have Moving Pictures ignore them as I use the trailers plugin if I want to watch the trailer. Otherwise the trailer plays after the film, and the calculated time of the film is off.

    I don't know if this will work for files in a separate folder however.

    I tried the simple regex of "sample|plugin" which didn't make any difference, until I also changed the filesize - as my trailers were bigger than the default 150. Setting this to 200, restarting Moving Pictures, and sending a film back to the importer resulted in the film being imported, without the trailer being added.

    The more complex regex didn't seem to work - but I'm not worried about my simpler regex causing false positives - as any film file with either the word "sample" or "trailer" in the title will be bigger than 200 Mb, so won't be ignored.
     

    Users who are viewing this thread

    Similar threads

    Hello all, Recently I have been having a few problems importing movies to Moving Pictures using the IMDB+ plugin (missing fields) so I have decided to have a go at creating an XML based on the XBMC Local xml. This has not been tested with multi languages and it has been configured for my personal collection. I'm hoping it will work...
    Hello all, Recently I have been having a few problems importing movies to Moving Pictures using the IMDB+ plugin (missing fields)...
    Hello all, Recently I have been having a few problems importing movies to Moving Pictures using the IMDB+ plugin (missing fields)...
    Replies
    0
    Views
    517
    • Sticky
    MP1 MP2 [News] MediaPortal 2 - 2.5 Release DE
    Will be version 2.5.1 ready quite soon? I read somewhere it will be a bugfix release, no new features are probably not in focus.
    Will be version 2.5.1 ready quite soon? I read somewhere it will be a bugfix release, no new features are probably not in focus.
    We are proud to present MediaPortal 2.5 MediaPortal 2.5 is a full-blown media center software that addresses most common user...
    Replies
    70
    Views
    5K
    @Pablik do you have commits available for IR Server, github repo already available https://github.com/MediaPortal/IR-Server-Suite
    @Pablik do you have commits available for IR Server, github repo already available https://github.com/MediaPortal/IR-Server-Suite
    I have decided to rework this post, becouse is no longer relevant. The SharpDX version is already included in MediaPortal since...
    Replies
    964
    Views
    80K
    This is not possible if it is a self made series, like personal travel videos etc.
    This is not possible if it is a self made series, like personal travel videos etc.
    Hi! I have videos that I want to show in TV-Series, such as personal TV series and educational series. As some examples I have...
    Replies
    8
    Views
    2K
    MP1 MP2 MP2 - V2.4 MediaPortal 2 - 2.4 Release DE
    Good job, nice release as usual (y)
    Good job, nice release as usual (y)
    We are proud to present MediaPortal 2.4 MediaPortal 2.4 is a full-blown media center software that addresses most common user...
    Replies
    5
    Views
    3K
    Top Bottom