1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-23 02:05:27 +02:00
Sonarr/NzbDrone.Core/DecisionEngine/Specifications/Search/SeasonMatchSpecification.cs

43 lines
1.1 KiB
C#
Raw Normal View History

2013-04-07 10:30:37 +03:00
using NLog;
using NzbDrone.Core.IndexerSearch.Definitions;
using NzbDrone.Core.Parser.Model;
2013-04-07 10:30:37 +03:00
namespace NzbDrone.Core.DecisionEngine.Specifications.Search
{
public class SeasonMatchSpecification : IDecisionEngineSpecification
2013-04-07 10:30:37 +03:00
{
private readonly Logger _logger;
public SeasonMatchSpecification(Logger logger)
{
_logger = logger;
}
public string RejectionReason
{
get
{
return "Episode doesn't match";
}
}
public bool IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchCriteriaBase searchCriteria)
2013-04-07 10:30:37 +03:00
{
if (searchCriteria == null)
{
return true;
}
var singleEpisodeSpec = searchCriteria as SeasonSearchCriteria;
2013-04-07 10:30:37 +03:00
if (singleEpisodeSpec == null) return true;
if (singleEpisodeSpec.SeasonNumber != remoteEpisode.ParsedEpisodeInfo.SeasonNumber)
2013-04-07 10:30:37 +03:00
{
_logger.Trace("Season number does not match searched season number, skipping.");
return false;
}
2013-04-07 10:30:37 +03:00
return true;
}
}
}