mirror of
https://github.com/kristoferssolo/traxor.git
synced 2025-10-21 20:10:35 +00:00
feat: add delete torrent
This commit is contained in:
parent
b064faa400
commit
e0e95b07b1
9
.github/workflows/rust.yml
vendored
9
.github/workflows/rust.yml
vendored
@ -1,19 +1,14 @@
|
||||
name: Rust
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
branches: ["main"]
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build
|
||||
|
||||
@ -6,8 +6,8 @@ use super::Torrents;
|
||||
impl Torrents {
|
||||
pub async fn toggle(&mut self, torrent: &Torrent) {
|
||||
let id = torrent.id().expect("ID not found");
|
||||
let action = match torrent.status.expect("Torrent status not found") {
|
||||
TorrentStatus::Stopped => TorrentAction::StartNow,
|
||||
let action = match torrent.status {
|
||||
Some(TorrentStatus::Stopped) => TorrentAction::StartNow,
|
||||
_ => TorrentAction::Stop,
|
||||
};
|
||||
self.client
|
||||
@ -55,8 +55,16 @@ impl Torrents {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn delete(&mut self) -> Result<()> {
|
||||
todo!()
|
||||
pub async fn delete(
|
||||
&mut self,
|
||||
torrent: &Torrent,
|
||||
delete_local_data: bool,
|
||||
) -> transmission_rpc::types::Result<()> {
|
||||
let id = torrent.id().expect("ID not found");
|
||||
self.client
|
||||
.torrent_remove(vec![id], delete_local_data)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn rename(&mut self) -> Result<()> {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user