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
19
.github/workflows/rust.yml
vendored
19
.github/workflows/rust.yml
vendored
@ -1,22 +1,17 @@
|
|||||||
name: Rust
|
name: Rust
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: ["main"]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: ["main"]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --verbose
|
run: cargo build --verbose
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
|
|||||||
@ -6,8 +6,8 @@ use super::Torrents;
|
|||||||
impl Torrents {
|
impl Torrents {
|
||||||
pub async fn toggle(&mut self, torrent: &Torrent) {
|
pub async fn toggle(&mut self, torrent: &Torrent) {
|
||||||
let id = torrent.id().expect("ID not found");
|
let id = torrent.id().expect("ID not found");
|
||||||
let action = match torrent.status.expect("Torrent status not found") {
|
let action = match torrent.status {
|
||||||
TorrentStatus::Stopped => TorrentAction::StartNow,
|
Some(TorrentStatus::Stopped) => TorrentAction::StartNow,
|
||||||
_ => TorrentAction::Stop,
|
_ => TorrentAction::Stop,
|
||||||
};
|
};
|
||||||
self.client
|
self.client
|
||||||
@ -55,8 +55,16 @@ impl Torrents {
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn delete(&mut self) -> Result<()> {
|
pub async fn delete(
|
||||||
todo!()
|
&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<()> {
|
pub fn rename(&mut self) -> Result<()> {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user