mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-20 21:54:58 -04:00
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using NLog;
|
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
|
{
|
|
public class SeriesSpecification : IDownloadDecisionEngineSpecification
|
|
{
|
|
private readonly Logger _logger;
|
|
|
|
public SeriesSpecification(Logger logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public SpecificationPriority Priority => SpecificationPriority.Default;
|
|
public RejectionType Type => RejectionType.Permanent;
|
|
|
|
public DownloadSpecDecision IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria)
|
|
{
|
|
if (searchCriteria == null)
|
|
{
|
|
return DownloadSpecDecision.Accept();
|
|
}
|
|
|
|
_logger.Debug("Checking if series matches searched series");
|
|
|
|
if (remoteEpisode.Series.Id != searchCriteria.Series.Id)
|
|
{
|
|
_logger.Debug("Series {0} does not match {1}", remoteEpisode.Series, searchCriteria.Series);
|
|
return DownloadSpecDecision.Reject(DownloadRejectionReason.WrongSeries, "Wrong series");
|
|
}
|
|
|
|
return DownloadSpecDecision.Accept();
|
|
}
|
|
}
|
|
}
|