diff --git a/TODO.md b/TODO.md index 8c0b5f5..9077725 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,5 @@ -- [ ] Selective file downloading (mostly done) - - [ ] Proper counting of how much is left, and how much is downloaded +- [x] Selective file downloading (mostly done) + - [x] Proper counting of how much is left, and how much is downloaded - [x] Send bitfield at the start if I have something - [x] use the "update_hash" function in piece checking diff --git a/crates/librqbit/src/torrent_manager.rs b/crates/librqbit/src/torrent_manager.rs index 310fde7..ae04a48 100644 --- a/crates/librqbit/src/torrent_manager.rs +++ b/crates/librqbit/src/torrent_manager.rs @@ -1225,18 +1225,7 @@ impl TorrentManager { } Ok(response.interval) } - fn get_total(&self) -> u64 { - if let Some(length) = self.inner.torrent.info.length { - return length; - } - self.inner - .torrent - .info - .files - .as_ref() - .map(|files| files.iter().map(|f| f.length).sum()) - .unwrap_or_default() - } + fn get_left_to_download(&self) -> u64 { self.inner.needed - self.get_downloaded() }