Fixed: Deleted episodes not being unmonitored when series folder has been deleted

Closes #6678
pull/6676/head
Mark McDowall 8 months ago committed by Mark McDowall
parent 0937ee6fef
commit 6003ca1696

@ -174,10 +174,16 @@ namespace NzbDrone.Core.MediaFiles
fileInfoStopwatch.Stop(); fileInfoStopwatch.Stop();
_logger.Trace("Reprocessing existing files complete for: {0} [{1}]", series, decisionsStopwatch.Elapsed); _logger.Trace("Reprocessing existing files complete for: {0} [{1}]", series, decisionsStopwatch.Elapsed);
var filesOnDisk = GetNonVideoFiles(series.Path);
var possibleExtraFiles = FilterPaths(series.Path, filesOnDisk);
RemoveEmptySeriesFolder(series.Path); RemoveEmptySeriesFolder(series.Path);
var possibleExtraFiles = new List<string>();
if (_diskProvider.FolderExists(series.Path))
{
var extraFiles = GetNonVideoFiles(series.Path);
possibleExtraFiles = FilterPaths(series.Path, extraFiles);
}
CompletedScanning(series, possibleExtraFiles); CompletedScanning(series, possibleExtraFiles);
} }

@ -129,8 +129,11 @@ namespace NzbDrone.Core.MediaFiles
[EventHandleOrder(EventHandleOrder.Last)] [EventHandleOrder(EventHandleOrder.Last)]
public void Handle(EpisodeFileDeletedEvent message) public void Handle(EpisodeFileDeletedEvent message)
{ {
if (_configService.DeleteEmptyFolders) if (!_configService.DeleteEmptyFolders || message.Reason == DeleteMediaFileReason.MissingFromDisk)
{ {
return;
}
var series = message.EpisodeFile.Series.Value; var series = message.EpisodeFile.Series.Value;
var seriesPath = series.Path; var seriesPath = series.Path;
var folder = message.EpisodeFile.Path.GetParentPath(); var folder = message.EpisodeFile.Path.GetParentPath();
@ -153,5 +156,4 @@ namespace NzbDrone.Core.MediaFiles
} }
} }
} }
}
} }

Loading…
Cancel
Save