2013-03-07 00:19:49 +00:00
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
|
|
|
|
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-04-07 19:01:24 +00:00
|
|
|
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
|
2013-03-07 00:19:49 +00:00
|
|
|
{
|
|
|
|
_logger.Trace("Checking if report meets quality requirements. {0}", subject.Quality);
|
|
|
|
if (!subject.Series.QualityProfile.Allowed.Contains(subject.Quality.Quality))
|
|
|
|
{
|
|
|
|
_logger.Trace("Quality {0} rejected by Series' quality profile", subject.Quality);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|