Crates.io | qbittorrent_rust |
lib.rs | qbittorrent_rust |
version | |
source | src |
created_at | 2024-12-05 15:38:58.013931 |
updated_at | 2024-12-05 16:26:44.741923 |
description | An asynchronous library to interface with the qbittorrent WeBUI API |
homepage | |
repository | https://github.com/confused-ace-noises/qbittorrent-rust |
max_upload_size | |
id | 1473310 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
An asynchronous rust library to interface with the qbittorrent WebUI API.
This library's goal is the one to reflect the qbittorrent WebUI API in its entirety, and simultaneously being simple, fast, and concise.
use qbittorrent_rust::*;
use tokio;
// The example uses tokio, but you can use your favorite asynchronous runtime.
#[tokio::main]
fn main() {
// Set the credentials.
let credentials = Credentials::new("username", "password");
// Define QbitApi with the authority of the qbitorrent api and your credentials.
let mut api = QbitApi::new("http://localhost:6001/", credentials).await.unwrap();
// You're all set up!
// Now, you can use the api variable to make whichever api request you'd like.
// Let's see how to add a torrent.
// First, define your torrents.
let torrent_1 = Torrent::new(TorrentType::Url("https://torrents/"));
let torrent_2 = Torrent::new(TorrentType::TorrentFile("path/to/the/torrent/file"));
// Now, define your TorrentAddDescriptor.
// this defines all the settings about downloading torrents:
// the savepath, the categories, etc;
// most importantly, always remember to set your torrents to a non-empty vector, or the method will return an error.
let torrent_add_desc = TorrentAddDescriptor::builder(vec![&torrent1, &torrent2])
.savepath("/path/to/save/location")
.build();
// Finally, send your request!
api.torrents_add_torrent(&TorrentAddDescriptor).await.unwrap();
}