From c7e25998fbccce71bfb954db874ebde0b441485e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 20 Oct 2013 13:06:58 +0000 Subject: [PATCH] * fine-tune series detection and SxE matching @see http://www.filebot.net/forums/viewtopic.php?f=6&p=6353 --- .../filebot/media/MediaDetection.java | 9 ++++--- .../similarity/SeasonEpisodeMatcher.java | 24 +++++++++++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index 4437b5c8..5c109f8b 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -332,10 +332,13 @@ public class MediaDetection { // less reliable CWS deep matching matches.addAll(matchSeriesByName(folders, 2)); matches.addAll(matchSeriesByName(filenames, 2)); - } - // pass along only valid terms - names.addAll(stripBlacklistedTerms(matches)); + // pass along only valid terms + names.addAll(stripBlacklistedTerms(matches)); + } else { + // trust terms matched by 0-stance + names.addAll(matches); + } } catch (Exception e) { Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to match folder structure: " + e.getMessage(), e); } diff --git a/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java b/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java index a7ed4dec..04c68bca 100644 --- a/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java +++ b/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java @@ -24,7 +24,7 @@ public class SeasonEpisodeMatcher { private Pattern seasonPattern; public SeasonEpisodeMatcher(SeasonEpisodeFilter sanity, boolean strict) { - patterns = new SeasonEpisodePattern[5]; + patterns = new SeasonEpisodePattern[6]; // match patterns like Season 01 Episode 02, ... patterns[0] = new SeasonEpisodePattern(null, "(? process(MatchResult match) { + List matches = new ArrayList(2); + Scanner epno = new Scanner(match.group(2)).useDelimiter("\\D+"); + while (epno.hasNext()) { + matches.add(new SxE(match.group(1), epno.next())); + } + return matches; + } + }; + + // match patterns 1.02, ..., 10.02, ... + patterns[3] = new SeasonEpisodePattern(sanity, "(? process(MatchResult match) { @@ -58,7 +72,7 @@ public class SeasonEpisodeMatcher { }; // match patterns like ep1, ep.1, ... - patterns[3] = new SeasonEpisodePattern(sanity, "(? process(MatchResult match) { @@ -68,7 +82,7 @@ public class SeasonEpisodeMatcher { }; // match patterns like 01, 102, 1003, 10102 (enclosed in separators) - patterns[4] = new SeasonEpisodePattern(sanity, "(? process(MatchResult match) { @@ -93,7 +107,7 @@ public class SeasonEpisodeMatcher { // only use S00E00 and SxE pattern in strict mode if (strict) { - patterns = new SeasonEpisodePattern[] { patterns[0], patterns[1], patterns[2] }; + patterns = new SeasonEpisodePattern[] { patterns[0], patterns[1], patterns[2], patterns[3] }; } // season folder pattern for complementing partial sxe info from filename