From 0bc61bea38a26cf8b69feb7bf831916e7ed56517 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sat, 3 Feb 2018 16:44:35 +0100 Subject: [PATCH] Fixed: Movies not getting unmonitored when folder gets deleted. Fixes #1191, Fixes #1590 --- src/NzbDrone.Core/MediaFiles/DiskScanService.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs index 471b6ebb8..a4a326ad7 100644 --- a/src/NzbDrone.Core/MediaFiles/DiskScanService.cs +++ b/src/NzbDrone.Core/MediaFiles/DiskScanService.cs @@ -161,15 +161,9 @@ public void Scan(Movie movie) if (!_diskProvider.FolderExists(movie.Path)) { - if (_configService.CreateEmptySeriesFolders && - _diskProvider.FolderExists(rootFolder)) - { - _logger.Debug("Creating missing movies folder: {0}", movie.Path); - _diskProvider.CreateFolder(movie.Path); - SetPermissions(movie.Path); - } - else + if (movie.MovieFileId != 0) { + //Since there is no folder, there can't be any files right? // Delete Movie from MovieFiles _movieFileRepository.Delete(movie.MovieFileId); @@ -179,6 +173,13 @@ public void Scan(Movie movie) _logger.Debug("Movies folder doesn't exist: {0}", movie.Path); } + else if (_configService.CreateEmptySeriesFolders && + _diskProvider.FolderExists(rootFolder)) + { + _logger.Debug("Creating missing movies folder: {0}", movie.Path); + _diskProvider.CreateFolder(movie.Path); + SetPermissions(movie.Path); + } _eventAggregator.PublishEvent(new MovieScanSkippedEvent(movie, MovieScanSkippedReason.MovieFolderDoesNotExist)); return;