From 8613ea80cc9bde3dccfcc1429823aea3cdcec484 Mon Sep 17 00:00:00 2001 From: bytedream Date: Sun, 10 Dec 2023 13:52:33 +0100 Subject: [PATCH] Add forced flag to all CC subtitles (#274) --- crunchy-cli-core/src/utils/download.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crunchy-cli-core/src/utils/download.rs b/crunchy-cli-core/src/utils/download.rs index bdd76f2..5e9bbce 100644 --- a/crunchy-cli-core/src/utils/download.rs +++ b/crunchy-cli-core/src/utils/download.rs @@ -434,12 +434,23 @@ impl Downloader { { command_args.extend([ format!("-disposition:s:s:{}", position), - "forced".to_string(), + "default".to_string(), ]) } } } + // set the 'forced' flag to CC subtitles + for (i, subtitle) in subtitles.iter().enumerate() { + // well, checking if the title contains '(CC)' might not be the best solutions from a + // performance perspective but easier than adjusting the `FFmpegMeta` struct + if !subtitle.title.contains("(CC)") { + continue; + } + + command_args.extend([format!("-disposition:s:s:{}", i), "forced".to_string()]) + } + command_args.extend(output_presets); if let Some(output_format) = self.output_format { command_args.extend(["-f".to_string(), output_format]);