Skip to content

Commit ffc6e44

Browse files
committed
Add set_location on QBittorrentClient
1 parent 4bfa760 commit ffc6e44

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/qbittorrent/api.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,17 @@ impl QBittorrentClient {
165165
.find(|torrent| target.matches_hash(torrent.as_ref()))
166166
})
167167
}
168+
169+
pub async fn set_location(&self, target: &SingleTarget, location: &str) -> Result<(), Error> {
170+
if let Some(id) = self.id(target).await? {
171+
let form = Form::new().text("hashes", id.to_string()).text("location", location.to_string());
172+
self._post_multipart(self._endpoint("torrents/setLocation"), form).await?;
173+
174+
Ok(())
175+
} else {
176+
Err(Error::MissingTorrent { hash: target.to_string() })
177+
}
178+
}
168179
}
169180

170181
#[async_trait]

0 commit comments

Comments
 (0)