New: Download client option for redownloading failed releases from Interactive Search

Closes #5580
This commit is contained in:
Mark McDowall 2023-10-06 13:10:46 -07:00
parent 113b0864b8
commit 87e0a7983a
9 changed files with 53 additions and 6 deletions

View File

@ -2,8 +2,10 @@
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
margin-right: $formLabelRightMarginWidth; margin-right: $formLabelRightMarginWidth;
padding-top: 8px;
min-height: 35px;
text-align: end;
font-weight: bold; font-weight: bold;
line-height: 35px;
} }
.hasError { .hasError {

View File

@ -61,7 +61,7 @@ function DownloadClientOptions(props) {
isAdvanced={true} isAdvanced={true}
size={sizes.MEDIUM} size={sizes.MEDIUM}
> >
<FormLabel>{translate('RedownloadFailed')}</FormLabel> <FormLabel>{translate('AutoRedownloadFailed')}</FormLabel>
<FormInputGroup <FormInputGroup
type={inputTypes.CHECK} type={inputTypes.CHECK}
@ -71,6 +71,26 @@ function DownloadClientOptions(props) {
{...settings.autoRedownloadFailed} {...settings.autoRedownloadFailed}
/> />
</FormGroup> </FormGroup>
{
settings.autoRedownloadFailed.value ?
<FormGroup
advancedSettings={advancedSettings}
isAdvanced={true}
size={sizes.MEDIUM}
>
<FormLabel>{translate('AutoRedownloadFailedFromInteractiveSearch')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
name="autoRedownloadFailedFromInteractiveSearch"
helpText={translate('AutoRedownloadFailedFromInteractiveSearchHelpText')}
onChange={onInputChange}
{...settings.autoRedownloadFailedFromInteractiveSearch}
/>
</FormGroup> :
null
}
</Form> </Form>
<Alert kind={kinds.INFO}> <Alert kind={kinds.INFO}>

View File

@ -144,6 +144,13 @@ namespace NzbDrone.Core.Configuration
set { SetValue("AutoRedownloadFailed", value); } set { SetValue("AutoRedownloadFailed", value); }
} }
public bool AutoRedownloadFailedFromInteractiveSearch
{
get { return GetValueBoolean("AutoRedownloadFailedFromInteractiveSearch", true); }
set { SetValue("AutoRedownloadFailedFromInteractiveSearch", value); }
}
public bool CreateEmptySeriesFolders public bool CreateEmptySeriesFolders
{ {
get { return GetValueBoolean("CreateEmptySeriesFolders", false); } get { return GetValueBoolean("CreateEmptySeriesFolders", false); }

View File

@ -20,6 +20,7 @@ namespace NzbDrone.Core.Configuration
// Completed/Failed Download Handling (Download client) // Completed/Failed Download Handling (Download client)
bool EnableCompletedDownloadHandling { get; set; } bool EnableCompletedDownloadHandling { get; set; }
bool AutoRedownloadFailed { get; set; } bool AutoRedownloadFailed { get; set; }
bool AutoRedownloadFailedFromInteractiveSearch { get; set; }
// Media Management // Media Management
bool AutoUnmonitorPreviouslyDownloadedEpisodes { get; set; } bool AutoUnmonitorPreviouslyDownloadedEpisodes { get; set; }

View File

@ -2,6 +2,7 @@ using System.Collections.Generic;
using NzbDrone.Common.Messaging; using NzbDrone.Common.Messaging;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Languages; using NzbDrone.Core.Languages;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Download namespace NzbDrone.Core.Download
@ -24,5 +25,6 @@ namespace NzbDrone.Core.Download
public TrackedDownload TrackedDownload { get; set; } public TrackedDownload TrackedDownload { get; set; }
public List<Language> Languages { get; set; } public List<Language> Languages { get; set; }
public bool SkipRedownload { get; set; } public bool SkipRedownload { get; set; }
public ReleaseSourceType ReleaseSource { get; set; }
} }
} }

View File

@ -1,9 +1,11 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.History; using NzbDrone.Core.History;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Download namespace NzbDrone.Core.Download
{ {
@ -128,6 +130,7 @@ namespace NzbDrone.Core.Download
private void PublishDownloadFailedEvent(List<EpisodeHistory> historyItems, string message, TrackedDownload trackedDownload = null, bool skipRedownload = false) private void PublishDownloadFailedEvent(List<EpisodeHistory> historyItems, string message, TrackedDownload trackedDownload = null, bool skipRedownload = false)
{ {
var historyItem = historyItems.First(); var historyItem = historyItems.First();
Enum.TryParse(historyItem.Data.GetValueOrDefault(EpisodeHistory.RELEASE_SOURCE, ReleaseSourceType.Unknown.ToString()), out ReleaseSourceType releaseSource);
var downloadFailedEvent = new DownloadFailedEvent var downloadFailedEvent = new DownloadFailedEvent
{ {
@ -141,7 +144,8 @@ namespace NzbDrone.Core.Download
Data = historyItem.Data, Data = historyItem.Data,
TrackedDownload = trackedDownload, TrackedDownload = trackedDownload,
Languages = historyItem.Languages, Languages = historyItem.Languages,
SkipRedownload = skipRedownload SkipRedownload = skipRedownload,
ReleaseSource = releaseSource
}; };
_eventAggregator.PublishEvent(downloadFailedEvent); _eventAggregator.PublishEvent(downloadFailedEvent);

View File

@ -5,6 +5,7 @@ using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Messaging; using NzbDrone.Core.Messaging;
using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Download namespace NzbDrone.Core.Download
@ -42,6 +43,12 @@ namespace NzbDrone.Core.Download
return; return;
} }
if (message.ReleaseSource == ReleaseSourceType.InteractiveSearch && !_configService.AutoRedownloadFailedFromInteractiveSearch)
{
_logger.Debug("Auto redownloading failed episodes from interactive search is disabled");
return;
}
if (message.EpisodeIds.Count == 1) if (message.EpisodeIds.Count == 1)
{ {
_logger.Debug("Failed download only contains one episode, searching again"); _logger.Debug("Failed download only contains one episode, searching again");

View File

@ -117,6 +117,9 @@
"AuthenticationRequiredUsernameHelpTextWarning": "Enter a new username", "AuthenticationRequiredUsernameHelpTextWarning": "Enter a new username",
"AuthenticationRequiredWarning": "To prevent remote access without authentication, {appName} now requires authentication to be enabled. You can optionally disable authentication from local addresses.", "AuthenticationRequiredWarning": "To prevent remote access without authentication, {appName} now requires authentication to be enabled. You can optionally disable authentication from local addresses.",
"AutoAdd": "Auto Add", "AutoAdd": "Auto Add",
"AutoRedownloadFailed": "Redownload Failed",
"AutoRedownloadFailedFromInteractiveSearch": "Redownload Failed from Interactive Search",
"AutoRedownloadFailedFromInteractiveSearchHelpText": "Automatically search for and attempt to download a different release when failed release was grabbed from interactive search",
"AutoRedownloadFailedHelpText": "Automatically search for and attempt to download a different release", "AutoRedownloadFailedHelpText": "Automatically search for and attempt to download a different release",
"AutoTagging": "Auto Tagging", "AutoTagging": "Auto Tagging",
"AutoTaggingLoadError": "Unable to load auto tagging", "AutoTaggingLoadError": "Unable to load auto tagging",
@ -1021,7 +1024,6 @@
"RecyclingBinCleanupHelpText": "Set to 0 to disable automatic cleanup", "RecyclingBinCleanupHelpText": "Set to 0 to disable automatic cleanup",
"RecyclingBinCleanupHelpTextWarning": "Files in the recycle bin older than the selected number of days will be cleaned up automatically", "RecyclingBinCleanupHelpTextWarning": "Files in the recycle bin older than the selected number of days will be cleaned up automatically",
"RecyclingBinHelpText": "Episode files will go here when deleted instead of being permanently deleted", "RecyclingBinHelpText": "Episode files will go here when deleted instead of being permanently deleted",
"RedownloadFailed": "Redownload Failed",
"Refresh": "Refresh", "Refresh": "Refresh",
"RefreshAndScan": "Refresh & Scan", "RefreshAndScan": "Refresh & Scan",
"RefreshAndScanTooltip": "Refresh information and scan disk", "RefreshAndScanTooltip": "Refresh information and scan disk",

View File

@ -1,4 +1,4 @@
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using Sonarr.Http.REST; using Sonarr.Http.REST;
namespace Sonarr.Api.V3.Config namespace Sonarr.Api.V3.Config
@ -9,6 +9,7 @@ namespace Sonarr.Api.V3.Config
public bool EnableCompletedDownloadHandling { get; set; } public bool EnableCompletedDownloadHandling { get; set; }
public bool AutoRedownloadFailed { get; set; } public bool AutoRedownloadFailed { get; set; }
public bool AutoRedownloadFailedFromInteractiveSearch { get; set; }
} }
public static class DownloadClientConfigResourceMapper public static class DownloadClientConfigResourceMapper
@ -20,7 +21,8 @@ namespace Sonarr.Api.V3.Config
DownloadClientWorkingFolders = model.DownloadClientWorkingFolders, DownloadClientWorkingFolders = model.DownloadClientWorkingFolders,
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling, EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
AutoRedownloadFailed = model.AutoRedownloadFailed AutoRedownloadFailed = model.AutoRedownloadFailed,
AutoRedownloadFailedFromInteractiveSearch = model.AutoRedownloadFailedFromInteractiveSearch
}; };
} }
} }