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

(cherry picked from commit 87e0a7983a437a4d166aa8b9c9eaf78ea5431969)

Closes #9260
This commit is contained in:
Mark McDowall 2023-10-06 13:10:46 -07:00 committed by Bogdan
parent a3bb0541f0
commit e0c8a8f0d6
9 changed files with 58 additions and 6 deletions

View File

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

View File

@ -80,8 +80,12 @@ function DownloadClientOptions(props) {
legend={translate('FailedDownloadHandling')}
>
<Form>
<FormGroup size={sizes.MEDIUM}>
<FormLabel>{translate('Redownload')}</FormLabel>
<FormGroup
advancedSettings={advancedSettings}
isAdvanced={true}
size={sizes.MEDIUM}
>
<FormLabel>{translate('AutoRedownloadFailed')}</FormLabel>
<FormInputGroup
type={inputTypes.CHECK}
@ -91,7 +95,28 @@ function DownloadClientOptions(props) {
{...settings.autoRedownloadFailed}
/>
</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>
<Alert kind={kinds.INFO}>
{translate('RemoveDownloadsAlert')}
</Alert>

View File

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

View File

@ -22,6 +22,7 @@ namespace NzbDrone.Core.Configuration
bool EnableCompletedDownloadHandling { get; set; }
bool AutoRedownloadFailed { get; set; }
bool AutoRedownloadFailedFromInteractiveSearch { get; set; }
// Media Management
bool AutoUnmonitorPreviouslyDownloadedMovies { get; set; }

View File

@ -2,6 +2,7 @@ using System.Collections.Generic;
using NzbDrone.Common.Messaging;
using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Languages;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Qualities;
namespace NzbDrone.Core.Download
@ -23,5 +24,6 @@ namespace NzbDrone.Core.Download
public TrackedDownload TrackedDownload { get; set; }
public List<Language> Languages { 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.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.History;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Download
{
@ -128,6 +130,7 @@ namespace NzbDrone.Core.Download
private void PublishDownloadFailedEvent(List<MovieHistory> historyItems, string message, TrackedDownload trackedDownload = null, bool skipRedownload = false)
{
var historyItem = historyItems.First();
Enum.TryParse(historyItem.Data.GetValueOrDefault(MovieHistory.RELEASE_SOURCE, ReleaseSourceType.Unknown.ToString()), out ReleaseSourceType releaseSource);
var downloadFailedEvent = new DownloadFailedEvent
{
@ -140,7 +143,8 @@ namespace NzbDrone.Core.Download
Data = historyItem.Data,
TrackedDownload = trackedDownload,
Languages = historyItem.Languages,
SkipRedownload = skipRedownload
SkipRedownload = skipRedownload,
ReleaseSource = releaseSource
};
_eventAggregator.PublishEvent(downloadFailedEvent);

View File

@ -5,6 +5,7 @@ using NzbDrone.Core.IndexerSearch;
using NzbDrone.Core.Messaging;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Download
{
@ -38,6 +39,12 @@ namespace NzbDrone.Core.Download
return;
}
if (message.ReleaseSource == ReleaseSourceType.InteractiveSearch && !_configService.AutoRedownloadFailedFromInteractiveSearch)
{
_logger.Debug("Auto redownloading failed movies from interactive search is disabled");
return;
}
if (message.MovieId != 0)
{
_logger.Debug("Failed download contains a movie, searching again.");

View File

@ -89,6 +89,9 @@
"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.",
"Auto": "Auto",
"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",
"AutoTagging": "Auto Tagging",
"AutoTaggingNegateHelpText": "If checked, the auto tagging rule will not apply if this {0} condition matches.",
@ -908,7 +911,6 @@
"RecyclingBin": "Recycling Bin",
"RecyclingBinCleanup": "Recycling Bin Cleanup",
"Reddit": "Reddit",
"Redownload": "Redownload",
"Refresh": "Refresh",
"RefreshAndScan": "Refresh & Scan",
"RefreshCollections": "Refresh Collections",

View File

@ -11,6 +11,7 @@ namespace Radarr.Api.V3.Config
public int CheckForFinishedDownloadInterval { get; set; }
public bool AutoRedownloadFailed { get; set; }
public bool AutoRedownloadFailedFromInteractiveSearch { get; set; }
}
public static class DownloadClientConfigResourceMapper
@ -24,7 +25,8 @@ namespace Radarr.Api.V3.Config
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
CheckForFinishedDownloadInterval = model.CheckForFinishedDownloadInterval,
AutoRedownloadFailed = model.AutoRedownloadFailed
AutoRedownloadFailed = model.AutoRedownloadFailed,
AutoRedownloadFailedFromInteractiveSearch = model.AutoRedownloadFailedFromInteractiveSearch
};
}
}