2013-03-07 01:19:49 +01:00
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Core.Model;
|
2013-04-15 03:41:39 +02:00
|
|
|
using NzbDrone.Core.Parser;
|
|
|
|
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-04-15 03:41:39 +02:00
|
|
|
public virtual bool IsSatisfiedBy(RemoteEpisode subject)
|
2013-03-07 01:19:49 +01: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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|