Fix only files not working properly (#59)
* 1/n fixing only files - tracking stats better * 2/n proper tracking of stats when only certain files selected
This commit is contained in:
parent
50fc7f2f01
commit
325855ba56
8 changed files with 91 additions and 46 deletions
|
|
@ -364,14 +364,20 @@ impl ManagedTorrent {
|
|||
}
|
||||
ManagedTorrentState::Paused(p) => {
|
||||
resp.state = "paused";
|
||||
resp.progress_bytes = p.have_bytes;
|
||||
resp.finished = p.have_bytes == resp.total_bytes;
|
||||
resp.total_bytes = p.chunk_tracker.get_total_selected_bytes();
|
||||
resp.progress_bytes = resp.total_bytes - p.needed_bytes;
|
||||
resp.finished = resp.progress_bytes == resp.total_bytes;
|
||||
}
|
||||
ManagedTorrentState::Live(l) => {
|
||||
resp.state = "live";
|
||||
let live_stats = LiveStats::from(l.as_ref());
|
||||
resp.progress_bytes = live_stats.snapshot.have_bytes;
|
||||
resp.finished = resp.progress_bytes == resp.total_bytes;
|
||||
let total = l.get_total_selected_bytes();
|
||||
let remaining = l.get_left_to_download_bytes();
|
||||
let progress = total - remaining;
|
||||
|
||||
resp.progress_bytes = progress;
|
||||
resp.total_bytes = total;
|
||||
resp.finished = remaining == 0;
|
||||
resp.live = Some(live_stats);
|
||||
}
|
||||
ManagedTorrentState::Error(e) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue