You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Radarr/NzbDrone.Core/DecisionEngine/UpgradePossibleSpecificatio...

41 lines
1.1 KiB

using System.Linq;
using NLog;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.DecisionEngine
{
public class UpgradePossibleSpecification
{
private readonly QualityProvider _qualityProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
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; ;
}
}
}