mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-29 23:12:39 +01:00
Fixed: Deleted episodes not being unmonitored when series folder has been deleted
Closes #6678
This commit is contained in:
parent
0937ee6fef
commit
6003ca1696
@ -174,10 +174,16 @@ namespace NzbDrone.Core.MediaFiles
|
||||
fileInfoStopwatch.Stop();
|
||||
_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);
|
||||
|
||||
var possibleExtraFiles = new List<string>();
|
||||
|
||||
if (_diskProvider.FolderExists(series.Path))
|
||||
{
|
||||
var extraFiles = GetNonVideoFiles(series.Path);
|
||||
possibleExtraFiles = FilterPaths(series.Path, extraFiles);
|
||||
}
|
||||
|
||||
CompletedScanning(series, possibleExtraFiles);
|
||||
}
|
||||
|
||||
|
@ -129,28 +129,30 @@ namespace NzbDrone.Core.MediaFiles
|
||||
[EventHandleOrder(EventHandleOrder.Last)]
|
||||
public void Handle(EpisodeFileDeletedEvent message)
|
||||
{
|
||||
if (_configService.DeleteEmptyFolders)
|
||||
if (!_configService.DeleteEmptyFolders || message.Reason == DeleteMediaFileReason.MissingFromDisk)
|
||||
{
|
||||
var series = message.EpisodeFile.Series.Value;
|
||||
var seriesPath = series.Path;
|
||||
var folder = message.EpisodeFile.Path.GetParentPath();
|
||||
return;
|
||||
}
|
||||
|
||||
while (seriesPath.IsParentPath(folder))
|
||||
var series = message.EpisodeFile.Series.Value;
|
||||
var seriesPath = series.Path;
|
||||
var folder = message.EpisodeFile.Path.GetParentPath();
|
||||
|
||||
while (seriesPath.IsParentPath(folder))
|
||||
{
|
||||
if (_diskProvider.FolderExists(folder))
|
||||
{
|
||||
if (_diskProvider.FolderExists(folder))
|
||||
{
|
||||
_diskProvider.RemoveEmptySubfolders(folder);
|
||||
}
|
||||
|
||||
folder = folder.GetParentPath();
|
||||
_diskProvider.RemoveEmptySubfolders(folder);
|
||||
}
|
||||
|
||||
_diskProvider.RemoveEmptySubfolders(seriesPath);
|
||||
folder = folder.GetParentPath();
|
||||
}
|
||||
|
||||
if (_diskProvider.FolderEmpty(seriesPath))
|
||||
{
|
||||
_diskProvider.DeleteFolder(seriesPath, true);
|
||||
}
|
||||
_diskProvider.RemoveEmptySubfolders(seriesPath);
|
||||
|
||||
if (_diskProvider.FolderEmpty(seriesPath))
|
||||
{
|
||||
_diskProvider.DeleteFolder(seriesPath, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user