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