From 41fc244bdad8dad9ae4cb4cfee0a22d234d69535 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 2 Aug 2020 02:02:46 -0400 Subject: [PATCH] Don't even call update if list cleaning disabled --- .../NetImportSearchServiceFixture.cs | 2 +- .../NetImport/NetImportSearchService.cs | 60 ++++++++++--------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/NzbDrone.Core.Test/NetImport/NetImportSearchServiceFixture.cs b/src/NzbDrone.Core.Test/NetImport/NetImportSearchServiceFixture.cs index 9feb8cd16..dd89aee1c 100644 --- a/src/NzbDrone.Core.Test/NetImport/NetImportSearchServiceFixture.cs +++ b/src/NzbDrone.Core.Test/NetImport/NetImportSearchServiceFixture.cs @@ -116,7 +116,7 @@ namespace NzbDrone.Core.Test.NetImport .Verify(v => v.GetAllMovies(), Times.Never()); Mocker.GetMock() - .Verify(v => v.UpdateMovie(new List(), true), Times.Once()); + .Verify(v => v.UpdateMovie(new List(), true), Times.Never()); } [Test] diff --git a/src/NzbDrone.Core/NetImport/NetImportSearchService.cs b/src/NzbDrone.Core/NetImport/NetImportSearchService.cs index ba5a48d3b..8bf9c3ae4 100644 --- a/src/NzbDrone.Core/NetImport/NetImportSearchService.cs +++ b/src/NzbDrone.Core/NetImport/NetImportSearchService.cs @@ -161,38 +161,40 @@ namespace NzbDrone.Core.NetImport { var moviesToUpdate = new List(); - if (_configService.ListSyncLevel != "disabled") + if (_configService.ListSyncLevel == "disabled") { - var moviesInLibrary = _movieService.GetAllMovies(); - foreach (var movie in moviesInLibrary) - { - var movieExists = movies.Any(c => c.TmdbId == movie.TmdbId || c.ImdbId == movie.ImdbId); + return; + } + + var moviesInLibrary = _movieService.GetAllMovies(); + foreach (var movie in moviesInLibrary) + { + var movieExists = movies.Any(c => c.TmdbId == movie.TmdbId || c.ImdbId == movie.ImdbId); - if (!movieExists) + if (!movieExists) + { + switch (_configService.ListSyncLevel) { - switch (_configService.ListSyncLevel) - { - case "logOnly": - _logger.Info("{0} was in your library, but not found in your lists --> You might want to unmonitor or remove it", movie); - break; - case "keepAndUnmonitor": - _logger.Info("{0} was in your library, but not found in your lists --> Keeping in library but Unmonitoring it", movie); - movie.Monitored = false; - moviesToUpdate.Add(movie); - break; - case "removeAndKeep": - _logger.Info("{0} was in your library, but not found in your lists --> Removing from library (keeping files)", movie); - _movieService.DeleteMovie(movie.Id, false); - break; - case "removeAndDelete": - _logger.Info("{0} was in your library, but not found in your lists --> Removing from library and deleting files", movie); - _movieService.DeleteMovie(movie.Id, true); - - //TODO: for some reason the files are not deleted in this case... any idea why? - break; - default: - break; - } + case "logOnly": + _logger.Info("{0} was in your library, but not found in your lists --> You might want to unmonitor or remove it", movie); + break; + case "keepAndUnmonitor": + _logger.Info("{0} was in your library, but not found in your lists --> Keeping in library but Unmonitoring it", movie); + movie.Monitored = false; + moviesToUpdate.Add(movie); + break; + case "removeAndKeep": + _logger.Info("{0} was in your library, but not found in your lists --> Removing from library (keeping files)", movie); + _movieService.DeleteMovie(movie.Id, false); + break; + case "removeAndDelete": + _logger.Info("{0} was in your library, but not found in your lists --> Removing from library and deleting files", movie); + _movieService.DeleteMovie(movie.Id, true); + + //TODO: for some reason the files are not deleted in this case... any idea why? + break; + default: + break; } } }