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

This commit is contained in:
Qstick 2023-07-09 23:05:59 -05:00
parent c214a6b67b
commit ae8820178d
1 changed files with 2 additions and 1 deletions

View File

@ -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))
{ {