mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-25 22:36:59 -04:00
Blacklist is now used when processing results
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System.Linq;
|
||||
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 string RejectionReason
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Release is blacklisted";
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria)
|
||||
{
|
||||
if (_blacklistService.Blacklisted(subject.Release.Title))
|
||||
{
|
||||
_logger.Trace("Release is blacklisted");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-1
@@ -1,4 +1,6 @@
|
||||
using NLog;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
@@ -9,12 +11,17 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
{
|
||||
private readonly IHistoryService _historyService;
|
||||
private readonly QualityUpgradableSpecification _qualityUpgradableSpecification;
|
||||
private readonly IProvideDownloadClient _downloadClientProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public UpgradeHistorySpecification(IHistoryService historyService, QualityUpgradableSpecification qualityUpgradableSpecification, Logger logger)
|
||||
public UpgradeHistorySpecification(IHistoryService historyService,
|
||||
QualityUpgradableSpecification qualityUpgradableSpecification,
|
||||
IProvideDownloadClient downloadClientProvider,
|
||||
Logger logger)
|
||||
{
|
||||
_historyService = historyService;
|
||||
_qualityUpgradableSpecification = qualityUpgradableSpecification;
|
||||
_downloadClientProvider = downloadClientProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -34,6 +41,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_downloadClientProvider.GetDownloadClient().GetType() == typeof (SabnzbdClient))
|
||||
{
|
||||
_logger.Trace("Skipping history check in favour of blacklist");
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var episode in subject.Episodes)
|
||||
{
|
||||
var bestQualityInHistory = _historyService.GetBestQualityInHistory(episode.Id);
|
||||
|
||||
Reference in New Issue
Block a user