mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
Fix image searching to prioritize explicit language match if searching in English (#8946)
This commit is contained in:
parent
d7992bda67
commit
4ee1b78a80
@ -24,24 +24,27 @@ namespace MediaBrowser.Model.Extensions
|
|||||||
requestedLanguage = "en";
|
requestedLanguage = "en";
|
||||||
}
|
}
|
||||||
|
|
||||||
var isRequestedLanguageEn = string.Equals(requestedLanguage, "en", StringComparison.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
return remoteImageInfos.OrderByDescending(i =>
|
return remoteImageInfos.OrderByDescending(i =>
|
||||||
{
|
{
|
||||||
|
// Image priority ordering:
|
||||||
|
// - Images that match the requested language
|
||||||
|
// - Images with no language
|
||||||
|
// - TODO: Images that match the original language
|
||||||
|
// - Images in English
|
||||||
|
// - Images that don't match the requested language
|
||||||
|
|
||||||
if (string.Equals(requestedLanguage, i.Language, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(requestedLanguage, i.Language, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(i.Language))
|
if (string.IsNullOrEmpty(i.Language))
|
||||||
{
|
{
|
||||||
// Assume empty image language is likely to be English.
|
return 3;
|
||||||
return isRequestedLanguageEn ? 3 : 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isRequestedLanguageEn && string.Equals(i.Language, "en", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(i.Language, "en", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
// Prioritize English over non-requested languages.
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user