From d88fd57e9f82a1175b66118334d1df8aab521192 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 29 Mar 2016 13:02:49 +0000 Subject: [PATCH] Fine-tune release group matching and cleanup --- source/net/filebot/media/ReleaseInfo.java | 19 ++++++++++++------- test/net/filebot/media/ReleaseInfoTest.java | 11 +++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/source/net/filebot/media/ReleaseInfo.java b/source/net/filebot/media/ReleaseInfo.java index bb7743c4..3dd0f6ae 100644 --- a/source/net/filebot/media/ReleaseInfo.java +++ b/source/net/filebot/media/ReleaseInfo.java @@ -95,19 +95,19 @@ public class ReleaseInfo { return null; } - public String getReleaseGroup(String... strings) throws Exception { + public String getReleaseGroup(String... name) throws Exception { // check file and folder for release group names String[] groups = releaseGroup.get(); // try case-sensitive match - String match = matchLast(getReleaseGroupPattern(true), groups, strings); + String match = matchLast(getReleaseGroupPattern(true), groups, name); if (match != null) { return match; } // try case-insensitive match - return matchLast(getReleaseGroupPattern(false), groups, strings); + return matchLast(getReleaseGroupPattern(false), groups, name); } private Pattern languageTag; @@ -177,8 +177,8 @@ public class ReleaseInfo { Pattern resolution = getResolutionPattern(); Pattern queryBlacklist = getBlacklistPattern(); - stopwords[b] = new Pattern[] { languageTag, videoSource, videoTags, videoFormat, resolution, stereoscopic3d, languageSuffix }; - blacklist[b] = new Pattern[] { releaseGroupTrim, queryBlacklist, languageTag, clutterBracket, releaseGroup, videoSource, videoTags, videoFormat, resolution, stereoscopic3d, languageSuffix }; + stopwords[b] = new Pattern[] { languageSuffix, languageTag, videoSource, videoTags, videoFormat, resolution, stereoscopic3d }; + blacklist[b] = new Pattern[] { languageSuffix, releaseGroupTrim, queryBlacklist, languageTag, clutterBracket, releaseGroup, videoSource, videoTags, videoFormat, resolution, stereoscopic3d }; } return items.stream().map(it -> { @@ -324,8 +324,13 @@ public class ReleaseInfo { } public Pattern getReleaseGroupPattern(boolean strict) throws Exception { - // pattern matching any release group name enclosed in separators - return compile("((?