diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-02-10 19:41:44 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-02-10 19:48:28 -0800 |
commit | 41a22ba97e9a06d2d72a53490991acb8d32c20f8 (patch) | |
tree | c84d32acf4920c483ad9c6bc7c4ae5b1e548f8f5 /fatcat-cli/src/main.rs | |
parent | 44fdd4333721ba400bd98d53bfe89897bebe8be5 (diff) | |
download | fatcat-cli-41a22ba97e9a06d2d72a53490991acb8d32c20f8.tar.gz fatcat-cli-41a22ba97e9a06d2d72a53490991acb8d32c20f8.zip |
batch download parallelism
Diffstat (limited to 'fatcat-cli/src/main.rs')
-rw-r--r-- | fatcat-cli/src/main.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fatcat-cli/src/main.rs b/fatcat-cli/src/main.rs index ced35b4..3b96cce 100644 --- a/fatcat-cli/src/main.rs +++ b/fatcat-cli/src/main.rs @@ -485,6 +485,12 @@ fn run(opt: Opt) -> Result<()> { return Err(anyhow!("output directory doesn't exist")); } } + if jobs == 0 { + return Err(anyhow!("--jobs=0 not implemented")); + } + if jobs > 12 { + return Err(anyhow!("please don't download more than 12 parallel requests")); + } download_batch(input_path, output_dir, limit, jobs)?; } Command::Download { @@ -515,7 +521,7 @@ fn run(opt: Opt) -> Result<()> { resp => Err(anyhow!("{:?}", resp)) .with_context(|| format!("API GET failed: {:?}", ident)), }?; - download_release(&release_entity, output_path) + download_release(&release_entity, output_path, true) } Specifier::File(ident) => { let result = api_client.rt.block_on(api_client.api.get_file( @@ -528,7 +534,7 @@ fn run(opt: Opt) -> Result<()> { resp => Err(anyhow!("{:?}", resp)) .with_context(|| format!("API GET failed: {:?}", ident)), }?; - download_file(&file_entity, &file_entity.specifier(), output_path) + download_file(&file_entity, &file_entity.specifier(), output_path, true) } other => Err(anyhow!("Don't know how to download: {:?}", other)), }?; |