This commit is contained in:
Igor Katson 2023-11-24 18:28:46 +00:00
parent 0b8580dacd
commit d7a37c1b48
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
11 changed files with 337 additions and 168 deletions

View file

@ -241,7 +241,12 @@ async fn async_main(opts: Opts, spawner: BlockingSpawner) -> anyhow::Result<()>
for (idx, torrent) in torrents {
let live = torrent.with_state(|s| {
match s {
ManagedTorrentState::Initializing(_) => info!("[{}] initializing", idx),
ManagedTorrentState::Initializing(i) => {
let total = torrent.get_total_bytes();
let progress = i.get_checked_bytes();
let pct = (progress as f64 / total as f64) * 100f64;
info!("[{}] initializing {:.2}%", idx, pct)
},
ManagedTorrentState::Live(h) => return Some(h.clone()),
_ => {},
};