Avoid db call for naming config on every movie during single collection call

pull/8780/head
Qstick 2 years ago
parent c214a6b67b
commit ae8820178d

@ -162,11 +162,12 @@ namespace Radarr.Api.V3.Collections
{ {
var resource = collection.ToResource(); var resource = collection.ToResource();
var existingMoviesTmdbIds = _movieService.AllMovieWithCollectionsTmdbIds(); var existingMoviesTmdbIds = _movieService.AllMovieWithCollectionsTmdbIds();
var namingConfig = _namingService.GetConfig();
foreach (var movie in _movieMetadataService.GetMoviesByCollectionTmdbId(collection.TmdbId)) foreach (var movie in _movieMetadataService.GetMoviesByCollectionTmdbId(collection.TmdbId))
{ {
var movieResource = movie.ToResource(); var movieResource = movie.ToResource();
movieResource.Folder = _fileNameBuilder.GetMovieFolder(new Movie { MovieMetadata = movie }); movieResource.Folder = _fileNameBuilder.GetMovieFolder(new Movie { MovieMetadata = movie }, namingConfig);
if (!existingMoviesTmdbIds.Contains(movie.TmdbId)) if (!existingMoviesTmdbIds.Contains(movie.TmdbId))
{ {

Loading…
Cancel
Save