diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 206761269..a22f1b562 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -161,6 +161,9 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Minor Threat - Complete Discography [1989] [Anthology]", "Minor Threat", "Discography", true)] [TestCase("Captain-Discography_1998_-_2001-CD-FLAC-2007-UTP", "Captain", "Discography", true)] [TestCase("Coolio - Gangsta's Paradise (1995) (FLAC Lossless)", "Coolio", "Gangsta's Paradise")] + [TestCase("Brother Ali-2007-The Undisputed Truth-FTD", "Brother Ali", "The Undisputed Truth")] + [TestCase("Brother Ali-The Undisputed Truth-2007-FTD", "Brother Ali", "The Undisputed Truth")] + // ruTracker [TestCase("(Eclectic Progressive Rock) [CD] Peter Hammill - From The Trees - 2017, FLAC (tracks + .cue), lossless", "Peter Hammill","From The Trees")] [TestCase("(Folk Rock / Pop) Aztec Two-Step - Naked - 2017, MP3, 320 kbps", "Aztec Two-Step", "Naked")] @@ -172,6 +175,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("(Heavy Metal) Aria - Discography(46 CD) [1985 - 2015], FLAC(image + .cue), lossless", "Aria", "Discography", true)] [TestCase("(Heavy Metal) [CD] Forces United - Discography(6 CDs), 2014-2016, FLAC(image + .cue), lossless", "Forces United", "Discography", true)] [TestCase("Gorillaz - The now now - 2018 [FLAC]", "Gorillaz", "The now now")] + //Regex Works on below, but ParseAlbumMatchCollection cleans the "..." and converts it to spaces [TestCase("Metallica - ...And Justice for All (1988) [FLAC Lossless]", "Metallica", "...And Justice for All")] public void should_parse_artist_name_and_album_title(string postTitle, string name, string title, bool discography = false) diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 49fd8cb18..ef242e2b1 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -119,16 +119,15 @@ namespace NzbDrone.Core.Parser new Regex(@"^(?:(?.+?)(?:-)+)(?.+?)(?:-.+?)(?\d{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Artist - Year - Album - // Hypen with no or more spaces between artist/album/year (must be before Artist-Album Year as that catches this case) - new Regex(@"^(?:(?.+?)\s*(?:-)+)\s*(?\d{4})\s*(?:-+)\s*(?.+)", - RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Artist-Album Year //Hyphen no space between artist and album - new Regex(@"^(?:(?.+?)(?:-)+)(?.+?)\b(?\d{4})", + new Regex(@"^(?:(?.+?)(?:-)+)(?:(?.+?)(?:-)+)(?\d{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled), + //Artist - Year - Album + // Hypen with no or more spaces between artist/album/year + new Regex(@"^(?:(?.+?)(?:-))(?\d{4})(?:-)(?[^-]+)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), };