Don't even call update if list cleaning disabled

pull/4802/head
Qstick 4 years ago
parent 0bb5dfc3d2
commit 41fc244bda

@ -116,7 +116,7 @@ namespace NzbDrone.Core.Test.NetImport
.Verify(v => v.GetAllMovies(), Times.Never()); .Verify(v => v.GetAllMovies(), Times.Never());
Mocker.GetMock<IMovieService>() Mocker.GetMock<IMovieService>()
.Verify(v => v.UpdateMovie(new List<Movie>(), true), Times.Once()); .Verify(v => v.UpdateMovie(new List<Movie>(), true), Times.Never());
} }
[Test] [Test]

@ -161,38 +161,40 @@ namespace NzbDrone.Core.NetImport
{ {
var moviesToUpdate = new List<Movie>(); var moviesToUpdate = new List<Movie>();
if (_configService.ListSyncLevel != "disabled") if (_configService.ListSyncLevel == "disabled")
{ {
var moviesInLibrary = _movieService.GetAllMovies(); return;
foreach (var movie in moviesInLibrary) }
{
var movieExists = movies.Any(c => c.TmdbId == movie.TmdbId || c.ImdbId == movie.ImdbId); 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);
case "logOnly": break;
_logger.Info("{0} was in your library, but not found in your lists --> You might want to unmonitor or remove it", movie); case "keepAndUnmonitor":
break; _logger.Info("{0} was in your library, but not found in your lists --> Keeping in library but Unmonitoring it", movie);
case "keepAndUnmonitor": movie.Monitored = false;
_logger.Info("{0} was in your library, but not found in your lists --> Keeping in library but Unmonitoring it", movie); moviesToUpdate.Add(movie);
movie.Monitored = false; break;
moviesToUpdate.Add(movie); case "removeAndKeep":
break; _logger.Info("{0} was in your library, but not found in your lists --> Removing from library (keeping files)", movie);
case "removeAndKeep": _movieService.DeleteMovie(movie.Id, false);
_logger.Info("{0} was in your library, but not found in your lists --> Removing from library (keeping files)", movie); break;
_movieService.DeleteMovie(movie.Id, false); case "removeAndDelete":
break; _logger.Info("{0} was in your library, but not found in your lists --> Removing from library and deleting files", movie);
case "removeAndDelete": _movieService.DeleteMovie(movie.Id, true);
_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;
//TODO: for some reason the files are not deleted in this case... any idea why? default:
break; break;
default:
break;
}
} }
} }
} }

Loading…
Cancel
Save