From 465e9d145ff9333b187f331984ae79d84ad91da7 Mon Sep 17 00:00:00 2001 From: Josh Archer Date: Sat, 29 Aug 2026 17:43:03 -0400 Subject: [PATCH 1/5] feat(media): extract archived downloads (.zip, .tgz, .tar.gz) during import when no media files are found --- .../DownloadedBooksImportServiceFixture.cs | 59 ++++++++++++++++++- .../DownloadedBooksImportService.cs | 41 ++++++++++++- 2 files changed, 98 insertions(+), 2 deletions(-) diff --git a/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs b/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs index e27557858..5f79000ef 100644 --- a/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs +++ b/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using NLog; using NUnit.Framework; +using NzbDrone.Common; using NzbDrone.Common.Disk; using NzbDrone.Core.Books; using NzbDrone.Core.Books.Services; @@ -189,7 +190,7 @@ private sealed class StubDiskProvider : IDiskProvider public bool FolderWritable(string path) => throw new NotImplementedException(); public bool FolderEmpty(string path) => throw new NotImplementedException(); public IEnumerable GetDirectories(string path) => throw new NotImplementedException(); - public IEnumerable GetFiles(string path, bool recursive) => throw new NotImplementedException(); + public IEnumerable GetFiles(string path, bool recursive) => Directory.Exists(path) ? Directory.GetFiles(path, "*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) : Array.Empty(); public long GetFolderSize(string path) => throw new NotImplementedException(); public void CreateFolder(string path) => throw new NotImplementedException(); public void DeleteFile(string path) => throw new NotImplementedException(); @@ -2638,5 +2639,61 @@ private static Dictionary> CreateAudioTags(string album, st ["TITLE"] = new List { title } }; } + + private sealed class RecordingArchiveService : IArchiveService + { + public List<(string CompressedFile, string Destination)> Extractions { get; } = new(); + + public void Extract(string compressedFile, string destination) + { + Extractions.Add((compressedFile, destination)); + } + + public void CreateZip(string path, IEnumerable files) => throw new NotImplementedException(); + } + + [Test] + public void should_extract_archives_when_folder_has_no_direct_importable_files() + { + var tempDir = Path.Combine(Path.GetTempPath(), "chaptarr-tests", Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(tempDir); + var zipPath = Path.Combine(tempDir, "Book.zip"); + File.WriteAllBytes(zipPath, new byte[] { 1, 2, 3, 4 }); + + var archiveService = new RecordingArchiveService(); + + try + { + var service = new DownloadedBooksImportService( + new StubDiskProvider(), + new StubDiskScanService(), + new StubFileMatchingService(), + new StubMetadataTagService(), + new RecordingImportApprovedBooks(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + new StubAuthorLibraryService(), + new StubRootFolderService(), + ConfigServiceTestProxy.Create(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + LogManager.GetCurrentClassLogger(), + archiveService); + + service.ProcessPath(tempDir, ImportMode.Auto, author: null, downloadClientItem: null); + + Assert.That(archiveService.Extractions, Has.Count.EqualTo(1)); + Assert.That(archiveService.Extractions[0].CompressedFile, Is.EqualTo(zipPath)); + Assert.That(archiveService.Extractions[0].Destination, Is.EqualTo(tempDir)); + } + finally + { + Directory.Delete(tempDir, true); + } + } } } diff --git a/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs b/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs index 123fe68d7..fa1f58aa4 100644 --- a/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Threading.Tasks; using NLog; +using NzbDrone.Common; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.EnvironmentInfo; @@ -52,6 +53,7 @@ public class DownloadedBooksImportService : IDownloadedBooksImportService private readonly IEventAggregator _eventAggregator; private readonly IRuntimeInfo _runtimeInfo; private readonly IMediaInfoExtractor _mediaInfoExtractor; + private readonly IArchiveService _archiveService; private readonly Logger _logger; public DownloadedBooksImportService( @@ -71,7 +73,8 @@ public DownloadedBooksImportService( IEventAggregator eventAggregator, IRuntimeInfo runtimeInfo, IMediaInfoExtractor mediaInfoExtractor, - Logger logger) + Logger logger, + IArchiveService archiveService = null) { _diskProvider = diskProvider; _diskScanService = diskScanService; @@ -90,6 +93,7 @@ public DownloadedBooksImportService( _runtimeInfo = runtimeInfo; _mediaInfoExtractor = mediaInfoExtractor; _logger = logger; + _archiveService = archiveService ?? new ArchiveService(logger); } public List ProcessRootFolder(IDirectoryInfo directoryInfo) @@ -150,6 +154,15 @@ private List ProcessFolder(IDirectoryInfo directoryInfo, ImportMod .Where(f => MediaFileExtensions.AllExtensions.Contains(f.Extension)) .ToList(); + if (!mediaFiles.Any()) + { + ExtractArchivesInFolder(directoryInfo); + visibleFiles = _diskProvider.GetFileInfos(directoryInfo.FullName, true); + mediaFiles = visibleFiles + .Where(f => MediaFileExtensions.AllExtensions.Contains(f.Extension)) + .ToList(); + } + if (!mediaFiles.Any()) { _logger.Debug("[DOWNLOAD-IMPORT] No media files found in: {0}", directoryInfo.FullName); @@ -1411,5 +1424,31 @@ public List ProcessFile(string path, ImportMode importMode = Impor var fileInfo = _diskProvider.GetFileInfo(path); return ProcessFile(fileInfo, importMode, author, downloadClientItem, remoteBook, requireDefaultRootFolderForMissingAuthors: requireDefaultRootFolderForMissingAuthors); } + + private void ExtractArchivesInFolder(IDirectoryInfo directoryInfo) + { + var archives = _diskProvider.GetFiles(directoryInfo.FullName, true) + .Where(IsSupportedArchive) + .ToList(); + + foreach (var archive in archives) + { + try + { + _archiveService.Extract(archive, directoryInfo.FullName); + } + catch (Exception e) + { + _logger.Warn(e, "Failed to extract archive during import: {0}", archive); + } + } + } + + private static bool IsSupportedArchive(string path) + { + return path.EndsWith(".zip", StringComparison.OrdinalIgnoreCase) || + path.EndsWith(".tgz", StringComparison.OrdinalIgnoreCase) || + path.EndsWith(".tar.gz", StringComparison.OrdinalIgnoreCase); + } } } From dc2c402500b0b0d960562aeceeca0471a5f3ce18 Mon Sep 17 00:00:00 2001 From: Josh Archer Date: Sat, 29 Aug 2026 17:43:03 -0400 Subject: [PATCH 2/5] fix(media): handle missing root folder during upgrade import with RootFolderNotFoundException --- .../UpgradeMediaFileServiceFixture.cs | 35 +++++++++++++++++++ .../MediaFiles/UpgradeMediaFileService.cs | 8 +++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/Chaptarr.Core.Test/MediaFiles/UpgradeMediaFileServiceFixture.cs b/src/Chaptarr.Core.Test/MediaFiles/UpgradeMediaFileServiceFixture.cs index 68cf76cf0..c5b894b83 100644 --- a/src/Chaptarr.Core.Test/MediaFiles/UpgradeMediaFileServiceFixture.cs +++ b/src/Chaptarr.Core.Test/MediaFiles/UpgradeMediaFileServiceFixture.cs @@ -1,3 +1,4 @@ +using NzbDrone.Core.MediaFiles.BookImport; using System; using System.Collections.Generic; using System.IO; @@ -108,6 +109,40 @@ protected override object Invoke(MethodInfo targetMethod, object[] args) } } + private class NullRootFolderServiceProxy : DispatchProxy + { + protected override object Invoke(MethodInfo targetMethod, object[] args) + { + if (targetMethod?.Name == nameof(IRootFolderService.GetBestRootFolder)) + { + return null; + } + + throw new NotImplementedException($"Test proxy does not implement IRootFolderService.{targetMethod?.Name}"); + } + } + + [Test] + public void should_throw_root_folder_not_found_when_best_root_folder_cannot_be_resolved() + { + var replacement = new BookFile { Id = 2, Path = "/downloads/Book.m4b" }; + var author = new Author { Id = 1, Path = "/books/Author" }; + var book = new Book { Id = 2, Author = author, BookFiles = new List() }; + var localBook = new LocalBook { Author = author, Book = book, Path = replacement.Path }; + + var subject = new UpgradeMediaFileService( + new RecordingRecycleBinProvider(), + DispatchProxy.Create(), + DispatchProxy.Create>(), + new StubBookFileMover(), + DispatchProxy.Create(), + DispatchProxy.Create(), + DispatchProxy.Create>(), + LogManager.GetCurrentClassLogger()); + + Assert.Throws(() => subject.UpgradeBookFile(replacement, localBook)); + } + [Test] public void should_not_delete_a_loose_path_match_while_replacing_its_stale_row() { diff --git a/src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs b/src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs index 277753f9f..fec213e29 100644 --- a/src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs +++ b/src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs @@ -66,9 +66,13 @@ public BookFileMoveResult UpgradeBookFile(BookFile bookFile, LocalBook localBook } var rootFolder = _rootFolderService.GetBestRootFolder(rootFolderPath); - var isCalibre = rootFolder?.IsCalibreLibrary == true && rootFolder.CalibreSettings != null; + if (rootFolder == null) + { + throw new RootFolderNotFoundException($"Root folder '{rootFolderPath}' was not found."); + } - var settings = rootFolder?.CalibreSettings; + var isCalibre = rootFolder.IsCalibreLibrary && rootFolder.CalibreSettings != null; + var settings = rootFolder.CalibreSettings; // If there are existing book files and the root folder is missing, throw, so the old file isn't left behind during the import process. if (existingFiles != null && existingFiles.Any() && !_diskProvider.FolderExists(rootFolderPath)) From cf8583635bac71a275081d8ab3eebf5750b11abc Mon Sep 17 00:00:00 2001 From: Josh Archer Date: Fri, 16 Oct 2026 10:39:28 -0400 Subject: [PATCH 3/5] fix(media): scope archive extraction to download item and preserve file list when unextracted --- .../DownloadedBooksImportServiceFixture.cs | 98 +++++++++++++++++++ .../DownloadedBooksImportService.cs | 25 +++-- 2 files changed, 114 insertions(+), 9 deletions(-) diff --git a/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs b/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs index 7f1234fad..c81fc9327 100644 --- a/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs +++ b/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs @@ -2848,5 +2848,103 @@ public void should_extract_archives_when_folder_has_no_direct_importable_files() Directory.Delete(tempDir, true); } } + + [Test] + public void should_extract_archive_when_download_client_item_has_scoped_archive_file() + { + var tempDir = Path.Combine(Path.GetTempPath(), "chaptarr-tests", Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(tempDir); + var zipPath = Path.Combine(tempDir, "Book.zip"); + File.WriteAllBytes(zipPath, new byte[] { 1, 2, 3, 4 }); + + var archiveService = new RecordingArchiveService(); + + try + { + var service = new DownloadedBooksImportService( + new StubDiskProvider(), + new StubDiskScanService(), + new StubFileMatchingService(), + new StubMetadataTagService(), + new RecordingImportApprovedBooks(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + new StubAuthorLibraryService(), + new StubRootFolderService(), + ConfigServiceTestProxy.Create(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + LogManager.GetCurrentClassLogger(), + archiveService); + + var downloadClientItem = new DownloadClientItem + { + FilePaths = new List { zipPath } + }; + + service.ProcessPath(tempDir, ImportMode.Auto, author: null, downloadClientItem: downloadClientItem); + + Assert.That(archiveService.Extractions, Has.Count.EqualTo(1)); + Assert.That(archiveService.Extractions[0].CompressedFile, Is.EqualTo(zipPath)); + Assert.That(archiveService.Extractions[0].Destination, Is.EqualTo(tempDir)); + } + finally + { + Directory.Delete(tempDir, true); + } + } + + [Test] + public void should_not_extract_archive_when_download_client_item_scope_excludes_archive() + { + var tempDir = Path.Combine(Path.GetTempPath(), "chaptarr-tests", Guid.NewGuid().ToString("N")); + Directory.CreateDirectory(tempDir); + var zipPath = Path.Combine(tempDir, "Book.zip"); + var nfoPath = Path.Combine(tempDir, "Book.nfo"); + File.WriteAllBytes(zipPath, new byte[] { 1, 2, 3, 4 }); + File.WriteAllBytes(nfoPath, new byte[] { 1, 2, 3, 4 }); + + var archiveService = new RecordingArchiveService(); + + try + { + var service = new DownloadedBooksImportService( + new StubDiskProvider(), + new StubDiskScanService(), + new StubFileMatchingService(), + new StubMetadataTagService(), + new RecordingImportApprovedBooks(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + new StubAuthorLibraryService(), + new StubRootFolderService(), + ConfigServiceTestProxy.Create(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + DispatchProxy.Create>(), + LogManager.GetCurrentClassLogger(), + archiveService); + + var downloadClientItem = new DownloadClientItem + { + FilePaths = new List { nfoPath } + }; + + service.ProcessPath(tempDir, ImportMode.Auto, author: null, downloadClientItem: downloadClientItem); + + Assert.That(archiveService.Extractions, Is.Empty); + } + finally + { + Directory.Delete(tempDir, true); + } + } } } diff --git a/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs b/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs index 8603fcd8f..ecd75de13 100644 --- a/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs @@ -168,11 +168,17 @@ private List ProcessFolder(IDirectoryInfo directoryInfo, ImportMod if (!mediaFiles.Any()) { - ExtractArchivesInFolder(directoryInfo); - visibleFiles = _diskProvider.GetFileInfos(directoryInfo.FullName, true); - mediaFiles = visibleFiles - .Where(f => MediaFileExtensions.AllExtensions.Contains(f.Extension)) - .ToList(); + var archives = fileListScoped + ? visibleFiles.Where(f => IsSupportedArchive(f.FullName)).Select(f => f.FullName).ToList() + : _diskProvider.GetFiles(directoryInfo.FullName, true).Where(IsSupportedArchive).ToList(); + + if (archives.Any() && ExtractArchives(directoryInfo, archives)) + { + visibleFiles = _diskProvider.GetFileInfos(directoryInfo.FullName, true); + mediaFiles = visibleFiles + .Where(f => MediaFileExtensions.AllExtensions.Contains(f.Extension)) + .ToList(); + } } if (!mediaFiles.Any()) @@ -1494,23 +1500,24 @@ public List ProcessFile(string path, ImportMode importMode = Impor return ProcessFile(fileInfo, importMode, author, downloadClientItem, remoteBook, requireDefaultRootFolderForMissingAuthors: requireDefaultRootFolderForMissingAuthors); } - private void ExtractArchivesInFolder(IDirectoryInfo directoryInfo) + private bool ExtractArchives(IDirectoryInfo directoryInfo, IEnumerable archives) { - var archives = _diskProvider.GetFiles(directoryInfo.FullName, true) - .Where(IsSupportedArchive) - .ToList(); + var extractedAny = false; foreach (var archive in archives) { try { _archiveService.Extract(archive, directoryInfo.FullName); + extractedAny = true; } catch (Exception e) { _logger.Warn(e, "Failed to extract archive during import: {0}", archive); } } + + return extractedAny; } private static bool IsSupportedArchive(string path) From 733ced7c6b047ce9806c02ef2c913a302caa5540 Mon Sep 17 00:00:00 2001 From: Josh Archer Date: Sat, 21 Nov 2026 14:49:33 -0500 Subject: [PATCH 4/5] test(media): implement ExtractZip on the recording archive stub IArchiveService gained ExtractZip(string, string, long) on develop, so the test stub added by this branch no longer satisfied the interface. Co-Authored-By: Claude Fable 5.2 --- .../MediaFiles/DownloadedBooksImportServiceFixture.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs b/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs index f4c315c08..e8b8ead21 100644 --- a/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs +++ b/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs @@ -3091,6 +3091,8 @@ public void Extract(string compressedFile, string destination) Extractions.Add((compressedFile, destination)); } + public void ExtractZip(string compressedFile, string destination, long maximumBytes) => throw new NotImplementedException(); + public void CreateZip(string path, IEnumerable files) => throw new NotImplementedException(); } From fd8014a6b6417de63653a6a0b17d030075cd3b0d Mon Sep 17 00:00:00 2001 From: Josh Archer Date: Sat, 21 Nov 2026 15:26:21 -0500 Subject: [PATCH 5/5] fix(media): require the archive service in DownloadedBooksImportService develop's RequiredServiceDependenciesFixture rejects injected interface dependencies that default to null, so the optional archiveService parameter failed CI. Make it a required constructor dependency (resolved from the container like the other IArchiveService consumers) and pass it explicitly at every test construction site. Co-Authored-By: Claude Fable 5.2 --- .../CompletedDownloadWaitingFixture.cs | 2 +- .../AlternativeCopyImportProofFixture.cs | 2 +- .../DownloadedBooksImportServiceFixture.cs | 48 +++++++++---------- ...tionalCopyFixture.AcceptedIncludedMedia.cs | 2 +- ...ooksAdditionalCopyFixture.BonusBoundary.cs | 2 +- ...ooksAdditionalCopyFixture.IncludedMedia.cs | 2 +- .../DownloadedBooksImportService.cs | 4 +- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/Chaptarr.Core.Test/Download/CompletedDownloadWaitingFixture.cs b/src/Chaptarr.Core.Test/Download/CompletedDownloadWaitingFixture.cs index c833d77c4..7bc46e5d8 100644 --- a/src/Chaptarr.Core.Test/Download/CompletedDownloadWaitingFixture.cs +++ b/src/Chaptarr.Core.Test/Download/CompletedDownloadWaitingFixture.cs @@ -570,7 +570,7 @@ private static void Run(bool postgres, int sources, int imported, Action((method, args) => method.Name == "get_IsWindowsService" ? false : throw new InvalidOperationException("Missing-source check attempted " + method.Name)); var importer = new DownloadedBooksImportService(disk, null, null, null, null, null, null, null, null, null, - null, null, history, events, runtime, null, logger, queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + null, null, history, events, runtime, null, logger, queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var snapshots = new DownloadClientFileSnapshotService(new DownloadClientFileSnapshotRepository(database, events), disk, logger); var item = new DownloadClientItem { DownloadId = "waiting", Title = "Dune", Status = DownloadItemStatus.Completed, OutputPath = new OsPath(directory), FilePaths = paths, FileListConfidence = DownloadClientFileListConfidence.Authoritative, diff --git a/src/Chaptarr.Core.Test/MediaFiles/BookImport/AlternativeCopyImportProofFixture.cs b/src/Chaptarr.Core.Test/MediaFiles/BookImport/AlternativeCopyImportProofFixture.cs index a8c9daba7..093797bf2 100644 --- a/src/Chaptarr.Core.Test/MediaFiles/BookImport/AlternativeCopyImportProofFixture.cs +++ b/src/Chaptarr.Core.Test/MediaFiles/BookImport/AlternativeCopyImportProofFixture.cs @@ -211,7 +211,7 @@ DiscoveredFileWithMetadata File(string suffix, string identifiers, string cast, Assert.That(result.MatchedFiles.All(match => match.EditionId == captured[match.BookId]), Is.True); var remote = new RemoteBook { Author = author, Books = new() { a,b }, AlternativeCopies = true, TargetEditionIds = captured, AlternativeCopyGrabDate = DateTime.UtcNow }; var disk = Proxy((method,args) => method.Name == nameof(IDiskProvider.GetFileSize) ? 1L : (object)DateTime.UtcNow); - var importer = new DownloadedBooksImportService(disk,null,matcher,null,null,bookService,authorService,editionService,null,null,null,null,null,events,null,null,logger, queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + var importer = new DownloadedBooksImportService(disk,null,matcher,null,null,bookService,authorService,editionService,null,null,null,null,null,events,null,null,logger, queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var decisionBuilder = typeof(DownloadedBooksImportService).GetMethod("CreateDecisionForMatch", BindingFlags.NonPublic|BindingFlags.Instance); var tagsByPath = files.ToDictionary(file=>file.Path,file=>file.AllTags); var bookCache = new Dictionary(); var authorCache = new Dictionary(); diff --git a/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs b/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs index e8b8ead21..af1bc032d 100644 --- a/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs +++ b/src/Chaptarr.Core.Test/MediaFiles/DownloadedBooksImportServiceFixture.cs @@ -526,7 +526,7 @@ Book Seed(string slug) AlternativeCopies = alternative, AlternativeCopyGrabDate = grabbed, TargetEditionIds = captured }; if (extras == "disabled-unscoped") client.FilePaths = null; var importer = new DownloadedBooksImportService(disk, scan, matching, new StubMetadataTagService(), writer, bookService, authorService, - editionService, null, null, null, config, history, events, null, null, logger, queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + editionService, null, null, null, config, history, events, null, null, logger, queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var results = importer.ProcessPath(source, mode, author, client, remote); TestContext.WriteLine(string.Join("; ", results.SelectMany(result => result.Errors))); var expectedCount = media == BookMediaType.Audiobook ? 3 : 1; @@ -649,7 +649,7 @@ public void should_classify_downloads_without_target_media(string extension, boo DispatchProxy.Create>(), DispatchProxy.Create>(), DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var results = service.ProcessPath(singleFile ? filePath : tempDir, ImportMode.Auto, remoteBook: new RemoteBook { Books = new List { new Book { MediaType = BookMediaType.Audiobook } } }); @@ -710,7 +710,7 @@ public void should_keep_waiting_when_supported_media_is_not_available() Chaptarr.Core.Test.Common.InterfaceProxy.Proxy((method, args) => null), Chaptarr.Core.Test.Common.InterfaceProxy.Proxy((method, args) => false), DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); RejectionType Classify(DownloadClientItem downloadClientItem, string path = null) { @@ -812,7 +812,7 @@ public void should_reject_locked_media_before_matching_a_manually_imported_folde DispatchProxy.Create>(), DispatchProxy.Create>(), DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var result = service.ProcessPath(tempDir, ImportMode.Auto, author: null, downloadClientItem: null).Single(); @@ -948,7 +948,7 @@ public void should_auto_add_suggested_author_and_rematch_during_manual_download_ eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); _ = service.ProcessPath(filePath, ImportMode.Auto, author: null, downloadClientItem: null); @@ -1059,7 +1059,7 @@ public void should_hydrate_matched_book_and_author_once_per_download_import() DispatchProxy.Create>(), DispatchProxy.Create>(), DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); _ = service.ProcessPath(tempDir, ImportMode.Auto, author: null, downloadClientItem: null); @@ -1149,7 +1149,7 @@ public void should_not_auto_add_manual_import_when_strict_default_roots_required DispatchProxy.Create>(), DispatchProxy.Create>(), DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); _ = service.ProcessPath(filePath, ImportMode.Auto, author: null, downloadClientItem: null, requireDefaultRootFolderForMissingAuthors: true); @@ -1239,7 +1239,7 @@ public void should_not_auto_add_suggested_author_for_completed_download_when_dis DispatchProxy.Create>(), DispatchProxy.Create>(), DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); _ = service.ProcessPath(filePath, ImportMode.Auto, author: null, downloadClientItem: new DownloadClientItem { DownloadId = "external-grab" }); @@ -1365,7 +1365,7 @@ public void should_auto_add_completed_download_using_only_compatible_root_when_d DispatchProxy.Create>(), DispatchProxy.Create>(), DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); _ = service.ProcessPath(filePath, ImportMode.Auto, author: null, downloadClientItem: new DownloadClientItem { DownloadId = "external-grab" }); @@ -1466,7 +1466,7 @@ public void should_not_auto_add_completed_download_when_multiple_compatible_root DispatchProxy.Create>(), DispatchProxy.Create>(), DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); _ = service.ProcessPath(filePath, ImportMode.Auto, author: null, downloadClientItem: new DownloadClientItem { DownloadId = "external-grab" }); @@ -1598,7 +1598,7 @@ public void should_auto_add_suggested_author_and_rematch_completed_download_when DispatchProxy.Create>(), DispatchProxy.Create>(), DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); _ = service.ProcessPath(filePath, ImportMode.Auto, author: null, downloadClientItem: new DownloadClientItem { DownloadId = "external-grab" }); @@ -1687,7 +1687,7 @@ public void should_reject_unmatched_files_in_download_import() eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); _ = service.ProcessPath(filePath, ImportMode.Auto, author: null, downloadClientItem: null); @@ -1785,7 +1785,7 @@ public void should_allow_path_fallback_for_single_target_completed_download_fold eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); _ = service.ProcessPath( tempDir, @@ -1896,7 +1896,7 @@ public void should_reject_completed_download_match_that_does_not_belong_to_grabb eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -1993,7 +1993,7 @@ public void should_allow_completed_download_match_when_it_belongs_to_grabbed_tar eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -2129,7 +2129,7 @@ public void should_retarget_same_work_sibling_match_to_grabbed_book_without_clon eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -2240,7 +2240,7 @@ public void should_reject_same_work_sibling_match_when_grabbed_book_has_no_equiv eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -2345,7 +2345,7 @@ public void should_reject_completed_download_when_latest_grabbed_edition_is_stri eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -2456,7 +2456,7 @@ public void should_keep_matcher_edition_when_flexible_book_has_no_embedded_metad eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -2566,7 +2566,7 @@ public void should_allow_flexible_book_to_keep_sibling_match_when_identity_metad eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -2676,7 +2676,7 @@ public void should_not_repair_tracked_multipart_audio_download_when_two_parts_sh eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -2783,7 +2783,7 @@ public void should_not_repair_tracked_multipart_audio_download_when_only_one_see eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -2894,7 +2894,7 @@ public void should_not_absorb_bare_numeric_sibling_title_into_tracked_multipart_ eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { @@ -3005,7 +3005,7 @@ public void should_not_strip_literal_part_word_without_adjacent_number_when_repa eventAggregator, runtimeInfo, DispatchProxy.Create>(), - LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs()); + LogManager.GetCurrentClassLogger(), queueService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.EmptyQueue(), conversionJobService: global::Chaptarr.Core.Test.Common.ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var remoteBook = new RemoteBook { diff --git a/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.AcceptedIncludedMedia.cs b/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.AcceptedIncludedMedia.cs index faab63401..002c14552 100644 --- a/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.AcceptedIncludedMedia.cs +++ b/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.AcceptedIncludedMedia.cs @@ -92,7 +92,7 @@ public void bonus_requires_saved_edition_before_resuming_despite_paused_format_a InterfaceProxy.Proxy((method, _) => { Assert.That(method.Name, Is.EqualTo("GetBooksForLookup")); return new List { book }; }), InterfaceProxy.Proxy((method, _) => { Assert.That(method.Name, Is.EqualTo("GetAuthor")); return author; }), null, null, null, null, null, null, null, null, null, LogManager.GetCurrentClassLogger(), - ImportLifecycleStubs.EmptyQueue(), jobs); + ImportLifecycleStubs.EmptyQueue(), jobs, archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var item = new DownloadClientItem { DownloadId = "bonus-boundary", FilePaths = paths.ToList() }; var remote = new RemoteBook { Author = author, Books = new() { new Book { Id = 4, MediaType = BookMediaType.Ebook, GoodreadsWorkId = "gr:123" } }, ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.EPUB) } }; diff --git a/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.BonusBoundary.cs b/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.BonusBoundary.cs index 712a63613..0a4407408 100644 --- a/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.BonusBoundary.cs +++ b/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.BonusBoundary.cs @@ -188,7 +188,7 @@ private void RunIncludedBoundary(bool cleanupThrows, bool partialRefusal, bool i InterfaceProxy.Proxy((method, _) => { Assert.That(method.Name, Is.EqualTo("GetBooksForLookup")); return new List { book }; }), InterfaceProxy.Proxy((method, _) => { Assert.That(method.Name, Is.EqualTo("GetAuthor")); return author; }), null, null, null, null, null, null, null, null, null, LogManager.GetCurrentClassLogger(), - ImportLifecycleStubs.EmptyQueue(), jobs); + ImportLifecycleStubs.EmptyQueue(), jobs, archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var item = new DownloadClientItem { DownloadId = "bonus-boundary", FilePaths = paths.ToList() }; var remote = new RemoteBook { Author = author, Books = new() { new Book { Id = 4, MediaType = BookMediaType.Audiobook, GoodreadsWorkId = "gr:123" } }, ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.M4B) } }; diff --git a/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.IncludedMedia.cs b/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.IncludedMedia.cs index 09c28f94a..0729d0f2d 100644 --- a/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.IncludedMedia.cs +++ b/src/Chaptarr.Core.Test/MediaFiles/ImportApprovedBooksAdditionalCopyFixture.IncludedMedia.cs @@ -473,7 +473,7 @@ object SaveFiles(object[] args) return queued; }); var importer = new DownloadedBooksImportService(disk, diskScan, matcher, tags, approved, bookService, authorService, editionService, - null, null, null, config, history, events, InterfaceProxy.Proxy((_, _) => false), new StubMediaInfoExtractor(), logger, queueService: queue, conversionJobService: jobs ?? ImportLifecycleStubs.NoConversionJobs()); + null, null, null, config, history, events, InterfaceProxy.Proxy((_, _) => false), new StubMediaInfoExtractor(), logger, queueService: queue, conversionJobService: jobs ?? ImportLifecycleStubs.NoConversionJobs(), archiveService: new global::NzbDrone.Common.ArchiveService(global::NLog.LogManager.GetCurrentClassLogger())); var item = new DownloadClientItem { DownloadId = "MIXED-DOWNLOAD", Title = "Frank Herbert - Dune", OutputPath = new OsPath(source), Status = DownloadItemStatus.Completed, FilePaths = new() { PathFor(requested), PathFor(other) }, DownloadForced = !requestedConversionOnly && !requestedSource, FileListConfidence = DownloadClientFileListConfidence.Authoritative, diff --git a/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs b/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs index d0df621a2..7df9670ec 100644 --- a/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/DownloadedBooksImportService.cs @@ -80,7 +80,7 @@ public DownloadedBooksImportService( Logger logger, NzbDrone.Core.Queue.IQueueService queueService, IConversionJobService conversionJobService, - IArchiveService archiveService = null) + IArchiveService archiveService) { _diskProvider = diskProvider; _diskScanService = diskScanService; @@ -101,7 +101,7 @@ public DownloadedBooksImportService( _logger = logger; _queueService = queueService ?? throw new ArgumentNullException(nameof(queueService)); _conversionJobService = conversionJobService ?? throw new ArgumentNullException(nameof(conversionJobService)); - _archiveService = archiveService ?? new ArchiveService(logger); + _archiveService = archiveService; } public List ProcessRootFolder(IDirectoryInfo directoryInfo)