mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
Fix embedded subtitles taking priority over external ones
This commit is contained in:
parent
2e7418142a
commit
95988ce33d
@ -57,14 +57,18 @@ namespace Emby.Server.Implementations.Library
|
|||||||
{
|
{
|
||||||
// Prefer embedded metadata over smart logic
|
// Prefer embedded metadata over smart logic
|
||||||
|
|
||||||
stream = streams.FirstOrDefault(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase)) ??
|
stream = streams.FirstOrDefault(s => s.IsExternal && s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase)) ??
|
||||||
streams.FirstOrDefault(s => s.IsForced) ??
|
streams.FirstOrDefault(s => s.IsExternal && s.IsForced) ??
|
||||||
streams.FirstOrDefault(s => s.IsDefault);
|
streams.FirstOrDefault(s => s.IsExternal && s.IsDefault) ??
|
||||||
|
streams.FirstOrDefault(s => s.IsExternal) ??
|
||||||
|
streams.FirstOrDefault(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase)) ??
|
||||||
|
streams.FirstOrDefault(s => s.IsForced) ??
|
||||||
|
streams.FirstOrDefault(s => s.IsDefault);
|
||||||
|
|
||||||
// if the audio language is not understood by the user, load their preferred subs, if there are any
|
// if the audio language is not understood by the user, load their preferred subs, if there are any
|
||||||
if (stream == null && !preferredLanguages.Contains(audioTrackLanguage, StringComparer.OrdinalIgnoreCase))
|
if (stream == null && !preferredLanguages.Contains(audioTrackLanguage, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
stream = streams.Where(s => !s.IsForced).FirstOrDefault(s => preferredLanguages.Contains(s.Language, StringComparer.OrdinalIgnoreCase));
|
stream = streams.FirstOrDefault(s => !s.IsForced && preferredLanguages.Contains(s.Language, StringComparer.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (mode == SubtitlePlaybackMode.Smart)
|
else if (mode == SubtitlePlaybackMode.Smart)
|
||||||
@ -74,24 +78,30 @@ namespace Emby.Server.Implementations.Library
|
|||||||
// if the audio language is not understood by the user, load their preferred subs, if there are any
|
// if the audio language is not understood by the user, load their preferred subs, if there are any
|
||||||
if (!preferredLanguages.Contains(audioTrackLanguage, StringComparer.OrdinalIgnoreCase))
|
if (!preferredLanguages.Contains(audioTrackLanguage, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
stream = streams.Where(s => !s.IsForced).FirstOrDefault(s => preferredLanguages.Contains(s.Language, StringComparer.OrdinalIgnoreCase)) ??
|
stream = streams.FirstOrDefault(s => s.IsExternal && !s.IsForced && preferredLanguages.Contains(s.Language, StringComparer.OrdinalIgnoreCase)) ??
|
||||||
streams.FirstOrDefault(s => preferredLanguages.Contains(s.Language, StringComparer.OrdinalIgnoreCase));
|
streams.FirstOrDefault(s => s.IsExternal && preferredLanguages.Contains(s.Language, StringComparer.OrdinalIgnoreCase)) ??
|
||||||
|
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)
|
else if (mode == SubtitlePlaybackMode.Always)
|
||||||
{
|
{
|
||||||
// always load the most suitable full subtitles
|
// always load the most suitable full subtitles
|
||||||
stream = streams.FirstOrDefault(s => !s.IsForced);
|
stream = streams.FirstOrDefault(s => s.IsExternal && !s.IsForced) ??
|
||||||
|
streams.FirstOrDefault(s => !s.IsForced);
|
||||||
}
|
}
|
||||||
else if (mode == SubtitlePlaybackMode.OnlyForced)
|
else if (mode == SubtitlePlaybackMode.OnlyForced)
|
||||||
{
|
{
|
||||||
// always load the most suitable full subtitles
|
// always load the most suitable full subtitles
|
||||||
stream = streams.FirstOrDefault(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase)) ??
|
stream = streams.FirstOrDefault(s => s.IsExternal && s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase)) ??
|
||||||
streams.FirstOrDefault(s => s.IsForced);
|
streams.FirstOrDefault(s => s.IsExternal && s.IsForced) ??
|
||||||
|
streams.FirstOrDefault(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase)) ??
|
||||||
|
streams.FirstOrDefault(s => s.IsForced);
|
||||||
}
|
}
|
||||||
|
|
||||||
// load forced subs if we have found no suitable full subtitles
|
// load forced subs if we have found no suitable full subtitles
|
||||||
stream ??= streams.FirstOrDefault(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase));
|
stream ??= streams.FirstOrDefault(s => s.IsExternal && s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase)) ??
|
||||||
|
streams.FirstOrDefault(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (stream != null)
|
if (stream != null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user