mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -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,40 @@
|
|||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Providers.DecisionEngine
|
||||
{
|
||||
public class UpgradePossibleSpecification
|
||||
{
|
||||
private readonly QualityProvider _qualityProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public UpgradePossibleSpecification(QualityProvider qualityProvider)
|
||||
{
|
||||
_qualityProvider = qualityProvider;
|
||||
}
|
||||
|
||||
public UpgradePossibleSpecification()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual bool IsSatisfiedBy(Episode subject)
|
||||
{
|
||||
//Used to check if the existing episode can be upgraded by searching (Before we search)
|
||||
if (subject.EpisodeFileId == 0)
|
||||
return true;
|
||||
|
||||
var profile = _qualityProvider.Get(subject.Series.QualityProfileId);
|
||||
|
||||
|
||||
//TODO:How about proper?
|
||||
if (subject.EpisodeFile.Quality >= profile.Cutoff)
|
||||
return false;
|
||||
|
||||
return true; ;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue