diff --git a/src/Radarr.Api.V3/Movies/MovieController.cs b/src/Radarr.Api.V3/Movies/MovieController.cs index 8905e5eea..0bd19f6e1 100644 --- a/src/Radarr.Api.V3/Movies/MovieController.cs +++ b/src/Radarr.Api.V3/Movies/MovieController.cs @@ -110,31 +110,34 @@ public MovieController(IBroadcastSignalRMessage signalRBroadcaster, } [HttpGet] - public List AllMovie(int? tmdbId, bool excludeLocalCovers = false) + public List AllMovie(int? tmdbId, bool excludeLocalCovers = false, int? languageId = null) { var moviesResources = new List(); Dictionary coverFileInfos = null; + var translationLanguage = languageId is > 0 + ? Language.All.Single(l => l.Id == languageId.Value) + : (Language)_configService.MovieInfoLanguage; + if (tmdbId.HasValue) { var movie = _moviesService.FindByTmdbId(tmdbId.Value); if (movie != null) { - moviesResources.AddIfNotNull(MapToResource(movie)); + moviesResources.AddIfNotNull(MapToResource(movie, translationLanguage)); } } else { var movieStats = _movieStatisticsService.MovieStatistics(); - var configLanguage = (Language)_configService.MovieInfoLanguage; var availDelay = _configService.AvailabilityDelay; var movieTask = Task.Run(() => _moviesService.GetAllMovies()); var translations = _movieTranslationService - .GetAllTranslationsForLanguage(configLanguage); + .GetAllTranslationsForLanguage(translationLanguage); var tdict = translations.ToDictionary(x => x.MovieMetadataId); var sdict = movieStats.ToDictionary(x => x.MovieId); @@ -150,7 +153,7 @@ public List AllMovie(int? tmdbId, bool excludeLocalCovers = false foreach (var movie in movies) { - var translation = GetTranslationFromDict(tdict, movie.MovieMetadata, configLanguage); + var translation = GetTranslationFromDict(tdict, movie.MovieMetadata, translationLanguage); moviesResources.Add(movie.ToResource(availDelay, translation, _qualityUpgradableSpecification)); } @@ -176,17 +179,18 @@ protected override MovieResource GetResourceById(int id) return MapToResource(movie); } - protected MovieResource MapToResource(Movie movie) + protected MovieResource MapToResource(Movie movie, Language translationLanguage = null) { if (movie == null) { return null; } + translationLanguage ??= (Language)_configService.MovieInfoLanguage; var availDelay = _configService.AvailabilityDelay; var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId); - var translation = GetMovieTranslation(translations, movie.MovieMetadata, (Language)_configService.MovieInfoLanguage); + var translation = GetMovieTranslation(translations, movie.MovieMetadata, translationLanguage); var resource = movie.ToResource(availDelay, translation, _qualityUpgradableSpecification); MapCoversToLocal(resource);