diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 7392d6757..70ecc4b21 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -7,6 +7,7 @@ using NzbDrone.Core.Music; using NzbDrone.Core.Parser; using NzbDrone.Core.Qualities; using NzbDrone.Core.Test.Framework; +using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.Test.ParserTests { @@ -66,6 +67,16 @@ namespace NzbDrone.Core.Test.ParserTests Parser.Parser.ParseAlbumTitle(title).Quality.QualitySource.Should().Be(QualitySource.Extension); } + [TestCase("of Montreal-Hissing Fauna, Are You The Destroyer? 2007", "Hissing Fauna, Are You The Destroyer", "of Montreal", "2007")] + [TestCase("of Montreal - 2007 - Hissing Fauna, Are You The Destroyer?", "Hissing Fauna, Are You The Destroyer", "of Montreal", "2007")] + public void should_parse_album(string title, string correctAlbum, string correctArtist, string correctYear) + { + ParsedAlbumInfo result = Parser.Parser.ParseAlbumTitle(title); + result.AlbumTitle.Should().Be(correctAlbum); + result.ArtistName.Should().Be(correctArtist); + result.ReleaseDate.Should().Be(correctYear); + } + [TestCase("VA - The Best 101 Love Ballads (2017) MP3 [192 kbps]", "VA", "The Best 101 Love Ballads")] [TestCase("ATCQ - The Love Movement 1998 2CD 192kbps RIP", "ATCQ", "The Love Movement")] //[TestCase("A Tribe Called Quest - The Love Movement 1998 2CD [192kbps] RIP", "A Tribe Called Quest", "The Love Movement")] diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index e60ddf216..f4d3e02e9 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -115,10 +115,17 @@ 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(@"^(?:(?.+?)(?:-)+)(?.+?)\W*(?\d{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled), + + }; private static readonly Regex[] RejectHashedReleasesRegex = new Regex[]