Fixed: Grab discography during artist search (#208)

Closes #184
This commit is contained in:
Qstick
2018-02-10 05:03:12 +01:00
committed by GitHub
parent c105c9a65e
commit 37d1ed4a48
13 changed files with 249 additions and 43 deletions
@@ -2,8 +2,8 @@ using System;
using NLog;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Common.Extensions;
using System.Linq;
using NzbDrone.Common.Extensions;
namespace NzbDrone.Core.DecisionEngine.Specifications
{
@@ -21,7 +21,18 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public virtual Decision IsSatisfiedBy(RemoteAlbum subject, SearchCriteriaBase searchCriteria)
{
throw new NotImplementedException();
if (subject.ParsedAlbumInfo.Discography)
{
_logger.Debug("Checking if all albums in discography release have released. {0}", subject.Release.Title);
if (subject.Albums.Any(e => !e.ReleaseDate.HasValue || e.ReleaseDate.Value.After(DateTime.UtcNow)))
{
_logger.Debug("Discography release {0} rejected. All albums haven't released yet.", subject.Release.Title);
return Decision.Reject("Discography release rejected. All albums haven't released yet.");
}
}
return Decision.Accept();
}
}
}