Fixed: Remove redundant checks from list sync

pull/3606/head
Qstick 5 years ago
parent 12fba024f0
commit 2d15b8b78a

@ -125,12 +125,6 @@ namespace NzbDrone.Core.NetImport
CleanLibrary(listedMovies); CleanLibrary(listedMovies);
} }
listedMovies = listedMovies.Where(x => !_movieService.MovieExists(x)).ToList();
if (listedMovies.Any())
{
_logger.Info($"Found {listedMovies.Count()} movies on your auto enabled lists not in your library");
}
var importExclusions = new List<string>(); var importExclusions = new List<string>();
var moviesToAdd = new List<Movie>(); var moviesToAdd = new List<Movie>();
@ -138,25 +132,32 @@ namespace NzbDrone.Core.NetImport
{ {
var mapped = _movieSearch.MapMovieToTmdbMovie(movie); var mapped = _movieSearch.MapMovieToTmdbMovie(movie);
if (mapped == null) if (mapped != null && mapped.TmdbId > 0)
{
_logger.Debug($"{movie.Title} could not be mapped to a valid tmdb ID, will not be added from list");
}
else if (_exclusionService.IsMovieExcluded(mapped.TmdbId))
{ {
_logger.Debug($"{mapped.Title} ({mapped.TitleSlug}) will not be added since it was found on the exclusions list"); if (_exclusionService.IsMovieExcluded(mapped.TmdbId))
} {
else if (_movieService.MovieExists(mapped)) _logger.Debug($"{mapped.Title} ({mapped.TitleSlug}) will not be added since it was found on the exclusions list");
{ }
_logger.Debug($"{mapped.Title} ({mapped.TitleSlug}) will not be added since it exists in DB"); else if (_movieService.MovieExists(mapped))
} {
else _logger.Trace($"{mapped.Title} ({mapped.TitleSlug}) will not be added since it exists in Library");
{ }
mapped.AddOptions = new AddMovieOptions { SearchForMovie = true }; else
moviesToAdd.Add(mapped); {
if (!moviesToAdd.Any(c => c.TmdbId == mapped.TmdbId))
{
mapped.AddOptions = new AddMovieOptions { SearchForMovie = true };
moviesToAdd.Add(mapped);
}
}
} }
} }
if (moviesToAdd.Any())
{
_logger.Info($"Adding {moviesToAdd.Count()} movies from your auto enabled lists to library");
}
_movieService.AddMovies(moviesToAdd); _movieService.AddMovies(moviesToAdd);
} }

Loading…
Cancel
Save