From 7776ec995571a6bc3ff1a35bbede02c05b943063 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 --- 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 c3ae44cba..fdfc7e67e 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(Series series, List filesOnDisk, List importedFiles, bool keepExistingEntries) { + var seriesFiles = _extraFileService.GetFilesBySeries(series.Id); + if (keepExistingEntries) { + var incompleteImports = seriesFiles.IntersectBy(f => Path.Combine(series.Path, f.RelativePath), filesOnDisk, i => i, PathEqualityComparer.Instance).Select(f => f.Id); + + _extraFileService.DeleteMany(incompleteImports); + return Filter(series, filesOnDisk, importedFiles, new List()); } - var seriesFiles = _extraFileService.GetFilesBySeries(series.Id); - Clean(series, filesOnDisk, importedFiles, seriesFiles); return Filter(series, filesOnDisk, importedFiles, seriesFiles);