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; 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

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

View file

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

View file

@ -22,6 +22,7 @@ public interface IConfigService
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 AutoUnmonitorPreviouslyDownloadedMovies { get; set; } bool AutoUnmonitorPreviouslyDownloadedMovies { get; set; }

View file

@ -2,6 +2,7 @@
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
@ -23,5 +24,6 @@ public DownloadFailedEvent()
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 @@ public void ProcessFailed(TrackedDownload trackedDownload)
private void PublishDownloadFailedEvent(List<MovieHistory> historyItems, string message, TrackedDownload trackedDownload = null, bool skipRedownload = false) private void PublishDownloadFailedEvent(List<MovieHistory> historyItems, string message, TrackedDownload trackedDownload = null, bool skipRedownload = false)
{ {
var historyItem = historyItems.First(); var historyItem = historyItems.First();
Enum.TryParse(historyItem.Data.GetValueOrDefault(MovieHistory.RELEASE_SOURCE, ReleaseSourceType.Unknown.ToString()), out ReleaseSourceType releaseSource);
var downloadFailedEvent = new DownloadFailedEvent var downloadFailedEvent = new DownloadFailedEvent
{ {
@ -140,7 +143,8 @@ private void PublishDownloadFailedEvent(List<MovieHistory> historyItems, string
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.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;
namespace NzbDrone.Core.Download namespace NzbDrone.Core.Download
{ {
@ -38,6 +39,12 @@ public void Handle(DownloadFailedEvent message)
return; return;
} }
if (message.ReleaseSource == ReleaseSourceType.InteractiveSearch && !_configService.AutoRedownloadFailedFromInteractiveSearch)
{
_logger.Debug("Auto redownloading failed movies from interactive search is disabled");
return;
}
if (message.MovieId != 0) if (message.MovieId != 0)
{ {
_logger.Debug("Failed download contains a movie, searching again."); _logger.Debug("Failed download contains a movie, searching again.");

View file

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

View file

@ -11,6 +11,7 @@ public class DownloadClientConfigResource : RestResource
public int CheckForFinishedDownloadInterval { get; set; } public int CheckForFinishedDownloadInterval { 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
@ -24,7 +25,8 @@ public static DownloadClientConfigResource ToResource(IConfigService model)
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling, EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
CheckForFinishedDownloadInterval = model.CheckForFinishedDownloadInterval, CheckForFinishedDownloadInterval = model.CheckForFinishedDownloadInterval,
AutoRedownloadFailed = model.AutoRedownloadFailed AutoRedownloadFailed = model.AutoRedownloadFailed,
AutoRedownloadFailedFromInteractiveSearch = model.AutoRedownloadFailedFromInteractiveSearch
}; };
} }
} }