This commit is contained in:
Ivan Sanz Carasa 2024-04-28 17:52:06 +00:00 committed by GitHub
commit b4bbc10474
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -110,7 +110,7 @@ namespace Radarr.Api.V3.Movies
}
[HttpGet]
public List<MovieResource> AllMovie(int? tmdbId, bool excludeLocalCovers = false)
public List<MovieResource> AllMovie(int? tmdbId, string language, bool excludeLocalCovers = false)
{
var moviesResources = new List<MovieResource>();
@ -128,13 +128,15 @@ namespace Radarr.Api.V3.Movies
else
{
var movieStats = _movieStatisticsService.MovieStatistics();
var configLanguage = (Language)_configService.MovieInfoLanguage;
var translationLanguage = language != null
? Language.All.Single(l => l.Id > 0 && l.Name.Equals(language, StringComparison.InvariantCultureIgnoreCase))
: (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 +152,7 @@ namespace Radarr.Api.V3.Movies
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));
}