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

New: Send 'On Manual Interaction Required' notifications in more cases

(cherry picked from commit c5a724f14eec20acf565ac3a036944191b30cab0)

Closes #9722
This commit is contained in:
Stevie Robinson 2024-02-01 04:38:51 +01:00 committed by Bogdan
parent f704ab1512
commit e73015010e

View File

@ -94,7 +94,9 @@ public void Check(TrackedDownload trackedDownload)
if (movie == null)
{
trackedDownload.Warn("Movie title mismatch, Manual Import required.");
trackedDownload.Warn("Movie title mismatch, automatic import is not possible. Manual Import required.");
SendManualInteractionRequiredNotification(trackedDownload);
return;
}
@ -105,16 +107,7 @@ public void Check(TrackedDownload trackedDownload)
if (movieMatchType == MovieMatchType.Id && releaseSource != ReleaseSourceType.InteractiveSearch)
{
trackedDownload.Warn("Found matching movie via grab history, but release was matched to movie by ID. Manual Import required.");
if (!trackedDownload.HasNotifiedManualInteractionRequired)
{
trackedDownload.HasNotifiedManualInteractionRequired = true;
var releaseInfo = new GrabbedReleaseInfo(grabbedHistories);
var manualInteractionEvent = new ManualInteractionRequiredEvent(trackedDownload, releaseInfo);
_eventAggregator.PublishEvent(manualInteractionEvent);
}
SendManualInteractionRequiredNotification(trackedDownload);
return;
}
@ -132,18 +125,21 @@ public void Import(TrackedDownload trackedDownload)
return;
}
trackedDownload.State = TrackedDownloadState.Importing;
var outputPath = trackedDownload.ImportItem.OutputPath.FullPath;
if (trackedDownload.RemoteMovie?.Movie == null)
{
trackedDownload.State = TrackedDownloadState.ImportPending;
trackedDownload.Warn("Unknown Movie", outputPath);
trackedDownload.Warn("Unable to parse download, automatic import is not possible.");
SendManualInteractionRequiredNotification(trackedDownload);
return;
}
var importResults = _downloadedMovieImportService.ProcessPath(outputPath, ImportMode.Auto, trackedDownload.RemoteMovie.Movie, trackedDownload.ImportItem);
trackedDownload.State = TrackedDownloadState.Importing;
var outputPath = trackedDownload.ImportItem.OutputPath.FullPath;
var importResults = _downloadedMovieImportService.ProcessPath(outputPath,
ImportMode.Auto,
trackedDownload.RemoteMovie.Movie,
trackedDownload.ImportItem);
if (VerifyImport(trackedDownload, importResults))
{
@ -190,6 +186,7 @@ public void Import(TrackedDownload trackedDownload)
if (statusMessages.Any())
{
trackedDownload.Warn(statusMessages.ToArray());
SendManualInteractionRequiredNotification(trackedDownload);
}
}
@ -248,6 +245,21 @@ public bool VerifyImport(TrackedDownload trackedDownload, List<ImportResult> imp
return false;
}
private void SendManualInteractionRequiredNotification(TrackedDownload trackedDownload)
{
if (!trackedDownload.HasNotifiedManualInteractionRequired)
{
var grabbedHistories = _historyService.FindByDownloadId(trackedDownload.DownloadItem.DownloadId).Where(h => h.EventType == MovieHistoryEventType.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);