From c5a724f14eec20acf565ac3a036944191b30cab0 Mon Sep 17 00:00:00 2001 From: Stevie Robinson Date: Thu, 1 Feb 2024 04:38:51 +0100 Subject: [PATCH] New: Send 'On Manual Interaction Required' notifications in more cases Closes #6448 --- .../Download/CompletedDownloadService.cs | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index 3fd5008cb..5f4f94938 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -96,6 +96,8 @@ namespace NzbDrone.Core.Download if (series == null) { trackedDownload.Warn("Series title mismatch; automatic import is not possible. Check the download troubleshooting entry on the wiki for common causes."); + SendManualInteractionRequiredNotification(trackedDownload); + return; } @@ -106,16 +108,7 @@ namespace NzbDrone.Core.Download if (seriesMatchType == SeriesMatchType.Id && releaseSource != ReleaseSourceType.InteractiveSearch) { trackedDownload.Warn("Found matching series via grab history, but release was matched to series by ID. Automatic import is not possible. See the FAQ for details."); - - if (!trackedDownload.HasNotifiedManualInteractionRequired) - { - trackedDownload.HasNotifiedManualInteractionRequired = true; - - var releaseInfo = new GrabbedReleaseInfo(grabbedHistories); - var manualInteractionEvent = new ManualInteractionRequiredEvent(trackedDownload, releaseInfo); - - _eventAggregator.PublishEvent(manualInteractionEvent); - } + SendManualInteractionRequiredNotification(trackedDownload); return; } @@ -136,6 +129,8 @@ namespace NzbDrone.Core.Download if (trackedDownload.RemoteEpisode == null) { trackedDownload.Warn("Unable to parse download, automatic import is not possible."); + SendManualInteractionRequiredNotification(trackedDownload); + return; } @@ -192,6 +187,7 @@ namespace NzbDrone.Core.Download if (statusMessages.Any()) { trackedDownload.Warn(statusMessages.ToArray()); + SendManualInteractionRequiredNotification(trackedDownload); } } @@ -258,6 +254,21 @@ namespace NzbDrone.Core.Download return false; } + private void SendManualInteractionRequiredNotification(TrackedDownload trackedDownload) + { + if (!trackedDownload.HasNotifiedManualInteractionRequired) + { + var grabbedHistories = _historyService.FindByDownloadId(trackedDownload.DownloadItem.DownloadId).Where(h => h.EventType == EpisodeHistoryEventType.Grabbed).ToList(); + + trackedDownload.HasNotifiedManualInteractionRequired = true; + + var releaseInfo = grabbedHistories.Count > 0 ? new GrabbedReleaseInfo(grabbedHistories) : null; + var manualInteractionEvent = new ManualInteractionRequiredEvent(trackedDownload, releaseInfo); + + _eventAggregator.PublishEvent(manualInteractionEvent); + } + } + private void SetImportItem(TrackedDownload trackedDownload) { trackedDownload.ImportItem = _provideImportItemService.ProvideImportItem(trackedDownload.DownloadItem, trackedDownload.ImportItem);