From 6dd2951f801dbbbdc0a13f49a44bd3371cd13c70 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 24 Oct 2013 15:12:39 -0700 Subject: [PATCH] Redownload after failure is an advanced option. New: Handle failed downloads and attempt to find another release (SABnzbd only) --- .../Configuration/ConfigService.cs | 7 +++++++ .../Configuration/IConfigService.cs | 1 + .../RedownloadFailedDownloadService.cs | 11 +++++++++- .../FileManagementViewTemplate.html | 20 +++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/Configuration/ConfigService.cs b/src/NzbDrone.Core/Configuration/ConfigService.cs index a7bebdb6d..f8f3908b7 100644 --- a/src/NzbDrone.Core/Configuration/ConfigService.cs +++ b/src/NzbDrone.Core/Configuration/ConfigService.cs @@ -261,6 +261,13 @@ namespace NzbDrone.Core.Configuration set { SetValue("AutoDownloadPropers", value); } } + public Boolean AutoRedownloadFailed + { + get { return GetValueBoolean("AutoRedownloadFailed", true); } + + set { SetValue("AutoRedownloadFailed", 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 e226740b0..59a24c7fe 100644 --- a/src/NzbDrone.Core/Configuration/IConfigService.cs +++ b/src/NzbDrone.Core/Configuration/IConfigService.cs @@ -39,6 +39,7 @@ namespace NzbDrone.Core.Configuration Int32 RssSyncInterval { get; set; } Boolean AutoDownloadPropers { get; set; } String DownloadClientWorkingFolders { get; set; } + Boolean AutoRedownloadFailed { get; set; } void SaveValues(Dictionary configValues); } } diff --git a/src/NzbDrone.Core/Download/RedownloadFailedDownloadService.cs b/src/NzbDrone.Core/Download/RedownloadFailedDownloadService.cs index dd78b61fa..dd40220c9 100644 --- a/src/NzbDrone.Core/Download/RedownloadFailedDownloadService.cs +++ b/src/NzbDrone.Core/Download/RedownloadFailedDownloadService.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using NLog; +using NzbDrone.Core.Configuration; using NzbDrone.Core.IndexerSearch; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Tv; @@ -15,12 +16,14 @@ namespace NzbDrone.Core.Download public class RedownloadFailedDownloadService : IRedownloadFailedDownloads { + private readonly IConfigService _configService; private readonly IEpisodeService _episodeService; private readonly ICommandExecutor _commandExecutor; private readonly Logger _logger; - public RedownloadFailedDownloadService(IEpisodeService episodeService, ICommandExecutor commandExecutor, Logger logger) + public RedownloadFailedDownloadService(IConfigService configService, IEpisodeService episodeService, ICommandExecutor commandExecutor, Logger logger) { + _configService = configService; _episodeService = episodeService; _commandExecutor = commandExecutor; _logger = logger; @@ -28,6 +31,12 @@ namespace NzbDrone.Core.Download public void Redownload(int seriesId, List episodeIds) { + if (!_configService.AutoRedownloadFailed) + { + _logger.Trace("Auto redownloading failed episodes is disabled"); + return; + } + if (episodeIds.Count == 1) { _logger.Trace("Failed download only contains one episode, searching again"); diff --git a/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html b/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html index 02938c4e0..e66c50607 100644 --- a/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html +++ b/src/UI/Settings/MediaManagement/FileManagement/FileManagementViewTemplate.html @@ -41,6 +41,26 @@ +
+ + +
+
+