From 4ce98d689d7a7c5e33d4c63d78c099db379210fa Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Tue, 6 Apr 2021 11:49:40 -0500 Subject: [PATCH] New: Detect 'FRA' and 'FRE' as French Language Fixes #6136 --- .../ParserTests/LanguageParserFixture.cs | 11 +++++++++++ src/NzbDrone.Core/Parser/LanguageParser.cs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs index 49b0c58e1..9a2bbeafd 100644 --- a/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs @@ -34,6 +34,17 @@ namespace NzbDrone.Core.Test.ParserTests result.Languages.Should().BeEquivalentTo(Language.French); } + [TestCase("Movie 1990 1080p Eng Fra [mkvonly]")] + [TestCase("Movie Directory 25 Anniversary 1990 Eng Fre Multi Subs 720p [H264 mp4]")] + [TestCase("Foreign-Words-Here-Movie-(1990)-[DVDRip]-H264-Fra-Ac3-2-0-Eng-5-1")] + public void should_parse_language_french_english(string postTitle) + { + var result = Parser.Parser.ParseMovieTitle(postTitle, true); + + result.Languages.Should().Contain(Language.French); + result.Languages.Should().Contain(Language.English); + } + [TestCase("Movie.Title.1982.Ger.Eng.AC3.DL.BDRip.x264-iNCEPTiON")] public void should_parse_language_english_german(string postTitle) { diff --git a/src/NzbDrone.Core/Parser/LanguageParser.cs b/src/NzbDrone.Core/Parser/LanguageParser.cs index a70d3c767..04c8d5624 100644 --- a/src/NzbDrone.Core/Parser/LanguageParser.cs +++ b/src/NzbDrone.Core/Parser/LanguageParser.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Parser { private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(LanguageParser)); - private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_|^)(?\b(?:ita|italian)\b)|(?\b(?:german|videomann|ger)\b)|(?flemish)|(?bgaudio)|(?dublado)|(?greek)|(?(?:\W|_)(?:FR|VO|VFF|VFQ|VFI|VF2|TRUEFRENCH)(?:\W|_))|(?\brus\b)|(?\beng\b)|(?\b(?:HUNDUB|HUN)\b)|(?\bHebDub\b)|(?\b(?:PL\W?DUB|DUB\W?PL|LEK\W?PL|PL\W?LEK)\b)|(?\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕)", + private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_|^)(?\b(?:ita|italian)\b)|(?\b(?:german|videomann|ger)\b)|(?flemish)|(?bgaudio)|(?dublado)|(?greek)|(?(?:\W|_)(?:FR|VO|VFF|VFQ|VFI|VF2|TRUEFRENCH|FRE|FRA)(?:\W|_))|(?\brus\b)|(?\beng\b)|(?\b(?:HUNDUB|HUN)\b)|(?\bHebDub\b)|(?\b(?:PL\W?DUB|DUB\W?PL|LEK\W?PL|PL\W?LEK)\b)|(?\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕)", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?:(?i)(?\bLT\b)|(?\bCZ\b)|(?\bPL\b))(?:(?i)(?![\W|_|^]SUB))",