mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
Add --threads (-t) option to downloading commands (#256)
* Add `single-threaded` option to downloading commands * Replace `--single-threaded` boolean option with `--threads` optional `usize` option * Simplify `threads` field unwrapping * Make `--threads` `usize` with a default value
This commit is contained in:
parent
13335c020b
commit
bbb5a78765
3 changed files with 166 additions and 149 deletions
|
|
@ -80,6 +80,10 @@ pub struct Download {
|
|||
#[arg(long, default_value_t = false)]
|
||||
pub(crate) force_hardsub: bool,
|
||||
|
||||
#[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)]
|
||||
pub(crate) urls: Vec<String>,
|
||||
|
|
@ -149,7 +153,8 @@ impl Execute for Download {
|
|||
} else {
|
||||
None
|
||||
})
|
||||
.ffmpeg_preset(self.ffmpeg_preset.clone().unwrap_or_default());
|
||||
.ffmpeg_preset(self.ffmpeg_preset.clone().unwrap_or_default())
|
||||
.threads(self.threads);
|
||||
|
||||
for mut single_formats in single_format_collection.into_iter() {
|
||||
// the vec contains always only one item
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue