Polish smart subtitle selection logic

This commit is contained in:
jgriff6 2022-10-07 14:17:20 +01:00
parent b9abc004a7
commit fbeec04da7

View File

@ -56,9 +56,6 @@ namespace Emby.Server.Implementations.Library
}
else if (mode == SubtitlePlaybackMode.Smart)
{
// Respect forced flag.
stream = sortedStreams.FirstOrDefault(x => x.IsForced);
// Only attempt to load subtitles if the audio language is not one of the user's preferred subtitle languages.
// If no subtitles of preferred language available, use default behaviour.
if (!preferredLanguages.Contains(audioTrackLanguage, StringComparison.OrdinalIgnoreCase))
@ -66,6 +63,11 @@ namespace Emby.Server.Implementations.Library
stream = sortedStreams.FirstOrDefault(x => preferredLanguages.Contains(x.Language, StringComparison.OrdinalIgnoreCase)) ??
sortedStreams.FirstOrDefault(x => x.IsExternal || x.IsForced || x.IsDefault);
}
else
{
// Respect forced flag.
stream = sortedStreams.FirstOrDefault(x => x.IsForced);
}
}
else if (mode == SubtitlePlaybackMode.Always)
{