2013-03-07 00:19:49 +00:00
|
|
|
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-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
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|