mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
New: Add result to commands to report commands that did not complete successfully
(cherry picked from commit 103ce3def4636ef891e72bd687ef8f46b5125233)
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Instrumentation.Extensions;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
@@ -18,18 +19,21 @@ namespace NzbDrone.Core.MediaFiles
|
||||
private readonly ITrackedDownloadService _trackedDownloadService;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly ICompletedDownloadService _completedDownloadService;
|
||||
private readonly ICommandResultReporter _commandResultReporter;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public DownloadedBooksCommandService(IDownloadedBooksImportService downloadedTracksImportService,
|
||||
ITrackedDownloadService trackedDownloadService,
|
||||
IDiskProvider diskProvider,
|
||||
ICompletedDownloadService completedDownloadService,
|
||||
ICommandResultReporter commandResultReporter,
|
||||
Logger logger)
|
||||
{
|
||||
_downloadedTracksImportService = downloadedTracksImportService;
|
||||
_trackedDownloadService = trackedDownloadService;
|
||||
_diskProvider = diskProvider;
|
||||
_completedDownloadService = completedDownloadService;
|
||||
_commandResultReporter = commandResultReporter;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -77,9 +81,9 @@ namespace NzbDrone.Core.MediaFiles
|
||||
|
||||
if (importResults == null || importResults.All(v => v.Result != ImportResultType.Imported))
|
||||
{
|
||||
// Atm we don't report it as a command failure, coz that would cause the download to be failed.
|
||||
// Changing the message won't do a thing either, coz it will get set to 'Completed' a msec later.
|
||||
//message.SetMessage("Failed to import");
|
||||
// Allow the command to complete successfully, but report as unsuccessful
|
||||
_logger.ProgressDebug("Failed to import");
|
||||
_commandResultReporter.Report(CommandResult.Unsuccessful);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user