From f15a6abde0b8d88d3e0fc8e1b5dbd258b328c304 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 26 Jun 2022 20:25:39 -0500 Subject: [PATCH] Fixed: Don't call AddMovies if no movies to add from Collection --- .../Movies/RefreshCollectionService.cs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/NzbDrone.Core/Movies/RefreshCollectionService.cs b/src/NzbDrone.Core/Movies/RefreshCollectionService.cs index b6fef847f..10119c9e1 100644 --- a/src/NzbDrone.Core/Movies/RefreshCollectionService.cs +++ b/src/NzbDrone.Core/Movies/RefreshCollectionService.cs @@ -99,21 +99,25 @@ namespace NzbDrone.Core.Movies { var existingMovies = _movieService.AllMovieTmdbIds(); var collectionMovies = _movieMetadataService.GetMoviesByCollectionTmdbId(collection.TmdbId); + var moviesToAdd = collectionMovies.Where(m => !existingMovies.Contains(m.TmdbId)); - _addMovieService.AddMovies(collectionMovies.Where(m => !existingMovies.Contains(m.TmdbId)).Select(m => new Movie + if (moviesToAdd.Any()) { - TmdbId = m.TmdbId, - Title = m.Title, - ProfileId = collection.QualityProfileId, - RootFolderPath = collection.RootFolderPath, - MinimumAvailability = collection.MinimumAvailability, - AddOptions = new AddMovieOptions + _addMovieService.AddMovies(moviesToAdd.Select(m => new Movie { - SearchForMovie = collection.SearchOnAdd, - AddMethod = AddMovieMethod.Collection - }, - Monitored = true - }).ToList()); + TmdbId = m.TmdbId, + Title = m.Title, + ProfileId = collection.QualityProfileId, + RootFolderPath = collection.RootFolderPath, + MinimumAvailability = collection.MinimumAvailability, + AddOptions = new AddMovieOptions + { + SearchForMovie = collection.SearchOnAdd, + AddMethod = AddMovieMethod.Collection + }, + Monitored = true + }).ToList()); + } } }