From 1495ba19e4898fb6a0c8b9ddfd8e727d77dcbf2e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 10 Mar 2014 06:21:25 +0000 Subject: [PATCH] * fix series index --- BuildData.groovy | 2 +- .../sourceforge/filebot/media/MediaDetection.java | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/BuildData.groovy b/BuildData.groovy index 41e98d3c..66546856 100644 --- a/BuildData.groovy +++ b/BuildData.groovy @@ -223,7 +223,7 @@ tvdb.values().each{ r -> def rating = r[5] def votes = r[6] - if ((votes >= 5 && rating >= 4.0) || (votes >= 2 && rating >= 8.0)) { + if ((votes >= 5 && rating >= 4) || (votes >= 2 && rating >= 8) || (votes >= 1 && rating >= 10)) { getNamePermutations([tvdb_name, imdb_name]).each{ n -> thetvdb_index << [tvdb_id, n] } diff --git a/source/net/sourceforge/filebot/media/MediaDetection.java b/source/net/sourceforge/filebot/media/MediaDetection.java index dee7e789..3835de1d 100644 --- a/source/net/sourceforge/filebot/media/MediaDetection.java +++ b/source/net/sourceforge/filebot/media/MediaDetection.java @@ -321,13 +321,24 @@ public class MediaDetection { Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to match direct mappings: " + e.getMessage(), e); } + // strict series name matcher for recognizing 1x01 patterns + SeriesNameMatcher snm = new SeriesNameMatcher(locale, true); + // cross-reference known series names against file structure try { Set folders = new LinkedHashSet(); Set filenames = new LinkedHashSet(); for (File f : files) { for (int i = 0; i < 3 && f != null && !isStructureRoot(f); i++, f = f.getParentFile()) { - (i == 0 ? filenames : folders).add(normalizeBrackets(getName(f))); + String fn = getName(f); + + // try to minimize noise + String sn = snm.matchByEpisodeIdentifier(fn); + if (sn != null) { + fn = sn; + } + + (i == 0 ? filenames : folders).add(normalizeBrackets(fn)); } } @@ -343,7 +354,6 @@ public class MediaDetection { // use lenient sub sequence matching only as fallback and try name without spacing logic that may mess up any lookup if (matches.isEmpty()) { // try to narrow down file to series name as best as possible - SeriesNameMatcher snm = new SeriesNameMatcher(); List sns = new ArrayList(); sns.addAll(folders); sns.addAll(filenames); @@ -375,7 +385,6 @@ public class MediaDetection { Collection matches = new LinkedHashSet(); // check CWS matches - SeriesNameMatcher snm = new SeriesNameMatcher(locale, true); matches.addAll(snm.matchAll(files.toArray(new File[files.size()]))); // check for known pattern matches