From 7c6fad155ac013d76175b5daabde011ff9394b82 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 28 Oct 2013 17:41:35 -0700 Subject: [PATCH] Added option to disable blacklisting, both the queue check and the spec --- .../Configuration/ConfigService.cs | 7 +++ .../Configuration/IConfigService.cs | 1 + .../Specifications/BlacklistSpecification.cs | 13 ++++- .../Download/FailedDownloadService.cs | 6 ++ .../FileManagement/FileManagementView.js | 19 ++++++- .../FileManagementViewTemplate.html | 56 +++++++++++++------ .../MediaManagement/Naming/NamingView.js | 4 +- 7 files changed, 84 insertions(+), 22 deletions(-) diff --git a/src/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs index b51d92611..c480dd7cf 100644 --- a/src/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -275,6 +275,13 @@ namespace NzbDrone.Core.Configuration set { SetValue("RemoveFailedDownloads", value); } } + public Boolean EnableFailedDownloadHandling + { + get { return GetValueBoolean("EnableFailedDownloadHandling", true); } + + set { SetValue("EnableFailedDownloadHandling", value); } + } + public string DownloadClientWorkingFolders { get { return GetValue("DownloadClientWorkingFolders", "_UNPACK_|_FAILED_"); } diff --git a/src/NzbDrone.Core/Configuration/IConfigService.cs b/src/NzbDrone.Core/Configuration/IConfigService.cs index f4578d4c1..8df4fbaa2 100644 --- a/src/NzbDrone.Core/Configuration/IConfigService.cs +++ b/src/NzbDrone.Core/Configuration/IConfigService.cs @@ -41,6 +41,7 @@ namespace NzbDrone.Core.Configuration String DownloadClientWorkingFolders { get; set; } Boolean AutoRedownloadFailed { get; set; } Boolean RemoveFailedDownloads { get; set; } + Boolean EnableFailedDownloadHandling { get; set; } void SaveValues(Dictionary configValues); } } diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/BlacklistSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/BlacklistSpecification.cs index cea341a2e..7aa5c6b32 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/BlacklistSpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/BlacklistSpecification.cs @@ -1,6 +1,7 @@ using System.Linq; using NLog; using NzbDrone.Core.Blacklisting; +using NzbDrone.Core.Configuration; using NzbDrone.Core.IndexerSearch.Definitions; using NzbDrone.Core.Parser.Model; @@ -9,11 +10,13 @@ namespace NzbDrone.Core.DecisionEngine.Specifications public class BlacklistSpecification : IDecisionEngineSpecification { private readonly IBlacklistService _blacklistService; + private readonly IConfigService _configService; private readonly Logger _logger; - public BlacklistSpecification(IBlacklistService blacklistService, Logger logger) + public BlacklistSpecification(IBlacklistService blacklistService, IConfigService configService, Logger logger) { _blacklistService = blacklistService; + _configService = configService; _logger = logger; } @@ -27,9 +30,15 @@ namespace NzbDrone.Core.DecisionEngine.Specifications public virtual bool IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase searchCriteria) { + if (!_configService.EnableFailedDownloadHandling) + { + _logger.Trace("Failed Download Handling is not enabled"); + return true; + } + if (_blacklistService.Blacklisted(subject.Release.Title)) { - _logger.Trace("Release is blacklisted"); + _logger.Trace("{0} is blacklisted", subject.Release.Title); return false; } diff --git a/src/NzbDrone.Core/Download/FailedDownloadService.cs b/src/NzbDrone.Core/Download/FailedDownloadService.cs index f83eb9ccc..59cbb5bd2 100644 --- a/src/NzbDrone.Core/Download/FailedDownloadService.cs +++ b/src/NzbDrone.Core/Download/FailedDownloadService.cs @@ -39,6 +39,12 @@ namespace NzbDrone.Core.Download private void CheckForFailedDownloads() { + if (!_configService.EnableFailedDownloadHandling) + { + _logger.Trace("Failed Download Handling is not enabled"); + return; + } + var grabbedHistory = _historyService.Grabbed(); var failedHistory = _historyService.Failed(); diff --git a/src/UI/Settings/MediaManagement/FileManagement/FileManagementView.js b/src/UI/Settings/MediaManagement/FileManagement/FileManagementView.js index ff6a247b9..8cd2c120e 100644 --- a/src/UI/Settings/MediaManagement/FileManagement/FileManagementView.js +++ b/src/UI/Settings/MediaManagement/FileManagement/FileManagementView.js @@ -10,11 +10,28 @@ define( template: 'Settings/MediaManagement/FileManagement/FileManagementViewTemplate', ui: { - recyclingBin: '.x-path' + recyclingBin : '.x-path', + failedDownloadHandlingCheckbox: '.x-failed-download-handling', + failedDownloadOptions : '.x-failed-download-options' + }, + + events: { + 'change .x-failed-download-handling': '_setFailedDownloadOptionsVisibility' }, onShow: function () { this.ui.recyclingBin.autoComplete('/directories'); + }, + + _setFailedDownloadOptionsVisibility: function () { + var checked = this.ui.failedDownloadHandlingCheckbox.prop('checked'); + if (checked) { + this.ui.failedDownloadOptions.slideDown(); + } + + else { + this.ui.failedDownloadOptions.slideUp(); + } } }); diff --git a/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html b/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html index 2313306db..ae02dc6a5 100644 --- a/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html +++ b/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html @@ -57,11 +57,11 @@ Failed Download Handling
- +
-
- +
+
+ + +
+
-
-