Implemented parsing case for Artist - Year - Album (#264) (#274)

* Implemented parsing case for Artist - Year - Album

* Enhanced test case to ensure year and artist also parse correctly.
Closes #264
pull/276/head
Joseph Milazzo 7 years ago committed by Qstick
parent 226f884233
commit 798e85e4db

@ -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")]

@ -115,10 +115,17 @@ namespace NzbDrone.Core.Parser
new Regex(@"^(?:(?<artist>.+?)(?:-)+)(?<album>.+?)(?:-.+?)(?<releaseyear>\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(@"^(?:(?<artist>.+?)\s*(?:-)+)\s*(?<releaseyear>\d{4})\s*(?:-+)\s*(?<album>.+)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//Artist-Album Year
//Hyphen no space between artist and album
new Regex(@"^(?:(?<artist>.+?)(?:-)+)(?<album>.+?)\W*(?<releaseyear>\d{4})",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
};
private static readonly Regex[] RejectHashedReleasesRegex = new Regex[]

Loading…
Cancel
Save