From 4aff8bb01e1900be656c1d74d42e10236bdcae84 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 30 Mar 2016 21:42:56 +0000 Subject: [PATCH] Added test cases --- source/net/filebot/media/ReleaseInfo.java | 22 ++++++++++----------- test/net/filebot/media/ReleaseInfoTest.java | 8 ++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/source/net/filebot/media/ReleaseInfo.java b/source/net/filebot/media/ReleaseInfo.java index 3dd0f6ae..dddf3212 100644 --- a/source/net/filebot/media/ReleaseInfo.java +++ b/source/net/filebot/media/ReleaseInfo.java @@ -148,7 +148,7 @@ public class ReleaseInfo { // prefer standard value over matched value if (lastMatch != null && paragon != null) { for (String it : paragon) { - lastMatch = compile("(? languages, boolean strict) { // [en] if (strict) { - return compile("(?<=[-\\[\\{\\(])" + or(quoteAll(languages)) + "(?=[-\\]\\}\\)]|$)", CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS); + return compile("(?<=[-\\[\\{\\(])" + or(quoteAll(languages)) + "(?=[-\\]\\}\\)]|$)", CASE_INSENSITIVE); } // FR @@ -273,12 +273,12 @@ public class ReleaseInfo { public Pattern getSubtitleCategoryTagPattern(Collection languages) { // e.g. ".en.srt" or ".en.forced.srt" - return compile("(?<=[._-](" + or(quoteAll(languages)) + ")[._-])" + or(getSubtitleCategoryTags()) + "$", CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS); + return compile("(?<=[._-](" + or(quoteAll(languages)) + ")[._-])" + or(getSubtitleCategoryTags()) + "$", CASE_INSENSITIVE); } public Pattern getSubtitleLanguageTagPattern(Collection languages) { // e.g. ".en.srt" or ".en.forced.srt" - return compile("(?<=[._-])" + or(quoteAll(languages)) + "(?=([._-]" + or(getSubtitleCategoryTags()) + ")?$)", CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS); + return compile("(?<=[._-])" + or(quoteAll(languages)) + "(?=([._-]" + or(getSubtitleCategoryTags()) + ")?$)", CASE_INSENSITIVE); } public Pattern getResolutionPattern() { @@ -330,26 +330,26 @@ public class ReleaseInfo { // group pattern at beginning or ending of the string String[] groupHeadTail = { "(?<=^[^\\p{Alnum}]*)" + group, group + "(?=[\\p{Alpha}\\p{Punct}]*$)" }; - return compile(or(groupHeadTail), strict ? 0 : CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS); + return compile(or(groupHeadTail), strict ? 0 : CASE_INSENSITIVE); } public Pattern getReleaseGroupTrimPattern() throws Exception { // pattern matching any release group name enclosed in specific separators or at the start/end - return compile("(?<=\\[|\\(|^)" + or(releaseGroup.get()) + "(?=\\]|\\)|\\-)|(?<=\\[|\\(|\\-)" + or(releaseGroup.get()) + "(?=\\]|\\)|$)", CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS); + return compile("(?<=\\[|\\(|^)" + or(releaseGroup.get()) + "(?=\\]|\\)|\\-)|(?<=\\[|\\(|\\-)" + or(releaseGroup.get()) + "(?=\\]|\\)|$)", CASE_INSENSITIVE); } public Pattern getBlacklistPattern() throws Exception { // pattern matching any release group name enclosed in separators - return compile("(? terms) throws IOException { - return compile("(? getSeriesMappings() throws Exception { @@ -414,7 +414,7 @@ public class ReleaseInfo { protected final Resource> seriesMappings = resource("url.series-mappings", Cache.ONE_WEEK, Function.identity(), String[]::new).transform(lines -> { Map map = new LinkedHashMap(lines.length); stream(lines).map(s -> s.split("\t", 2)).filter(v -> v.length == 2).forEach(v -> { - Pattern pattern = compile("(?