Sonarr/NzbDrone.Core/DecisionEngine/UpgradePossibleSpecificatio...

42 lines
1.1 KiB
C#
Raw Normal View History

using System.Linq;
using NLog;
2013-02-27 03:19:22 +00:00
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
2013-02-19 02:19:38 +00:00
using NzbDrone.Core.Providers;
using NzbDrone.Core.Repository;
2013-02-19 02:19:38 +00:00
namespace NzbDrone.Core.DecisionEngine
{
public class UpgradePossibleSpecification
{
2013-02-27 03:19:22 +00:00
private readonly IQualityProfileService _qualityProvider;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
2013-02-27 03:19:22 +00:00
public UpgradePossibleSpecification(IQualityProfileService 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; ;
}
}
}