1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-30 19:56:54 +00:00
Sonarr/NzbDrone.Core/Providers/DecisionEngine/QualityUpgradeSpecification.cs

36 lines
1 KiB
C#
Raw Normal View History

using System.Linq;
using NLog;
using NzbDrone.Core.Model;
2012-04-15 01:09:51 +00:00
using NzbDrone.Core.Repository.Quality;
namespace NzbDrone.Core.Providers.DecisionEngine
{
2012-04-15 01:09:51 +00:00
public class QualityUpgradeSpecification
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
2012-04-15 01:09:51 +00:00
public virtual bool IsSatisfiedBy(Quality currentQuality, Quality newQuality, QualityTypes cutOff)
{
2012-04-15 01:09:51 +00:00
if (currentQuality >= newQuality)
{
2012-04-15 01:09:51 +00:00
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.");
return false;
}
return true;
}
}
}