diff --git a/crunchy-cli-core/src/archive/command.rs b/crunchy-cli-core/src/archive/command.rs index 77cf50f..efb54f4 100644 --- a/crunchy-cli-core/src/archive/command.rs +++ b/crunchy-cli-core/src/archive/command.rs @@ -501,15 +501,15 @@ async fn get_format( .subtitles .get(s) .cloned() - // the subtitle is probably not cc if the audio is japanese or more than one + // the subtitle is probably cc if the audio is not japanese or only one // subtitle exists for this stream .map(|l| { ( l, - single_format.audio == Locale::ja_JP || stream.subtitles.len() > 1, + single_format.audio != Locale::ja_JP && stream.subtitles.len() == 1, ) }); - let cc = stream.captions.get(s).cloned().map(|l| (l, false)); + let cc = stream.captions.get(s).cloned().map(|l| (l, true)); subtitles .into_iter() diff --git a/crunchy-cli-core/src/download/command.rs b/crunchy-cli-core/src/download/command.rs index 44c3d65..bb0c1fd 100644 --- a/crunchy-cli-core/src/download/command.rs +++ b/crunchy-cli-core/src/download/command.rs @@ -400,7 +400,7 @@ async fn get_format( subtitles: subtitle.clone().map_or(vec![], |s| { vec![( s, - single_format.audio == Locale::ja_JP || stream.subtitles.len() > 1, + single_format.audio != Locale::ja_JP && stream.subtitles.len() == 1, )] }), metadata: DownloadFormatMetadata { @@ -417,7 +417,7 @@ async fn get_format( subtitle.map_or(vec![], |s| { vec![( s, - single_format.audio == Locale::ja_JP || stream.subtitles.len() > 1, + single_format.audio != Locale::ja_JP && stream.subtitles.len() == 1, )] }), )]); diff --git a/crunchy-cli-core/src/utils/download.rs b/crunchy-cli-core/src/utils/download.rs index cfec7b4..2278bef 100644 --- a/crunchy-cli-core/src/utils/download.rs +++ b/crunchy-cli-core/src/utils/download.rs @@ -232,13 +232,13 @@ impl Downloader { if let Some(subtitle_sort) = &self.subtitle_sort { format .subtitles - .sort_by(|(a_subtitle, a_not_cc), (b_subtitle, b_not_cc)| { + .sort_by(|(a_subtitle, a_cc), (b_subtitle, b_cc)| { let ordering = subtitle_sort .iter() .position(|l| l == &a_subtitle.locale) .cmp(&subtitle_sort.iter().position(|l| l == &b_subtitle.locale)); if matches!(ordering, Ordering::Equal) { - a_not_cc.cmp(b_not_cc).reverse() + a_cc.cmp(b_cc).reverse() } else { ordering } @@ -451,8 +451,8 @@ impl Downloader { None }; - for (j, (subtitle, not_cc)) in format.subtitles.iter().enumerate() { - if !not_cc && self.no_closed_caption { + for (j, (subtitle, cc)) in format.subtitles.iter().enumerate() { + if *cc && self.no_closed_caption { continue; } @@ -462,7 +462,7 @@ impl Downloader { progress_message += ", " } progress_message += &subtitle.locale.to_string(); - if !not_cc { + if *cc { progress_message += " (CC)"; } if i.min(videos.len() - 1) != 0 { @@ -477,12 +477,12 @@ impl Downloader { debug!( "Downloaded {} subtitles{}", subtitle.locale, - (!not_cc).then_some(" (cc)").unwrap_or_default(), + cc.then_some(" (cc)").unwrap_or_default(), ); subtitles.push(FFmpegSubtitleMeta { path, locale: subtitle.locale.clone(), - cc: !not_cc, + cc: *cc, start_time: subtitle_offsets.get(&j).cloned(), video_idx: i, })