Report size to trackers
This commit is contained in:
parent
5488e1d40f
commit
a6ebecee97
8 changed files with 183 additions and 42 deletions
|
|
@ -8,7 +8,7 @@ use librqbit::{
|
|||
http_api_client, librqbit_spawn,
|
||||
tracing_subscriber_config_utils::{init_logging, InitLoggingOptions},
|
||||
AddTorrent, AddTorrentOptions, AddTorrentResponse, Api, ListOnlyResponse,
|
||||
PeerConnectionOptions, Session, SessionOptions,
|
||||
PeerConnectionOptions, Session, SessionOptions, TorrentStatsState,
|
||||
};
|
||||
use size_format::SizeFormatterBinary as SF;
|
||||
use tracing::{error, error_span, info, trace_span, warn};
|
||||
|
|
@ -277,7 +277,7 @@ async fn async_main(opts: Opts) -> anyhow::Result<()> {
|
|||
session.with_torrents(|torrents| {
|
||||
for (idx, torrent) in torrents {
|
||||
let stats = torrent.stats();
|
||||
if stats.state == "initializing" {
|
||||
if let TorrentStatsState::Initializing = stats.state {
|
||||
let total = stats.total_bytes;
|
||||
let progress = stats.progress_bytes;
|
||||
let pct = (progress as f64 / total as f64) * 100f64;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue