adjust image priorities

pull/702/head
Luke Pulverenti 11 years ago
parent 524150331c
commit d5baaa1f67

@ -90,28 +90,33 @@ namespace MediaBrowser.Providers.Movies
{ {
var language = _config.Configuration.PreferredMetadataLanguage; var language = _config.Configuration.PreferredMetadataLanguage;
var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);
var eligiblePosters = images.posters == null ? var eligiblePosters = images.posters == null ?
new List<MovieDbProvider.Poster>() : new List<MovieDbProvider.Poster>() :
images.posters.Where(i => i.width >= _config.Configuration.MinMoviePosterWidth) images.posters.Where(i => i.width >= _config.Configuration.MinMoviePosterWidth)
.ToList(); .ToList();
return eligiblePosters.OrderByDescending(i => i.vote_average) return eligiblePosters.OrderByDescending(i =>
.ThenByDescending(i =>
{ {
if (string.Equals(language, i.iso_639_1, StringComparison.OrdinalIgnoreCase)) if (string.Equals(language, i.iso_639_1, StringComparison.OrdinalIgnoreCase))
{ {
return 3; return 3;
} }
if (string.Equals("en", i.iso_639_1, StringComparison.OrdinalIgnoreCase)) if (!isLanguageEn)
{ {
return 2; if (string.Equals("en", i.iso_639_1, StringComparison.OrdinalIgnoreCase))
{
return 2;
}
} }
if (string.IsNullOrEmpty(i.iso_639_1)) if (string.IsNullOrEmpty(i.iso_639_1))
{ {
return 1; return isLanguageEn ? 3 : 2;
} }
return 0; return 0;
}) })
.ThenByDescending(i => i.vote_average)
.ToList(); .ToList();
} }

Loading…
Cancel
Save