From 90a4838958c7a664811719302ae9a9c98908888b Mon Sep 17 00:00:00 2001 From: Qstick Date: Fri, 6 Oct 2017 22:52:32 -0400 Subject: [PATCH] Tweak Release Parsing, Add Less strict Regex Cases for Title --- .../DecisionEngine/DownloadDecisionMaker.cs | 10 ++++++++++ .../Indexers/Newznab/NewznabRequestGenerator.cs | 6 +++--- src/NzbDrone.Core/Parser/Parser.cs | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs index e5c1f573e..c52302b28 100644 --- a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs +++ b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs @@ -62,6 +62,16 @@ namespace NzbDrone.Core.DecisionEngine { var parsedAlbumInfo = Parser.Parser.ParseAlbumTitle(report.Title); + if (!report.Artist.IsNullOrWhiteSpace()) + { + parsedAlbumInfo.ArtistName = report.Artist; + } + + if (!report.Album.IsNullOrWhiteSpace()) + { + parsedAlbumInfo.AlbumTitle = report.Album; + } + if (parsedAlbumInfo != null && !parsedAlbumInfo.ArtistName.IsNullOrWhiteSpace()) { var remoteAlbum = _parsingService.Map(parsedAlbumInfo, searchCriteria); diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs index 5d98a4d75..efc6990e0 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabRequestGenerator.cs @@ -71,8 +71,8 @@ namespace NzbDrone.Core.Indexers.Newznab { AddAudioPageableRequests(pageableRequests, searchCriteria, string.Format("&artist={0}&album={1}", - searchCriteria.Artist.Name, - searchCriteria.AlbumTitle)); + NewsnabifyTitle(searchCriteria.Artist.Name), + NewsnabifyTitle(searchCriteria.AlbumTitle))); } if (SupportsSearch) @@ -100,7 +100,7 @@ namespace NzbDrone.Core.Indexers.Newznab { AddAudioPageableRequests(pageableRequests, searchCriteria, string.Format("&artist={0}", - searchCriteria.Artist.Name)); + NewsnabifyTitle(searchCriteria.Artist.Name))); } if (SupportsSearch) diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 8d194a9fb..66515e504 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -61,6 +61,22 @@ namespace NzbDrone.Core.Parser //Artist Discography new Regex(@"^(?.+?)\W*(?Discograghy|Discografia).+(?\d{4}).+(?\d{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled), + + //Artist - Album (Year) Strict + new Regex(@"^(?:(?.+?)(?:-)+)(?.+?)\W*(?:\(|\[).+?(?\d{4})", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + + //Artist - Album (Year) + new Regex(@"^(?:(?.+?)(?:-)+)(?.+?)\W*(?:\(|\[)(?\d{4})", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + + //Artist - Album + new Regex(@"^(?:(?.+?)(?:-)+)(?.+?)\W*(?:\(|\[)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + + //Artist - Album Year + new Regex(@"^(?:(?.+?)(?:-)+)(?.+?)\W*(\d{4}|\d{3})", + RegexOptions.IgnoreCase | RegexOptions.Compiled), }; private static readonly Regex[] ReportTitleRegex = new[]