From c67718d81e92e705e84fd6919c3a91c13cbe72bd Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Wed, 11 Aug 2021 19:25:39 -0500 Subject: [PATCH] New: Correctly Parse Groups D-Z0N3 and Fight-BB New: Parse Select Groups that do not follow -Group Format Fixes #4623 - formatting --- .../ParserTests/ReleaseGroupParserFixture.cs | 22 ++++++++++--- src/NzbDrone.Core/Parser/Parser.cs | 31 ++++++++++++++++--- 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs index 5b4d88646..c399b400b 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs @@ -33,18 +33,30 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Series.Title.S01E05.The-Aniversary.HDTV-1080p.mkv", null)] [TestCase("Series US (2010) S04 (1080p BDRip x265 10bit DTS-HD MA 5 1 - WEM)[TAoE]", null)] [TestCase("The.Series.S03E04.2160p.Amazon.WEBRip.DTS-HD.MA.5.1.x264", null)] - [TestCase("SomeShow.S20E13.1080p.BluRay.DTS-X.MA.5.1.x264",null)] - [TestCase("SomeShow.S20E13.1080p.BluRay.DTS-MA.5.1.x264",null)] - [TestCase("SomeShow.S20E13.1080p.BluRay.DTS-ES.5.1.x264",null)] - [TestCase("SomeShow.S20E13.1080p.Blu-Ray.DTS-ES.5.1.x264",null)] + [TestCase("SomeShow.S20E13.1080p.BluRay.DTS-X.MA.5.1.x264", null)] + [TestCase("SomeShow.S20E13.1080p.BluRay.DTS-MA.5.1.x264", null)] + [TestCase("SomeShow.S20E13.1080p.BluRay.DTS-ES.5.1.x264", null)] + [TestCase("SomeShow.S20E13.1080p.Blu-Ray.DTS-ES.5.1.x264", null)] [TestCase("SomeShow.S20E13.1080p.Blu-Ray.DTS-ES.5.1.x264-ROUGH [PublicHD]", "ROUGH")] [TestCase("SomeShow S01E168 1080p WEB-DL AAC 2.0 x264-Erai-raws", "Erai-raws")] + [TestCase("The.Good.Series.S05E03.Series.of.Intelligence.1080p.10bit.AMZN.WEB-DL.DDP5.1.HEVC-Vyndros", "Vyndros")] //[TestCase("", "")] public void should_parse_release_group(string title, string expected) { Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); } + [TestCase("Show.Name.2009.S01.1080p.BluRay.DTS5.1.x264-D-Z0N3", "D-Z0N3")] + [TestCase("Show.Name.S01E01.1080p.WEB-DL.H264.Fight-BB.mkv", "Fight-BB")] + [TestCase("The Show S08E09 The Series.1080p.AMZN.WEB-DL.x265.10bit.EAC3.6.0-Qman[UTR]", "UTR")] + [TestCase("The Show S03E07 Fire and Series[1080p x265 10bit S87 Joy]", "Joy")] + [TestCase("The Show (2016) - S02E01 - Soul Series #1 (1080p NF WEBRip x265 ImE)", "ImE")] + [TestCase("The Show (2020) - S02E03 - Fighting His Series(1080p ATVP WEB-DL x265 t3nzin)", "t3nzin")] + public void should_parse_exception_release_group(string title, string expected) + { + Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); + } + [Test] public void should_not_include_extension_in_release_group() { @@ -87,7 +99,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("The.Series.Title.S08E08.1080p.BluRay.x264-ROVERS-4P", "ROVERS")] [TestCase("Series.Title.S01E02.720p.BluRay.X264-REWARD-4Planet", "REWARD")] [TestCase("Series.S01E01.Rites.of.Passage.1080p.BluRay.x264-DON-AlteZachen", "DON")] - [TestCase("Series.Title.S04E06.Episode.Name.720p.WEB-DL.DD5.1.H.264-HarrHD-RePACKPOST","HarrHD")] + [TestCase("Series.Title.S04E06.Episode.Name.720p.WEB-DL.DD5.1.H.264-HarrHD-RePACKPOST", "HarrHD")] public void should_not_include_repost_in_release_group(string title, string expected) { Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index f24425183..51340483d 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -452,6 +452,13 @@ namespace NzbDrone.Core.Parser private static readonly Regex AnimeReleaseGroupRegex = new Regex(@"^(?:\[(?(?!\s).+?(?(?:D\-Z0N3|Fight-BB)\b)", RegexOptions.IgnoreCase | RegexOptions.Compiled); + + //groups whose releases end with RlsGroup) or RlsGroup] + private static readonly Regex ExceptionReleaseGroupRegex = new Regex(@"(?(Tigole|Joy|ImE|UTR|t3nzin)(?=\]|\)))", RegexOptions.IgnoreCase | RegexOptions.Compiled); + private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?\b(?:ita|italian)\b)|(?german\b|videomann)|(?flemish)|(?greek)|(?(?:\W|_)(?:FR|VOSTFR)(?:\W|_))|(?\brus\b)|(?nl\W?subs?)|(?\b(?:HUNDUB|HUN)\b)|(?\b(?:espaƱol|castellano)\b)", RegexOptions.IgnoreCase | RegexOptions.Compiled); @@ -723,6 +730,20 @@ namespace NzbDrone.Core.Parser title = CleanReleaseGroupRegex.Replace(title); + var exceptionReleaseGroupRegex = ExceptionReleaseGroupRegex.Matches(title); + + if (exceptionReleaseGroupRegex.Count != 0) + { + return exceptionReleaseGroupRegex.OfType().Last().Groups["releasegroup"].Value; + } + + var exceptionExactMatch = ExceptionReleaseGroupRegexExact.Matches(title); + + if (exceptionExactMatch.Count != 0) + { + return exceptionExactMatch.OfType().Last().Groups["releasegroup"].Value; + } + var matches = ReleaseGroupRegex.Matches(title); if (matches.Count != 0) @@ -803,11 +824,11 @@ namespace NzbDrone.Core.Parser if (airYear < 1900) { result = new ParsedEpisodeInfo - { - ReleaseTitle = releaseTitle, - EpisodeNumbers = new int[0], - AbsoluteEpisodeNumbers = new int[0] - }; + { + ReleaseTitle = releaseTitle, + EpisodeNumbers = new int[0], + AbsoluteEpisodeNumbers = new int[0] + }; foreach (Match matchGroup in matchCollection) {