sonarr-repo-only/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs

31 lines
781 B
C#
Raw Normal View History

using NLog;
using NzbDrone.Core.Download;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.DecisionEngine.Specifications
{
public class NotInQueueSpecification : IFetchableSpecification
{
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);
}
}
}