1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/NzbDrone.Core/Providers/DecisionEngine/UpgradePossibleSpecification.cs
2013-01-02 17:09:13 -08:00

39 lines
1.0 KiB
C#

using System.Linq;
using NLog;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Providers.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; ;
}
}
}