Lidarr/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs

31 lines
786 B
C#
Raw Normal View History

using NLog;
using NzbDrone.Core.Download;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.DecisionEngine.Specifications
{
2013-04-07 07:30:37 +00:00
public class NotInQueueSpecification : IDecisionEngineSpecification
{
2013-04-01 06:22:16 +00:00
private readonly IProvideDownloadClient _downloadClientProvider;
2013-04-01 06:22:16 +00:00
public NotInQueueSpecification(IProvideDownloadClient downloadClientProvider)
{
2013-04-01 06:22:16 +00:00
_downloadClientProvider = downloadClientProvider;
}
public string RejectionReason
{
get
{
return "Already in download queue.";
}
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
{
2013-04-01 06:22:16 +00:00
return !_downloadClientProvider.GetDownloadClient().IsInQueue(subject);
}
}
}