From ea801665e4f3b7c505e2c2f37a4ef941a15e2c2d Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Tue, 22 Dec 2020 12:16:02 -0600 Subject: [PATCH] Fixed: Correctly Parse Release Groups with a `-` in their name [common] --- src/NzbDrone.Core.Test/ParserTests/HashedReleaseFixture.cs | 7 +++++++ .../ParserTests/ReleaseGroupParserFixture.cs | 5 +++++ src/NzbDrone.Core/Parser/Parser.cs | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/HashedReleaseFixture.cs b/src/NzbDrone.Core.Test/ParserTests/HashedReleaseFixture.cs index 52ebfae0d..db05eb7cb 100644 --- a/src/NzbDrone.Core.Test/ParserTests/HashedReleaseFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/HashedReleaseFixture.cs @@ -37,6 +37,13 @@ namespace NzbDrone.Core.Test.ParserTests @"C:\Test\Deadwood.2018.1080p.BluRay.x264-RADARR\Backup_72023S02-12.mkv".AsOsAgnostic(), "Deadwood", Quality.Bluray1080p, + "RADARR" + }, + new object[] + { + @"C:\Test\Deadwood.2018.1080p.BluRay.x264\Backup_72023S02-12.mkv".AsOsAgnostic(), + "Deadwood", + Quality.Bluray1080p, null }, new object[] diff --git a/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs index 0677d4b46..07c0c78ac 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ReleaseGroupParserFixture.cs @@ -41,6 +41,11 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Kai.Po.Che.2013.1080p.BluRay.REMUX.AVC.DTS-X.MA.5.1", null)] [TestCase("Kai.Po.Che.2013.1080p.BluRay.REMUX.AVC.DTS-MA.5.1", null)] [TestCase("Kai.Po.Che.2013.1080p.BluRay.REMUX.AVC.DTS-ES.MA.5.1", null)] + [TestCase("SomeMovie.1080p.BluRay.DTS-X.264.-D-Z0N3.mkv", "D-Z0N3")] + [TestCase("SomeMovie.1080p.BluRay.DTS.x264.-Blu-bits.mkv", "Blu-bits")] + [TestCase("SomeMovie.1080p.BluRay.DTS.x264.-DX-TV.mkv", "DX-TV")] + [TestCase("SomeMovie.1080p.BluRay.DTS.x264.-FTW-HS.mkv", "FTW-HS")] + [TestCase("SomeMovie.1080p.BluRay.DTS.x264.-VH-PROD.mkv", "VH-PROD")] //[TestCase("", "")] public void should_parse_release_group(string title, string expected) diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index b04d8fa0a..aa5a90ee1 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -116,7 +116,7 @@ namespace NzbDrone.Core.Parser private static readonly Regex CleanQualityBracketsRegex = new Regex(@"\[[a-z0-9 ._-]+\]$", RegexOptions.IgnoreCase | RegexOptions.Compiled); - private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?[a-z0-9]+(?!.+?(?:480p|720p|1080p|2160p)))(?[a-z0-9]+)\]$", + private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?[a-z0-9]+(?-[a-z0-9]+)?(?!.+?(?:480p|720p|1080p|2160p)))(?)?)(?:\b|[-._ ]|$)|[-._ ]\[(?[a-z0-9]+)\]$", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex AnimeReleaseGroupRegex = new Regex(@"^(?:\[(?(?!\s).+?(?