Update conditions for subtitle to be marked as CC

This commit is contained in:
ByteDream 2023-04-23 15:57:49 +02:00
parent 94fcf1590a
commit 0f73d8dbec
2 changed files with 10 additions and 3 deletions

View file

@ -250,7 +250,14 @@ async fn get_format(
.subtitles .subtitles
.get(s) .get(s)
.cloned() .cloned()
.map(|l| (l, single_format.audio == Locale::ja_JP)) // the subtitle is probably not cc if the audio is japanese or more than one
// subtitle exists for this stream
.map(|l| {
(
l,
single_format.audio == Locale::ja_JP || stream.subtitles.len() > 1,
)
})
}) })
.collect(); .collect();

View file

@ -205,12 +205,12 @@ async fn get_format(
audios: vec![(audio, single_format.audio.clone())], audios: vec![(audio, single_format.audio.clone())],
subtitles: subtitle subtitles: subtitle
.clone() .clone()
.map_or(vec![], |s| vec![(s, single_format.audio == Locale::ja_JP)]), .map_or(vec![], |s| vec![(s, single_format.audio == Locale::ja_JP || stream.subtitles.len() > 1)]),
}; };
let format = Format::from_single_formats(vec![( let format = Format::from_single_formats(vec![(
single_format.clone(), single_format.clone(),
video, video,
subtitle.map_or(vec![], |s| vec![(s, single_format.audio == Locale::ja_JP)]), subtitle.map_or(vec![], |s| vec![(s, single_format.audio == Locale::ja_JP || stream.subtitles.len() > 1)]),
)]); )]);
Ok((download_format, format)) Ok((download_format, format))