* added some extra sanity to series name detection

This commit is contained in:
Reinhard Pointner 2013-02-05 16:24:22 +00:00
parent a2e36c5173
commit 1c8e1972b6
1 changed files with 18 additions and 5 deletions

View File

@ -297,12 +297,13 @@ public class MediaDetection {
}
// use lenient sub sequence matching only as fallback
if (matches.size() > 0) {
names.addAll(matches);
} else {
names.addAll(matchSeriesByName(folders, 3));
names.addAll(matchSeriesByName(filenames, 3));
if (matches.isEmpty()) {
matches.addAll(matchSeriesByName(folders, 3));
matches.addAll(matchSeriesByName(filenames, 3));
}
// pass along only valid terms
names.addAll(stripBlacklistedTerms(matches));
} catch (Exception e) {
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.WARNING, "Failed to match folder structure: " + e.getMessage(), e);
}
@ -692,6 +693,18 @@ public class MediaDetection {
}
public static List<String> stripBlacklistedTerms(Collection<String> names) throws IOException {
Pattern blacklist = releaseInfo.getBlacklistPattern();
List<String> acceptables = new ArrayList<String>(names.size());
for (String it : names) {
if (blacklist.matcher(it).replaceAll("").trim().length() > 0) {
acceptables.add(it);
}
}
return acceptables;
}
public static Set<Integer> grepImdbIdFor(File file) throws Exception {
Set<Integer> collection = new LinkedHashSet<Integer>();
List<File> nfoFiles = new ArrayList<File>();