|
|
|
@ -1,31 +1,19 @@
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using NLog;
|
|
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Providers.DecisionEngine
|
|
|
|
|
{
|
|
|
|
|
public class QualityUpgradeSpecification
|
|
|
|
|
public class QualityAllowedByProfileSpecification
|
|
|
|
|
{
|
|
|
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
|
|
|
|
public virtual bool IsSatisfiedBy(Quality currentQuality, Quality newQuality, QualityTypes cutOff)
|
|
|
|
|
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
|
|
|
|
|
{
|
|
|
|
|
if (currentQuality >= newQuality)
|
|
|
|
|
logger.Trace("Checking if report meets quality requirements. {0}", subject.Quality);
|
|
|
|
|
if (!subject.Series.QualityProfile.Allowed.Contains(subject.Quality.QualityType))
|
|
|
|
|
{
|
|
|
|
|
logger.Trace("existing item has better or equal quality. skipping");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentQuality.QualityType == newQuality.QualityType && newQuality.Proper)
|
|
|
|
|
{
|
|
|
|
|
logger.Trace("Upgrading existing item to proper.");
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentQuality.QualityType >= cutOff)
|
|
|
|
|
{
|
|
|
|
|
logger.Trace("Existing item meets cut-off. skipping.");
|
|
|
|
|
logger.Trace("Quality {0} rejected by Series' quality profile", subject.Quality);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|