From 0531204e88304a28ff74054946db790c6f4a9d8a Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 30 Jan 2019 00:03:59 +0700 Subject: [PATCH] Fix various AutoDetection issues --- source/net/filebot/media/AutoDetection.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source/net/filebot/media/AutoDetection.java b/source/net/filebot/media/AutoDetection.java index 96e85142..85d19f7e 100644 --- a/source/net/filebot/media/AutoDetection.java +++ b/source/net/filebot/media/AutoDetection.java @@ -79,7 +79,7 @@ public class AutoDetection { private static final Pattern SERIES_PATTERN = Pattern.compile("TV.Shows|TV.Series|Season.[0-9]+", CASE_INSENSITIVE); private static final Pattern ANIME_PATTERN = Pattern.compile("Anime", CASE_INSENSITIVE); - private static final Pattern EPISODE_PATTERN = Pattern.compile("E[P]?\\d{1,3}", CASE_INSENSITIVE); + private static final Pattern ABSOLUTE_EPISODE_PATTERN = Pattern.compile("(? { - return parseEpisodeNumber(after(it, YEAR).orElse(""), false) == null; + return find(mn, snm) && Stream.of(dn, fn).anyMatch(it -> { + return after(it, YEAR).map(ay -> { + return parseEpisodeNumber(ay, false) == null; + }).orElse(false); }); } @@ -320,7 +322,7 @@ public class AutoDetection { public boolean episodeNumbers() throws Exception { String n = stripReleaseInfo(asn, false); if (parseEpisodeNumber(n, false) != null || NUMBER_PAIR.matcher(n).find()) { - return Stream.of(dn, fn).anyMatch(it -> snm.matcher(it).find()) && getMovieMatches(f, true).isEmpty(); + return Stream.of(dn, fn).anyMatch(it -> snm.matcher(it).find()) && matchMovieName(singleton(fn), true, 0).isEmpty(); } return false; } @@ -381,6 +383,11 @@ public class AutoDetection { public boolean test() throws Exception { return t.test(); } + + @Override + public String toString() { + return String.format("[%d, %d]", s, m); + } } public enum Type {