2013-03-07 00:19:49 +00:00
|
|
|
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-03-07 00:19:49 +00:00
|
|
|
{
|
2013-04-01 06:22:16 +00:00
|
|
|
private readonly IProvideDownloadClient _downloadClientProvider;
|
2013-03-07 00:19:49 +00:00
|
|
|
|
2013-04-01 06:22:16 +00:00
|
|
|
public NotInQueueSpecification(IProvideDownloadClient downloadClientProvider)
|
2013-03-07 00:19:49 +00:00
|
|
|
{
|
2013-04-01 06:22:16 +00:00
|
|
|
_downloadClientProvider = downloadClientProvider;
|
2013-03-07 00:19:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2013-03-07 00:19:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|