Fixed: Imports triggered through API not being marked as imported/removed from client

Fixes #258

(cherry picked from commit 382bcbcbeddcf04d5bc361744b6b57ca3c2c54e6)
pull/1392/head
Mark McDowall 5 years ago committed by ta264
parent fc8b6014ec
commit 842f80d567

@ -18,6 +18,7 @@ namespace NzbDrone.Core.Download
{
void Check(TrackedDownload trackedDownload);
void Import(TrackedDownload trackedDownload);
bool VerifyImport(TrackedDownload trackedDownload, List<ImportResult> importResults);
}
public class CompletedDownloadService : ICompletedDownloadService

@ -4,6 +4,7 @@ using System.Linq;
using NLog;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Download;
using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.MediaFiles.BookImport;
using NzbDrone.Core.MediaFiles.Commands;
@ -16,16 +17,19 @@ namespace NzbDrone.Core.MediaFiles
private readonly IDownloadedBooksImportService _downloadedTracksImportService;
private readonly ITrackedDownloadService _trackedDownloadService;
private readonly IDiskProvider _diskProvider;
private readonly ICompletedDownloadService _completedDownloadService;
private readonly Logger _logger;
public DownloadedBooksCommandService(IDownloadedBooksImportService downloadedTracksImportService,
ITrackedDownloadService trackedDownloadService,
IDiskProvider diskProvider,
ICompletedDownloadService completedDownloadService,
Logger logger)
{
_downloadedTracksImportService = downloadedTracksImportService;
_trackedDownloadService = trackedDownloadService;
_diskProvider = diskProvider;
_completedDownloadService = completedDownloadService;
_logger = logger;
}
@ -45,14 +49,14 @@ namespace NzbDrone.Core.MediaFiles
{
_logger.Debug("External directory scan request for known download {0}. [{1}]", message.DownloadClientId, message.Path);
return _downloadedTracksImportService.ProcessPath(message.Path, message.ImportMode, trackedDownload.RemoteBook.Author, trackedDownload.DownloadItem);
}
else
{
_logger.Warn("External directory scan request for unknown download {0}, attempting normal import. [{1}]", message.DownloadClientId, message.Path);
var importResults = _downloadedTracksImportService.ProcessPath(message.Path, message.ImportMode, trackedDownload.RemoteBook.Author, trackedDownload.DownloadItem);
return _downloadedTracksImportService.ProcessPath(message.Path, message.ImportMode);
_completedDownloadService.VerifyImport(trackedDownload, importResults);
return importResults;
}
_logger.Warn("External directory scan request for unknown download {0}, attempting normal import. [{1}]", message.DownloadClientId, message.Path);
}
return _downloadedTracksImportService.ProcessPath(message.Path, message.ImportMode);

Loading…
Cancel
Save