aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Extensions
diff options
context:
space:
mode:
authorredinsch <redinsch@gmx.de>2026-03-08 11:29:54 +0100
committerredinsch <redinsch@gmx.de>2026-03-08 11:29:54 +0100
commitebb6949ea75bd2f9953c9e1c7708442fa93197fb (patch)
treee40fa7b27ba22d6ec504b3dc6379478b81913413 /MediaBrowser.Model/Extensions
parent0ebf6a6db6dbd3d3148c8075427de0516b274537 (diff)
Fix remote image language priority to prefer English over no-language
Previously, images with no language were ranked higher (score 3) than English images (score 2), causing poorly rated languageless images to be selected over well-rated English alternatives for posters and logos. Swap the priority so English is preferred over no-language images. Backdrop images are unaffected as they have their own dedicated sorting. Add unit tests for OrderByLanguageDescending. Fixes #13310
Diffstat (limited to 'MediaBrowser.Model/Extensions')
-rw-r--r--MediaBrowser.Model/Extensions/EnumerableExtensions.cs8
1 files changed, 4 insertions, 4 deletions
diff --git a/MediaBrowser.Model/Extensions/EnumerableExtensions.cs b/MediaBrowser.Model/Extensions/EnumerableExtensions.cs
index 94f425229..7c9ee18ca 100644
--- a/MediaBrowser.Model/Extensions/EnumerableExtensions.cs
+++ b/MediaBrowser.Model/Extensions/EnumerableExtensions.cs
@@ -11,7 +11,7 @@ namespace MediaBrowser.Model.Extensions
public static class EnumerableExtensions
{
/// <summary>
- /// Orders <see cref="RemoteImageInfo"/> by requested language in descending order, prioritizing "en" over other non-matches.
+ /// Orders <see cref="RemoteImageInfo"/> by requested language in descending order, then "en", then no language, over other non-matches.
/// </summary>
/// <param name="remoteImageInfos">The remote image infos.</param>
/// <param name="requestedLanguage">The requested language for the images.</param>
@@ -28,9 +28,9 @@ namespace MediaBrowser.Model.Extensions
{
// Image priority ordering:
// - Images that match the requested language
- // - Images with no language
// - TODO: Images that match the original language
// - Images in English
+ // - Images with no language
// - Images that don't match the requested language
if (string.Equals(requestedLanguage, i.Language, StringComparison.OrdinalIgnoreCase))
@@ -38,12 +38,12 @@ namespace MediaBrowser.Model.Extensions
return 4;
}
- if (string.IsNullOrEmpty(i.Language))
+ if (string.Equals(i.Language, "en", StringComparison.OrdinalIgnoreCase))
{
return 3;
}
- if (string.Equals(i.Language, "en", StringComparison.OrdinalIgnoreCase))
+ if (string.IsNullOrEmpty(i.Language))
{
return 2;
}