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