diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index 2386c508..033ed438 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -401,7 +401,7 @@ public class MediaDetection { for (File path : listPathTail(f, 2, true)) { String fn = getName(path); // ignore non-strict series name parsing if there are movie year patterns - if (!strict && parseMovieYear(fn).size() > 0) { + if (!strict && parseMovieYear(fn).equals(parseNumbers(fn))) { break; } String sn = seriesNameMatcher.matchByEpisodeIdentifier(fn); @@ -775,6 +775,17 @@ public class MediaDetection { return years; } + public static List parseNumbers(String name) { + List numbers = new ArrayList(); + for (String it : name.split("\\D+")) { + if (it.length() > 0) { + int n = Integer.parseInt(it); + numbers.add(n); + } + } + return numbers; + } + public static String reduceMovieName(String name, boolean strict) throws IOException { Matcher matcher = compile(strict ? "^(.+)[\\[\\(]((?:19|20)\\d{2})[\\]\\)]" : "^(.+?)((?:19|20)\\d{2})").matcher(name); if (matcher.find()) {