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.
40 lines
1.1 KiB
40 lines
1.1 KiB
using NLog;
|
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
|
using NzbDrone.Core.Model;
|
|
using NzbDrone.Core.Parser;
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
|
{
|
|
public class SeasonMatchSpecification : IDecisionEngineSearchSpecification
|
|
{
|
|
private readonly Logger _logger;
|
|
|
|
public SeasonMatchSpecification(Logger logger)
|
|
{
|
|
_logger = logger;
|
|
}
|
|
|
|
public string RejectionReason
|
|
{
|
|
get
|
|
{
|
|
return "Episode doesn't match";
|
|
}
|
|
}
|
|
|
|
public bool IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchDefinitionBase searchDefinitionBase)
|
|
{
|
|
var singleEpisodeSpec = searchDefinitionBase as SeasonSearchDefinition;
|
|
if (singleEpisodeSpec == null) return true;
|
|
|
|
if (singleEpisodeSpec.SeasonNumber != remoteEpisode.SeasonNumber)
|
|
{
|
|
_logger.Trace("Season number does not match searched season number, skipping.");
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
} |