1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-25 22:46:31 -04:00
Files
Sonarr/src/NzbDrone.Core/DecisionEngine/Specifications/Search/SeriesSpecification.cs
T

39 lines
1.2 KiB
C#

using NLog;
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, ReleaseDecisionInformation information)
{
var searchCriteria = information.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();
}
}
}