mirror of
https://github.com/kristoferssolo/transmission-rpc.git
synced 2025-10-21 20:10:37 +00:00
Merge pull request #22 from Yneluki/main
This commit is contained in:
commit
3967562a87
@ -10,7 +10,6 @@ pub struct BasicAuth {
|
||||
}
|
||||
|
||||
pub use self::request::ArgumentFields;
|
||||
pub use self::request::File;
|
||||
pub use self::request::Id;
|
||||
pub(crate) use self::request::RpcRequest;
|
||||
pub use self::request::TorrentAction;
|
||||
|
||||
@ -146,16 +146,22 @@ pub struct TorrentAddArgs {
|
||||
pub peer_limit: Option<i64>,
|
||||
#[serde(skip_serializing_if = "Option::is_none", rename = "bandwidthPriority")]
|
||||
pub bandwidth_priority: Option<i64>,
|
||||
/// list of indices of files to be downloaded
|
||||
/// to ignore some files, put their indices in files_unwanted, otherwise they will still be downloaded
|
||||
#[serde(skip_serializing_if = "Option::is_none", rename = "files-wanted")]
|
||||
pub files_wanted: Option<Vec<File>>,
|
||||
pub files_wanted: Option<Vec<i32>>,
|
||||
/// list of indices of files not to download
|
||||
#[serde(skip_serializing_if = "Option::is_none", rename = "files-unwanted")]
|
||||
pub files_unwanted: Option<Vec<File>>,
|
||||
pub files_unwanted: Option<Vec<i32>>,
|
||||
/// list of indices of files to be downloaded with high priority
|
||||
#[serde(skip_serializing_if = "Option::is_none", rename = "priority-high")]
|
||||
pub priority_high: Option<Vec<File>>,
|
||||
pub priority_high: Option<Vec<i32>>,
|
||||
/// list of indices of files to be downloaded with low priority
|
||||
#[serde(skip_serializing_if = "Option::is_none", rename = "priority-low")]
|
||||
pub priority_low: Option<Vec<File>>,
|
||||
pub priority_low: Option<Vec<i32>>,
|
||||
/// list of indices of files to be downloaded with normal priority
|
||||
#[serde(skip_serializing_if = "Option::is_none", rename = "priority-normal")]
|
||||
pub priority_normal: Option<Vec<File>>,
|
||||
pub priority_normal: Option<Vec<i32>>,
|
||||
}
|
||||
|
||||
impl Default for TorrentAddArgs {
|
||||
@ -177,10 +183,6 @@ impl Default for TorrentAddArgs {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Debug, RustcEncodable, Clone)]
|
||||
pub struct File {
|
||||
//todo
|
||||
}
|
||||
#[derive(Clone, IntoEnumIterator)]
|
||||
pub enum TorrentGetField {
|
||||
Id,
|
||||
@ -208,10 +210,14 @@ pub enum TorrentGetField {
|
||||
Sizewhendone,
|
||||
Status,
|
||||
Trackers,
|
||||
Files,
|
||||
Downloaddir,
|
||||
Uploadedever,
|
||||
Uploadratio,
|
||||
Webseedssendingtous,
|
||||
Wanted,
|
||||
Priorities,
|
||||
Filestats
|
||||
}
|
||||
|
||||
impl TorrentGetField {
|
||||
@ -248,10 +254,14 @@ impl TorrentGetField {
|
||||
TorrentGetField::Sizewhendone => "sizeWhenDone",
|
||||
TorrentGetField::Status => "status",
|
||||
TorrentGetField::Trackers => "trackers",
|
||||
TorrentGetField::Files => "files",
|
||||
TorrentGetField::Downloaddir => "downloadDir",
|
||||
TorrentGetField::Uploadedever => "uploadedEver",
|
||||
TorrentGetField::Uploadratio => "uploadRatio",
|
||||
TorrentGetField::Webseedssendingtous => "webseedsSendingToUs",
|
||||
TorrentGetField::Wanted => "wanted",
|
||||
TorrentGetField::Priorities => "priorities",
|
||||
TorrentGetField::Filestats => "fileStats",
|
||||
}.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,6 +75,13 @@ pub struct Torrent {
|
||||
pub upload_ratio: Option<f32>,
|
||||
#[serde(rename = "uploadedEver")]
|
||||
pub uploaded_ever: Option<i64>,
|
||||
pub files: Option<Vec<File>>,
|
||||
/// for each file in files, whether or not they will be downloaded (0 or 1)
|
||||
pub wanted: Option<Vec<i8>>,
|
||||
/// for each file in files, their download priority (low:-1,normal:0,high:1)
|
||||
pub priorities: Option<Vec<i8>>,
|
||||
#[serde(rename = "fileStats")]
|
||||
pub file_stats: Option<Vec<FileStat>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, RustcEncodable)]
|
||||
@ -89,6 +96,23 @@ pub struct Trackers {
|
||||
pub announce: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, RustcEncodable, Clone)]
|
||||
pub struct File {
|
||||
pub length: i64,
|
||||
#[serde(rename = "bytesCompleted")]
|
||||
pub bytes_completed: i64,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, RustcEncodable, Clone)]
|
||||
pub struct FileStat {
|
||||
#[serde(rename = "bytesCompleted")]
|
||||
pub bytes_completed: i64,
|
||||
pub wanted: bool,
|
||||
/// low: -1, normal: 0, high: 1
|
||||
pub priority: i8,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug, RustcEncodable)]
|
||||
pub struct Nothing {}
|
||||
impl RpcResponseArgument for Nothing {}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user