1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-19 17:32:38 +01:00

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 @@ public bool AutoRedownloadFailed
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 @@ public interface IConfigService
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 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 @@ public DownloadFailedEvent()
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 @@ public void ProcessFailed(TrackedDownload trackedDownload)
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 @@ private void PublishDownloadFailedEvent(List<MovieHistory> historyItems, string
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.Messaging;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Download
{
@ -38,6 +39,12 @@ public void Handle(DownloadFailedEvent message)
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 @@ public class DownloadClientConfigResource : RestResource
public int CheckForFinishedDownloadInterval { get; set; }
public bool AutoRedownloadFailed { get; set; }
public bool AutoRedownloadFailedFromInteractiveSearch { get; set; }
}
public static class DownloadClientConfigResourceMapper
@ -24,7 +25,8 @@ public static DownloadClientConfigResource ToResource(IConfigService model)
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
CheckForFinishedDownloadInterval = model.CheckForFinishedDownloadInterval,
AutoRedownloadFailed = model.AutoRedownloadFailed
AutoRedownloadFailed = model.AutoRedownloadFailed,
AutoRedownloadFailedFromInteractiveSearch = model.AutoRedownloadFailedFromInteractiveSearch
};
}
}