From fcb758bf67cc4e99c6cb83e816e208fb6d54699f Mon Sep 17 00:00:00 2001 From: Jendrik Weise Date: Tue, 26 Mar 2024 15:25:23 +0100 Subject: [PATCH] Reimport files imported prematurely during script import (cherry picked from commit 7776ec995571a6bc3ff1a35bbede02c05b943063) --- src/NzbDrone.Core/Extras/ImportExistingExtraFilesBase.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Extras/ImportExistingExtraFilesBase.cs b/src/NzbDrone.Core/Extras/ImportExistingExtraFilesBase.cs index f4683ed1a..c3327a72b 100644 --- a/src/NzbDrone.Core/Extras/ImportExistingExtraFilesBase.cs +++ b/src/NzbDrone.Core/Extras/ImportExistingExtraFilesBase.cs @@ -23,13 +23,17 @@ namespace NzbDrone.Core.Extras public virtual ImportExistingExtraFileFilterResult FilterAndClean(Movie movie, List filesOnDisk, List importedFiles, bool keepExistingEntries) { + var movieFiles = _extraFileService.GetFilesByMovie(movie.Id); + if (keepExistingEntries) { + var incompleteImports = movieFiles.IntersectBy(f => Path.Combine(movie.Path, f.RelativePath), filesOnDisk, i => i, PathEqualityComparer.Instance).Select(f => f.Id); + + _extraFileService.DeleteMany(incompleteImports); + return Filter(movie, filesOnDisk, importedFiles, new List()); } - var movieFiles = _extraFileService.GetFilesByMovie(movie.Id); - Clean(movie, filesOnDisk, importedFiles, movieFiles); return Filter(movie, filesOnDisk, importedFiles, movieFiles);