mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
New: Rewrite of download decision engine.
This commit is contained in:
parent
a168bdfa00
commit
5717b7f596
60 changed files with 2013 additions and 1745 deletions
|
@ -0,0 +1,35 @@
|
|||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
|
||||
namespace NzbDrone.Core.Providers.DecisionEngine
|
||||
{
|
||||
public class QualityUpgradeSpecification
|
||||
{
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public virtual bool IsSatisfiedBy(Quality currentQuality, Quality newQuality, QualityTypes cutOff)
|
||||
{
|
||||
if (currentQuality >= newQuality)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue