1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-11 20:12:41 +02:00

Don't even call update if list cleaning disabled

This commit is contained in:
Qstick 2020-08-02 02:02:46 -04:00
parent 0bb5dfc3d2
commit 41fc244bda
2 changed files with 31 additions and 29 deletions

View File

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

View File

@ -161,38 +161,40 @@ private void CleanLibrary(List<Movie> movies)
{
var moviesToUpdate = new List<Movie>();
if (_configService.ListSyncLevel != "disabled")
if (_configService.ListSyncLevel == "disabled")
{
var moviesInLibrary = _movieService.GetAllMovies();
foreach (var movie in moviesInLibrary)
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)
{
var movieExists = movies.Any(c => c.TmdbId == movie.TmdbId || c.ImdbId == movie.ImdbId);
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);
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;
}
//TODO: for some reason the files are not deleted in this case... any idea why?
break;
default:
break;
}
}
}