Report size to trackers

This commit is contained in:
Igor Katson 2024-03-01 07:54:27 +00:00
parent 5488e1d40f
commit a6ebecee97
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
8 changed files with 183 additions and 42 deletions

View file

@ -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;