2013-03-07 00:19:49 +00:00
|
|
|
using NLog;
|
2013-08-07 03:18:05 +00:00
|
|
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
2013-04-15 01:41:39 +00:00
|
|
|
using NzbDrone.Core.Parser.Model;
|
2013-03-07 00:19:49 +00:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
{
|
2013-04-07 07:30:37 +00:00
|
|
|
public class QualityAllowedByProfileSpecification : IDecisionEngineSpecification
|
2013-03-07 00:19:49 +00:00
|
|
|
{
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
public QualityAllowedByProfileSpecification(Logger logger)
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
|
|
|
|
public string RejectionReason
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return "Quality rejected by series profile";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-07 03:18:05 +00:00
|
|
|
public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteriaBase)
|
2013-03-07 00:19:49 +00:00
|
|
|
{
|
2013-04-28 19:46:13 +00:00
|
|
|
_logger.Trace("Checking if report meets quality requirements. {0}", subject.ParsedEpisodeInfo.Quality);
|
2013-04-29 01:47:06 +00:00
|
|
|
if (!subject.Series.QualityProfile.Value.Allowed.Contains(subject.ParsedEpisodeInfo.Quality.Quality))
|
2013-03-07 00:19:49 +00:00
|
|
|
{
|
2013-04-28 19:46:13 +00:00
|
|
|
_logger.Trace("Quality {0} rejected by Series' quality profile", subject.ParsedEpisodeInfo.Quality);
|
2013-03-07 00:19:49 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|