From 56e1f53834e5ab9a9600cc4fc3efb3bd6a10ffec Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 16 Sep 2018 22:10:25 -0400 Subject: [PATCH] Fixed: Allow text in front of cleaned Album/Track tag (#498) * Fixed: Allow text in front of cleaned tag * fixup! Add another test case that shouldnt be matched. --- src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs | 3 +++ src/NzbDrone.Core/Parser/Parser.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 75f42f307..206761269 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -53,10 +53,13 @@ namespace NzbDrone.Core.Test.ParserTests } [TestCase("Songs of Experience (Deluxe Edition)", "Songs of Experience")] + [TestCase("Songs of Experience (iTunes Deluxe Edition)", "Songs of Experience")] + [TestCase("Songs of Experience [Super Special Edition]", "Songs of Experience")] [TestCase("Mr. Bad Guy [Special Edition]", "Mr. Bad Guy")] [TestCase("Sweet Dreams (Album)", "Sweet Dreams")] [TestCase("Now What?! (Limited Edition)", "Now What?!")] [TestCase("Random Album Title (Promo CD)", "Random Album Title")] + [TestCase("Limited Edition", "Limited Edition")] public void should_remove_common_tags_from_album_title(string title, string correct) { var result = Parser.Parser.CleanAlbumTitle(title); diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 05cbee3da..a349a3036 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -207,7 +207,7 @@ namespace NzbDrone.Core.Parser private static readonly Regex[] CommonTagRegex = new Regex[] { new Regex(@"(\[|\()*\b((featuring|feat.|feat|ft|ft.)\s{1}){1}\s*.*(\]|\))*", RegexOptions.IgnoreCase | RegexOptions.Compiled), - new Regex(@"(\[|\(){1}(version|limited|deluxe|single|clean|album|special|bonus|promo)+\s*.*(\]|\)){1}", RegexOptions.IgnoreCase | RegexOptions.Compiled), + new Regex(@"(?:\(|\[)(?:[^\(\[]*)(?:version|limited|deluxe|single|clean|album|special|bonus|promo)(?:[^\)\]]*)(?:\)|\])", RegexOptions.IgnoreCase | RegexOptions.Compiled) }; public static ParsedTrackInfo ParseMusicPath(string path)