From 8eebce5171cc1d1f052b67a014a01149dfdcb75d Mon Sep 17 00:00:00 2001 From: dny238 Date: Fri, 20 Jan 2023 18:29:30 -0700 Subject: [PATCH] Fixed: DiskScanService.cs Scan() function now utilizes the 'authorIds' variable in the function call When a list of authorIds is passed into the DiskScanService 'Scan' function, the current code disregards the authorIds array that's passed in and scans the entire folder structure unnecessarily. When new authors are added, it should only scan their folders, not the entire root again as it takes a significant amount of time for large libraries and prevents us from being able to do Part 2 of this change coming next... Part 2, if we correct this step will then enable us to create the missing Authors folder, resulting in a 'fixed' user interface option 'Create empty Author folders' (this currently does nothing). All these changes were in the DiskScanService.cs file alone. Updated the "public void Scan()" function so it respects the 'Author' variable being passed in and populates the folder array correctly. This is required to enable commit ## to fix the 'Create Empty Author Folders' functionality. --- src/NzbDrone.Core/MediaFiles/DiskScanService.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs index 6ec75457c..5cb9ccfae 100644 --- a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs +++ b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs @@ -89,6 +89,19 @@ public void Scan(List folders = null, FilterFilesType filter = FilterFil { authorIds = new List(); } + else + { + folders = new List(); + foreach (var authorId in authorIds) + { + var author = _authorService.GetAuthor(authorId); + + if (author != null) + { + folders.Add(author.Path); + } + } + } var mediaFileList = new List();