|
|
@ -1,6 +1,7 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Core.Download;
|
|
|
|
using NzbDrone.Core.Download;
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
using NzbDrone.Core.Parser.Model;
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
@ -10,10 +11,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
public class NotInQueueSpecification : IDecisionEngineSpecification
|
|
|
|
public class NotInQueueSpecification : IDecisionEngineSpecification
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private readonly IProvideDownloadClient _downloadClientProvider;
|
|
|
|
private readonly IProvideDownloadClient _downloadClientProvider;
|
|
|
|
|
|
|
|
private readonly Logger _logger;
|
|
|
|
|
|
|
|
|
|
|
|
public NotInQueueSpecification(IProvideDownloadClient downloadClientProvider)
|
|
|
|
public NotInQueueSpecification(IProvideDownloadClient downloadClientProvider, Logger logger)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_downloadClientProvider = downloadClientProvider;
|
|
|
|
_downloadClientProvider = downloadClientProvider;
|
|
|
|
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string RejectionReason
|
|
|
|
public string RejectionReason
|
|
|
@ -28,6 +31,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var downloadClient = _downloadClientProvider.GetDownloadClient();
|
|
|
|
var downloadClient = _downloadClientProvider.GetDownloadClient();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!downloadClient.IsConfigured)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Warn("Download client {0} isn't configured yet.", downloadClient.GetType().Name);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var queue = downloadClient.GetQueue().Select(queueItem => Parser.Parser.ParseTitle(queueItem.Title)).Where(episodeInfo => episodeInfo != null);
|
|
|
|
var queue = downloadClient.GetQueue().Select(queueItem => Parser.Parser.ParseTitle(queueItem.Title)).Where(episodeInfo => episodeInfo != null);
|
|
|
|
|
|
|
|
|
|
|
|
return !IsInQueue(subject, queue);
|
|
|
|
return !IsInQueue(subject, queue);
|
|
|
|