skip queue check and adding new items if download client isn't configured correctly.

This commit is contained in:
kay.one 2013-07-30 22:49:41 -07:00
parent 1eb278c7f6
commit a5bb99367e
8 changed files with 73 additions and 5 deletions

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NLog;
using NzbDrone.Core.Download;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Tv;
@ -10,10 +11,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public class NotInQueueSpecification : IDecisionEngineSpecification
{
private readonly IProvideDownloadClient _downloadClientProvider;
private readonly Logger _logger;
public NotInQueueSpecification(IProvideDownloadClient downloadClientProvider)
public NotInQueueSpecification(IProvideDownloadClient downloadClientProvider, Logger logger)
{
_downloadClientProvider = downloadClientProvider;
_logger = logger;
}
public string RejectionReason
@ -28,6 +31,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
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);
return !IsInQueue(subject, queue);