feat(arr): expose live downloads
This commit is contained in:
@@ -68,6 +68,13 @@ pub struct Torrent {
|
||||
pub hash: String,
|
||||
pub state: TorrentState,
|
||||
pub progress: f64,
|
||||
/// Download rate in bytes per second.
|
||||
pub download_rate: u64,
|
||||
/// Estimated seconds until complete, or `None` when Transmission cannot
|
||||
/// estimate it.
|
||||
pub eta: Option<i64>,
|
||||
/// Transmission's error message, when the torrent has errored.
|
||||
pub error: Option<String>,
|
||||
pub download_dir: PathBuf,
|
||||
pub labels: Vec<String>,
|
||||
/// Transmission has stopped this torrent because its configured seeding
|
||||
@@ -230,7 +237,8 @@ impl TransmissionClient {
|
||||
json!({
|
||||
"fields": [
|
||||
"id", "name", "hashString", "status", "percentDone",
|
||||
"downloadDir", "labels", "isFinished"
|
||||
"rateDownload", "eta", "errorString", "downloadDir",
|
||||
"labels", "isFinished"
|
||||
]
|
||||
}),
|
||||
)
|
||||
@@ -384,6 +392,12 @@ struct RpcTorrent {
|
||||
status: u8,
|
||||
#[serde(rename = "percentDone")]
|
||||
progress: f64,
|
||||
#[serde(rename = "rateDownload", default)]
|
||||
download_rate: u64,
|
||||
#[serde(default)]
|
||||
eta: Option<i64>,
|
||||
#[serde(rename = "errorString", default)]
|
||||
error: String,
|
||||
#[serde(rename = "downloadDir")]
|
||||
download_dir: PathBuf,
|
||||
#[serde(default)]
|
||||
@@ -411,6 +425,9 @@ impl From<RpcTorrent> for Torrent {
|
||||
hash: value.hash,
|
||||
state,
|
||||
progress: value.progress,
|
||||
download_rate: value.download_rate,
|
||||
eta: value.eta.filter(|eta| *eta >= 0),
|
||||
error: (!value.error.is_empty()).then_some(value.error),
|
||||
download_dir: value.download_dir,
|
||||
labels: value.labels,
|
||||
is_finished: value.is_finished,
|
||||
|
||||
Reference in New Issue
Block a user