mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Only include one CC subtitle
This commit is contained in:
parent
590242712b
commit
a98e31f959
1 changed files with 14 additions and 17 deletions
|
|
@ -501,24 +501,21 @@ async fn get_format(
|
||||||
.subtitle
|
.subtitle
|
||||||
.iter()
|
.iter()
|
||||||
.flat_map(|s| {
|
.flat_map(|s| {
|
||||||
let subtitles = stream
|
let mut subtitles = vec![];
|
||||||
.subtitles
|
if let Some(caption) = stream.captions.get(s) {
|
||||||
.get(s)
|
subtitles.push((caption.clone(), true))
|
||||||
.cloned()
|
}
|
||||||
// the subtitle is probably cc if the audio is not japanese or only one
|
if let Some(subtitle) = stream.subtitles.get(s) {
|
||||||
// subtitle exists for this stream
|
// the subtitle is probably cc if the audio is not japanese or only one subtitle
|
||||||
.map(|l| {
|
// exists for this stream
|
||||||
(
|
let cc = single_format.audio != Locale::ja_JP && stream.subtitles.len() == 1;
|
||||||
l,
|
// only include the subtitles if no cc subtitle is already present or if it's
|
||||||
single_format.audio != Locale::ja_JP && stream.subtitles.len() == 1,
|
// not cc
|
||||||
)
|
if subtitles.is_empty() || !cc {
|
||||||
});
|
subtitles.push((subtitle.clone(), cc))
|
||||||
let cc = stream.captions.get(s).cloned().map(|l| (l, true));
|
}
|
||||||
|
}
|
||||||
subtitles
|
subtitles
|
||||||
.into_iter()
|
|
||||||
.chain(cc.into_iter())
|
|
||||||
.collect::<Vec<(Subtitle, bool)>>()
|
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue