2013-04-07 07:30:37 +00:00
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
|
|
|
using NzbDrone.Core.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";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-07 19:01:24 +00:00
|
|
|
public bool IsSatisfiedBy(IndexerParseResult indexerParseResult, SearchDefinitionBase searchDefinitionBase)
|
2013-04-07 07:30:37 +00:00
|
|
|
{
|
|
|
|
var singleEpisodeSpec = searchDefinitionBase as SeasonSearchDefinition;
|
|
|
|
if (singleEpisodeSpec == null) return true;
|
|
|
|
|
2013-04-07 19:01:24 +00:00
|
|
|
if (singleEpisodeSpec.SeasonNumber != indexerParseResult.SeasonNumber)
|
2013-04-07 07:30:37 +00:00
|
|
|
{
|
|
|
|
_logger.Trace("Season number does not match searched season number, skipping.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|