Add percentage output

This commit is contained in:
ByteDream 2022-12-28 01:08:19 +01:00
parent 98496a4997
commit 0279b8ecf3

View file

@ -80,14 +80,18 @@ pub async fn download_segments(
let mut buf = response.bytes().await?.to_vec(); let mut buf = response.bytes().await?.to_vec();
buf = VariantSegment::decrypt(buf.borrow_mut(), segment.key)?.to_vec(); buf = VariantSegment::decrypt(buf.borrow_mut(), segment.key)?.to_vec();
let mut c = thread_count.lock().unwrap();
debug!( debug!(
"Downloaded and decrypted segment {} ({})", "Downloaded and decrypted segment [{}/{} {:.2}%] {}",
num + (i * cpus), num + (i * cpus),
total_segments,
((*c + 1) as f64 / total_segments as f64) * 100f64,
segment.url segment.url
); );
thread_sender.send((num + (i * cpus), buf))?; thread_sender.send((num + (i * cpus), buf))?;
*thread_count.lock().unwrap() += 1; *c += 1;
} }
Ok(()) Ok(())