1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 12:32:31 +01:00
Radarr/NzbDrone.Core/DecisionEngine/UpgradePossibleSpecification.cs
2013-02-26 19:19:47 -08:00

42 lines
1.1 KiB
C#

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