diff --git a/crunchy-cli-core/src/archive/command.rs b/crunchy-cli-core/src/archive/command.rs index 59746bc..bb4794f 100644 --- a/crunchy-cli-core/src/archive/command.rs +++ b/crunchy-cli-core/src/archive/command.rs @@ -98,9 +98,9 @@ pub struct Archive { #[arg(short, long, default_value_t = false)] pub(crate) yes: bool, - #[arg(help = "Override the number of threads used to download")] - #[arg(short, long)] - pub(crate) threads: Option, + #[arg(help = "The number of threads used to download")] + #[arg(short, long, default_value_t = num_cpus::get())] + pub(crate) threads: usize, #[arg(help = "Crunchyroll series url(s)")] #[arg(required = true)] diff --git a/crunchy-cli-core/src/download/command.rs b/crunchy-cli-core/src/download/command.rs index 04084f5..760bf38 100644 --- a/crunchy-cli-core/src/download/command.rs +++ b/crunchy-cli-core/src/download/command.rs @@ -80,9 +80,9 @@ pub struct Download { #[arg(long, default_value_t = false)] pub(crate) force_hardsub: bool, - #[arg(help = "Override the number of threads used to download")] - #[arg(short, long)] - pub(crate) threads: Option, + #[arg(help = "The number of threads used to download")] + #[arg(short, long, default_value_t = num_cpus::get())] + pub(crate) threads: usize, #[arg(help = "Url(s) to Crunchyroll episodes or series")] #[arg(required = true)] diff --git a/crunchy-cli-core/src/utils/download.rs b/crunchy-cli-core/src/utils/download.rs index cdf0753..ff9f240 100644 --- a/crunchy-cli-core/src/utils/download.rs +++ b/crunchy-cli-core/src/utils/download.rs @@ -50,7 +50,7 @@ pub struct DownloadBuilder { audio_sort: Option>, subtitle_sort: Option>, force_hardsub: bool, - threads: Option, + threads: usize, } impl DownloadBuilder { @@ -62,7 +62,7 @@ impl DownloadBuilder { audio_sort: None, subtitle_sort: None, force_hardsub: false, - threads: None, + threads: num_cpus::get(), } } @@ -102,7 +102,7 @@ pub struct Downloader { subtitle_sort: Option>, force_hardsub: bool, - threads: Option, + threads: usize, formats: Vec, } @@ -575,8 +575,7 @@ impl Downloader { None }; - // If `threads` is specified, use that many CPU cores(?). - let cpus = self.threads.unwrap_or(num_cpus::get()); + let cpus = self.threads; let mut segs: Vec> = Vec::with_capacity(cpus); for _ in 0..cpus { segs.push(vec![])