Resolve subtitle selection feedback (#6446)

This commit is contained in:
Deathspike 2021-10-26 20:51:35 +02:00
parent b830d38a34
commit 2410b3a3cf

View File

@ -50,7 +50,8 @@ namespace Emby.Server.Implementations.Library
return null;
}
var sortedStreams = GetSortedStreams(streams, MediaStreamType.Subtitle, preferredLanguages)
var sortedStreams = streams
.Where(i => i.Type == MediaStreamType.Subtitle)
.OrderByDescending(x => x.IsExternal)
.ThenByDescending(x => x.IsForced && string.Equals(x.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase))
.ThenByDescending(x => x.IsForced)
@ -73,7 +74,8 @@ namespace Emby.Server.Implementations.Library
// if the audio language is not understood by the user, load their preferred subs, if there are any
if (!preferredLanguages.Contains(audioTrackLanguage, StringComparer.OrdinalIgnoreCase))
{
stream = sortedStreams.FirstOrDefault(s => preferredLanguages.Contains(s.Language, StringComparer.OrdinalIgnoreCase));
stream = streams.FirstOrDefault(s => !s.IsForced && preferredLanguages.Contains(s.Language, StringComparer.OrdinalIgnoreCase)) ??
streams.FirstOrDefault(s => preferredLanguages.Contains(s.Language, StringComparer.OrdinalIgnoreCase));
}
}
else if (mode == SubtitlePlaybackMode.Always)