You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
33 lines
1.0 KiB
using NLog;
|
|
using NzbDrone.Core.Blacklisting;
|
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
{
|
|
public class BlacklistSpecification : IDecisionEngineSpecification
|
|
{
|
|
private readonly IBlacklistService _blacklistService;
|
|
private readonly Logger _logger;
|
|
|
|
public BlacklistSpecification(IBlacklistService blacklistService, Logger logger)
|
|
{
|
|
_blacklistService = blacklistService;
|
|
_logger = logger;
|
|
}
|
|
|
|
public RejectionType Type => RejectionType.Permanent;
|
|
|
|
public Decision IsSatisfiedBy(RemoteAlbum subject, SearchCriteriaBase searchCriteria)
|
|
{
|
|
if (_blacklistService.Blacklisted(subject.Artist.Id, subject.Release))
|
|
{
|
|
_logger.Debug("{0} is blacklisted, rejecting.", subject.Release.Title);
|
|
return Decision.Reject("Release is blacklisted");
|
|
}
|
|
|
|
return Decision.Accept();
|
|
}
|
|
}
|
|
}
|