Reimport files imported prematurely during script import

This commit is contained in:
Jendrik Weise 2024-03-26 15:25:23 +01:00 committed by Mark McDowall
parent af5a681ab7
commit 7776ec9955
1 changed files with 6 additions and 2 deletions

View File

@ -23,13 +23,17 @@ namespace NzbDrone.Core.Extras
public virtual ImportExistingExtraFileFilterResult<TExtraFile> FilterAndClean(Series series, List<string> filesOnDisk, List<string> importedFiles, bool keepExistingEntries) public virtual ImportExistingExtraFileFilterResult<TExtraFile> FilterAndClean(Series series, List<string> filesOnDisk, List<string> importedFiles, bool keepExistingEntries)
{ {
var seriesFiles = _extraFileService.GetFilesBySeries(series.Id);
if (keepExistingEntries) 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<TExtraFile>()); return Filter(series, filesOnDisk, importedFiles, new List<TExtraFile>());
} }
var seriesFiles = _extraFileService.GetFilesBySeries(series.Id);
Clean(series, filesOnDisk, importedFiles, seriesFiles); Clean(series, filesOnDisk, importedFiles, seriesFiles);
return Filter(series, filesOnDisk, importedFiles, seriesFiles); return Filter(series, filesOnDisk, importedFiles, seriesFiles);