diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index f44a6d681..c15b7445d 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -18,6 +18,7 @@ namespace NzbDrone.Core.Download { void Check(TrackedDownload trackedDownload); void Import(TrackedDownload trackedDownload); + bool VerifyImport(TrackedDownload trackedDownload, List importResults); } public class CompletedDownloadService : ICompletedDownloadService diff --git a/src/NzbDrone.Core/MediaFiles/DownloadedBooksCommandService.cs b/src/NzbDrone.Core/MediaFiles/DownloadedBooksCommandService.cs index de1df773c..ca22939f5 100644 --- a/src/NzbDrone.Core/MediaFiles/DownloadedBooksCommandService.cs +++ b/src/NzbDrone.Core/MediaFiles/DownloadedBooksCommandService.cs @@ -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);