From b28cb4670ebf08fc2952682da2b1807efa4e939c Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Fri, 7 Apr 2023 17:08:26 +0200 Subject: [PATCH] configurable amount of download threads --- Cargo.toml | 4 ++-- src/lib.rs | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6ed6364..1b487d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "twitch_data" -version = "0.1.6" +version = "0.1.7" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -downloader_config = { git = "https://github.com/OMGeeky/downloader_config" } +downloader_config = { version="0.3.0", git = "https://github.com/OMGeeky/downloader_config" } exponential_backoff = { git = "https://github.com/OMGeeky/exponential_backoff" } diff --git a/src/lib.rs b/src/lib.rs index e13cf29..ca7a789 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -537,7 +537,8 @@ impl<'a> TwitchClient<'a> { url: &String, folder_path: &PathBuf, ) -> Result>> { - let mut amount_of_threads = 100; //TODO: make this configurable (downloader_config) + let config = load_config(); + let mut amount_of_threads: u64 = config.twitch_downloader_thread_count; trace!("downloading all parts of video: {}", url); let base_url = get_base_url(&url); info!("getting parts"); @@ -546,6 +547,7 @@ impl<'a> TwitchClient<'a> { info!("getting parts ...Done"); let amount_of_parts = parts.len(); + let amount_of_parts = amount_of_parts as u64; info!("part count: {}", amount_of_parts); if amount_of_parts < 1 { return Err(DownloadError::new("No parts found").into());