add trackerStats and trackerList to torrent-get params

This commit is contained in:
TANIGUCHI Takaki 2023-11-20 16:24:56 +09:00 committed by Aleksandr
parent 04bbbd6f66
commit 07e1080e91
2 changed files with 49 additions and 2 deletions

View File

@ -1,5 +1,5 @@
use enum_iterator::{all, Sequence};
use serde::Serialize;
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
#[derive(Serialize, Debug)]
@ -414,7 +414,7 @@ pub struct TorrentRenamePathArgs {
name: String,
}
#[derive(Serialize, Debug, Clone)]
#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(untagged)]
pub enum Id {
Id(i64),
@ -511,6 +511,8 @@ pub enum TorrentGetField {
TorrentFile,
TotalSize,
Trackers,
TrackerList,
TrackerStats,
UploadRatio,
UploadedEver,
Wanted,
@ -559,6 +561,8 @@ impl TorrentGetField {
TorrentGetField::TorrentFile => "torrentFile",
TorrentGetField::TotalSize => "totalSize",
TorrentGetField::Trackers => "trackers",
TorrentGetField::TrackerList => "trackerList",
TorrentGetField::TrackerStats => "trackerStats",
TorrentGetField::UploadRatio => "uploadRatio",
TorrentGetField::UploadedEver => "uploadedEver",
TorrentGetField::Wanted => "wanted",

View File

@ -130,6 +130,8 @@ pub struct Torrent {
pub torrent_file: Option<String>,
pub total_size: Option<i64>,
pub trackers: Option<Vec<Trackers>>,
pub tracker_list: Option<String>,
pub tracker_stats: Option<Vec<TrackerStat>>,
pub upload_ratio: Option<f32>,
pub uploaded_ever: Option<i64>,
pub files: Option<Vec<File>>,
@ -189,6 +191,47 @@ pub struct FileStat {
pub priority: Priority,
}
#[derive(Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct TrackerStat {
pub announce_state: TrackerState,
pub announce: String,
pub download_count: i64,
pub has_announced: bool,
pub has_scraped: bool,
pub host: String,
pub id: Id,
pub is_backup: bool,
pub last_announce_peer_count: i64,
pub last_announce_result: String,
pub last_announce_start_time: i64,
pub last_announce_succeeded: bool,
pub last_announce_time: i64,
pub last_announce_timed_out: bool,
pub last_scrape_result: String,
pub last_scrape_start_time: i64,
pub last_scrape_succeeded: bool,
pub last_scrape_time: i64,
pub last_scrape_timed_out: bool,
pub leecher_count: i64,
pub next_announce_time: i64,
pub next_scrape_time: i64,
pub scrape_state: TrackerState,
pub scrape: String,
pub seeder_count: i64,
pub sitename: String,
pub tier: usize,
}
#[derive(Deserialize_repr, Debug, Clone)]
#[repr(i8)]
pub enum TrackerState {
Inactive = 0,
Waiting = 1,
Queued = 2,
Active = 3,
}
#[derive(Deserialize, Debug)]
pub struct Nothing {}
impl RpcResponseArgument for Nothing {}