1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-22 07:52:34 +00:00

Test mapping before collections loop

This commit is contained in:
Qstick 2023-09-17 19:44:33 -05:00
parent 207a4b19dc
commit 39d7320a75

View file

@ -150,18 +150,15 @@ private IEnumerable<CollectionResource> MapToResource(List<MovieCollection> coll
{
// Avoid calling for naming spec on every movie in filenamebuilder
var namingConfig = _namingService.GetConfig();
_logger.Trace("Fetching Movies with Collections");
var collectionMovies = _movieMetadataService.GetMoviesWithCollections();
var existingMoviesTmdbIds = _movieService.AllMovieWithCollectionsTmdbIds();
_logger.Trace("Mapping Collections");
MapCoversToLocal(collectionMovies, coverFileInfos);
foreach (var collection in collections)
{
_logger.Trace("Mapping Collection {0}", collection.Title);
var resource = collection.ToResource();
_logger.Trace("Mapping Collection Movies for {0}", collection.Title);
foreach (var movie in collectionMovies.Where(m => m.CollectionTmdbId == collection.TmdbId))
{
var movieResource = movie.ToResource();
@ -175,9 +172,6 @@ private IEnumerable<CollectionResource> MapToResource(List<MovieCollection> coll
resource.Movies.Add(movieResource);
}
_logger.Trace("Mapping Collection Covers for {0}", collection.Title);
MapCoversToLocal(resource.Movies, coverFileInfos);
yield return resource;
}
}
@ -206,7 +200,7 @@ private CollectionResource MapToResource(MovieCollection collection)
return resource;
}
private void MapCoversToLocal(IEnumerable<CollectionMovieResource> movies, Dictionary<string, FileInfo> coverFileInfos)
private void MapCoversToLocal(IEnumerable<MovieMetadata> movies, Dictionary<string, FileInfo> coverFileInfos)
{
_coverMapper.ConvertToLocalUrls(movies.Select(x => Tuple.Create(0, x.Images.AsEnumerable())), coverFileInfos);
}