From e632dea99a088f3f3ad41cbfbe69cbf5d00b4369 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Fri, 30 Jul 2021 08:06:31 -0500 Subject: [PATCH] Fixed: Incorrectly Parsing [PublicHD] as Release Group - Fixed: Incorrectly Parsing [PublicHD] as Release Group - Corrected: Parser Test Naming - Cleanse Torrent Suffix prior to determining the Group --- .../ParserTests/ReleaseGroupParserFixture.cs | 13 +++++-------- src/NzbDrone.Core/Parser/Parser.cs | 3 ++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs index ca9860c5f..3b10bdcd4 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs @@ -47,11 +47,9 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("SomeMovie.1080p.BluRay.DTS.x264.-VH-PROD.mkv", "VH-PROD")] [TestCase("Some.Dead.Movie.2006.1080p.BluRay.DTS.x264.D-Z0N3", "D-Z0N3")] [TestCase("Movie.Title.2010.720p.BluRay.x264.-[YTS.LT]", "YTS.LT")] + [TestCase("The.Movie.Title.2013.720p.BluRay.x264-ROUGH [PublicHD]", "ROUGH")] - //[TestCase("", "")] - - //Exception Cases - public void should_parse_exception_release_group(string title, string expected) + public void should_parse_expected_release_group(string title, string expected) { Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); } @@ -83,7 +81,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Movie Name - A History of Movie (2017) (1080p AMZN WEB-DL x265 HEVC 10bit EAC3 2.0 t3nzin)", "t3nzin")] [TestCase("Movie Name (2019) (1080p BluRay x265 HEVC 10bit AAC 7.1 Vyndros)", "Vyndros")] - public void should_parse_release_group(string title, string expected) + public void should_parse_exception_release_group(string title, string expected) { Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); } @@ -92,7 +90,6 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Some.Movie.S02E04.720p.WEBRip.x264-SKGTV_English", "SKGTV")] [TestCase("Some.Movie.S02E04.720p.WEBRip.x264-SKGTV.English", "SKGTV")] - //[TestCase("", "")] public void should_not_include_language_in_release_group(string title, string expected) { Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); @@ -121,7 +118,8 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Some.Movie.2019.1080p.BDRip.X264.AC3-EVO-4P", "EVO")] [TestCase("Some.Movie.2019.1080p.BDRip.X264.AC3-EVO-4Planet", "EVO")] [TestCase("Some.Movie.2019.1080p.BDRip.X264.AC3-DON-AlteZachen", "DON")] - public void should_not_include_repost_in_release_group(string title, string expected) + + public void should_not_include_bad_suffix_in_release_group(string title, string expected) { Parser.Parser.ParseReleaseGroup(title).Should().Be(expected); } @@ -132,7 +130,6 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("[Anime-Koi] Movies - S01E07 - A High-Grade Movies", "Anime-Koi")] [TestCase("[Anime-Koi] Kami-sama Movies 2 - 01 [h264-720p][28D54E2C]", "Anime-Koi")] - //[TestCase("", "")] public void should_parse_anime_release_groups(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 11d22b9be..0ff42406d 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -109,7 +109,7 @@ namespace NzbDrone.Core.Parser string.Empty, RegexOptions.IgnoreCase | RegexOptions.Compiled); - private static readonly RegexReplace CleanTorrentSuffixRegex = new RegexReplace(@"\[(?:ettv|rartv|rarbg|cttv)\]$", + private static readonly RegexReplace CleanTorrentSuffixRegex = new RegexReplace(@"\[(?:ettv|rartv|rarbg|cttv|publichd)\]$", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Compiled); @@ -445,6 +445,7 @@ namespace NzbDrone.Core.Parser title = title.Trim(); title = RemoveFileExtension(title); title = WebsitePrefixRegex.Replace(title); + title = CleanTorrentSuffixRegex.Replace(title); var animeMatch = AnimeReleaseGroupRegex.Match(title);