Fix video containing hardsub if not requested (#415)

This commit is contained in:
bytedream 2024-05-14 21:22:23 +02:00
parent 48bb7a5ef6
commit 817963af4f
2 changed files with 18 additions and 26 deletions

View file

@ -384,12 +384,20 @@ async fn get_format(
let subtitle = if contains_hardsub {
None
} else if let Some(subtitle_locale) = &download.subtitle {
stream
.subtitles
.get(subtitle_locale)
.cloned()
// use closed captions as fallback if no actual subtitles are found
.or_else(|| stream.captions.get(subtitle_locale).cloned())
if download.audio == Locale::ja_JP {
stream
.subtitles
.get(subtitle_locale)
// use closed captions as fallback if no actual subtitles are found
.or_else(|| stream.captions.get(subtitle_locale))
.cloned()
} else {
stream
.captions
.get(subtitle_locale)
.or_else(|| stream.subtitles.get(subtitle_locale))
.cloned()
}
} else {
None
};