Help with samples filter RegEx (3 Viewers)

kiwijunglist

Super Moderator
  • Team MediaPortal
  • June 10, 2008
    6,746
    1,751
    New Zealand
    Home Country
    New Zealand New Zealand
    J:\MOVIES [HD]\Escobar Paradise Lost (2014) - tt2515030\Extras\Test File.mkv

    if I create like above, then I restart importer it tries to match the test file.mkv to the movie "Extras (2005)"
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,069
    11,153
    Kyiv
    Home Country
    Ukraine Ukraine
    May be:
    ((sample)s?)|(\\((extra)|(trailer))s?\\)
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,069
    11,153
    Kyiv
    Home Country
    Ukraine Ukraine
    @kiwijunglist
    Hmmm ... try:
    Code:
    (\\?((sample)|(extra)|(trailer))s?\\?(.+?\.[a-z]{3,4}))
    upload_2015-12-8_10-52-38.png
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    I would need to see movingpictures.log debug results on what MovPic is using to apply sample filter on.

    Presuming of course that the log file contains all the info needed.

    It could also be that the setting is not actually using regular expression, or that it demands a single entry output.

    To debug, does "sample|extras" work?

    I don't think the noise filter will do any good, because that only works for filenames if memory serves me.

    PS: Have you considered just adjusting the "Max Filesize (MB)" values to one that would still work for your smallest actual movie, but then exclude all the extras/bonus/samples automatic? Unless of course you have those monster behind-the-scene high definition documentaries. Another solution for those is to rely on the multi-part system, and call the movie itself CD1/Part1/etc, and then the bonus CD2/Part2/etc. That way the movie only gets a single entry in Moving-Pictures, and you still have the ability to play the bonus features at the end. The only downside is that runtime will be off, as it will be calculated on both. Another alternative would be to use IMDb+ and add something like "([Bonus])" to the filename, so that it will become a separate entry in your collection that is easy to identify.

    Using sample|extras should have worked though :(
     
    Last edited:

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,069
    11,153
    Kyiv
    Home Country
    Ukraine Ukraine
    It could also be that the setting is not actually using regular expression, or that it demands a single entry output.
    Code:
            [CornerstoneSetting(
                Name = "Regular Expression Filter",
                Description = "a regular expression that matches keywords in the filename or it's parent folder indicating that the file is possible sample.",
                Groups = "|Movie Importer|Sample Filter|",
                Identifier = "importer_sample_keyword",
                Default = "sample")]
            public string SampleRegExFilter {
                get { return _sampleRegExFilter; }
                set {
                    _sampleRegExFilter = value;
                    OnSettingChanged("importer_sample_keyword");
                }
            }
            private string _sampleRegExFilter;
    Code:
              public static bool isSampleFile(FileInfo file) {
                try {
                    // Create the sample filter regular expression
                    Regex expr = new Regex(MovingPicturesCore.Settings.SampleRegExFilter, RegexOptions.IgnoreCase);
                    // Set sample max size in bytes and check the file size
                    long sampleMaxSize = MovingPicturesCore.Settings.MaxSampleFilesize * 1024 * 1024;
                    bool match = (file.Length < sampleMaxSize);
                    if (match) {
                        // check the filename
                        match = expr.Match(file.Name).Success;
                        if (!match && MovingPicturesCore.Settings.SampleIncludeFolderName) {
                            // check the folder name if specified
                            match = expr.Match(file.DirectoryName).Success;
                        }
                    }
                    // Return result of given conditions  
                    return match;
                }
                catch (Exception e) {
                    if (e is ThreadAbortException)
                        throw e;
    
                    logger.Warn("Sample file check failed: {0}", e.Message);
                    return false;
                }
            }
     
    Last edited:

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,069
    11,153
    Kyiv
    Home Country
    Ukraine Ukraine
    @kiwijunglist
    Try set "Max Filesize (MB) - If the filesize of the potential sample file is below this value it will be skipped." to large value, like 500 or bigger ... but:
    Code:
    long sampleMaxSize = MovingPicturesCore.Settings.MaxSampleFilesize * 1024 * 1024;
    bool match = (file.Length < sampleMaxSize);
    if(match){...
    IMHO wrong logic :( I would have done so:
    Code:
    public static bool isSampleFile(FileInfo file) {
                try {
                    // Create the sample filter regular expression
                    Regex expr = new Regex(MovingPicturesCore.Settings.SampleRegExFilter, RegexOptions.IgnoreCase);
                    // Set sample max size in bytes and check the file size
                    long sampleMaxSize = MovingPicturesCore.Settings.MaxSampleFilesize * 1024 * 1024;
                    bool match = (file.Length < sampleMaxSize);
                    if (!match) {
                        // check the filename
                        match = expr.Match(file.Name).Success;
                        if (!match && MovingPicturesCore.Settings.SampleIncludeFolderName) {
                            // check the folder name if specified
                            match = expr.Match(file.DirectoryName).Success;
                        }
                    }
                    // Return result of given conditions  
                    return match;
                }
                catch (Exception e) {
                    if (e is ThreadAbortException)
                        throw e;
                    logger.Warn("Sample file check failed: {0}", e.Message);
                    return false;
                }
            }
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,069
    11,153
    Kyiv
    Home Country
    Ukraine Ukraine
    And regexp:
    Code:
    (samples?)|(\\((extra)|(trailer))s?\\)
    or
    Code:
    (\\((sample)|(extra)|(trailer))s?\\)
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    @ajs, thanks for pulling the relevant code, because I did notice that file, and folder are scanned seperate.

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

    Log file might have clarified that if it shows the true debug value on what is being used.

    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.
     

    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
    636
    • Sticky
    All good now!!
    All good now!!
    We have just released MediaPortal 1.36 - Polar Express x86 and x64 version. Highlights of this release Bugfixes: [MP1-5229] -...
    Replies
    2
    Views
    945
    • Sticky
    MP1 MP2 [News] MediaPortal 2 - 2.5 Release DE
    Well just tried that. Chose TV Channels and clicked "Clear". All channels cleared then did a rescan. What a shitshow! All channel number mappings a total mess: STV as Channel 1, W as Channel 18, BBC channels way down the list. Thanks for trying to help but this software, for me, is just a mess. Appreciate all the time you have...
    Well just tried that. Chose TV Channels and clicked "Clear". All channels cleared then did a rescan. What a shitshow! All...
    We are proud to present MediaPortal 2.5 MediaPortal 2.5 is a full-blown media center software that addresses most common user...
    Replies
    76
    Views
    11K
    The Tv Movie Epg Import really doesn't work. Problem is in missing x64 MS Jet 4.0 Oledb database provider and newer ACE is unable to load old Jet DB. I had to create x86 reader to read the db. Unpack the content from the attached file into your TvServer Plugins folder (replace old TvMovie.dll). The Clickfinder application install...
    The Tv Movie Epg Import really doesn't work. Problem is in missing x64 MS Jet 4.0 Oledb database provider and newer ACE is unable...
    I have decided to rework this post, becouse is no longer relevant. The SharpDX version is already included in MediaPortal since...
    Replies
    966
    Views
    112K
    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
    3K
    Top Bottom