feat: add rename

This commit is contained in:
Kristofers Solo 2024-01-31 16:26:28 +02:00
parent c97a416d68
commit 0171e8e135

View File

@ -78,8 +78,17 @@ impl Torrents {
Ok(()) Ok(())
} }
pub fn rename(&mut self) -> Result<()> { pub async fn rename(
todo!() &mut self,
torrent: &Torrent,
name: &Path,
) -> transmission_rpc::types::Result<()> {
let id = torrent.id().expect("ID not found");
let old_name = torrent.name.clone().unwrap();
self.client
.torrent_rename_path(vec![id], old_name, name.to_string_lossy().into())
.await?;
Ok(())
} }
async fn action_all(&mut self, action: TorrentAction) -> transmission_rpc::types::Result<()> { async fn action_all(&mut self, action: TorrentAction) -> transmission_rpc::types::Result<()> {