Giter Club home page Giter Club logo

qbit's Introduction

Qbit-rs

crates.io docs.rs github

A Rust library for interacting with qBittorrent's Web API.

Implemented according to WebUI API (qBittorrent 4.1).

Usage

Add dependency by running:

cargo add qbit-rs

or manually add to Cargo.toml:

[dependencies]
qbit-rs = "0.4"

Then use it in your code:

use qbit_rs::Qbit;
use qbit_rs::model::Credential;

let credential = Credential::new("username", "password");
let api = Qbit::new("http://my-qb-instance.domain", credential);
let torrents = api.get_version().await;

or use the builder pattern:

use qbit_rs::Qbit;

let api = Qbit::builder()
    .endpoint("http://my-qb-instance.domain")
    .cookie("SID=1234567890")
    .build();
let torrents = api.get_version().await;

For more methods, see Qbit.

API Coverage

Most of the API is covered, except RSS and Search. PR is welcomed if you need that part of the API. The following is a list of the implementation status:

  1. Authentication
    1. Login
    2. Logout
  2. Application
    1. Get application version
    2. Get API version
    3. Get build info
    4. Shutdown application
    5. Get application preferences
    6. Set application preferences
    7. Get default save path
  3. Log
    1. Get log
    2. Get peer log
  4. Sync
    1. Get main data
    2. Get torrent peers data
  5. Transfer info
    1. Get global transfer info
    2. Get alternative speed limits state
    3. Toggle alternative speed limits
    4. Get global download limit
    5. Set global download limit
    6. Get global upload limit
    7. Set global upload limit
    8. Ban peers
  6. Torrent management
    1. Get torrent list
    2. Get torrent generic properties
    3. Get torrent trackers
    4. Get torrent web seeds
    5. Get torrent contents
    6. Get torrent pieces' states
    7. Get torrent pieces' hashes
    8. Add new torrent
    9. Pause torrents
    10. Resume torrents
    11. Delete torrents
    12. Recheck torrents
    13. Reannounce torrents
    14. Edit trackers
    15. Remove trackers
    16. Add peers
    17. Add trackers to torrent
    18. Increase torrent priority
    19. Decrease torrent priority
    20. Maximal torrent priority
    21. Minimal torrent priority
    22. Set file priority
    23. Get torrent download limit
    24. Set torrent download limit
    25. Set torrent share limit
    26. Get torrent upload limit
    27. Set torrent upload limit
    28. Set torrent location
    29. Set torrent name
    30. Set torrent category
    31. Get all categories
    32. Add new category
    33. Edit category
    34. Remove categories
    35. Add torrent tags
    36. Remove torrent tags
    37. Get all tags
    38. Create tags
    39. Delete tags
    40. Set automatic torrent management
    41. Toggle sequential download
    42. Set first/last piece priority
    43. Set force start
    44. Set super seeding
    45. Rename file
    46. Rename folder
  7. RSS (experimental)
    1. Add folder
    2. Add feed
    3. Remove item
    4. Move item
    5. Get all items
    6. Mark as read
    7. Refresh item
    8. Set auto-downloading rule
    9. Rename auto-downloading rule
    10. Remove auto-downloading rule
    11. Get all auto-downloading rules
    12. Get all articles matching a rule
  8. Search
    1. Start search
    2. Stop search
    3. Get search status
    4. Get search results
    5. Delete search
    6. Get search plugins
    7. Install search plugin
    8. Uninstall search plugin
    9. Enable search plugin
    10. Update search plugins
  9. Undocumented
    1. Export torrent1

Footnotes

  1. The endpoint is added in this PR

qbit's People

Contributors

george-miao avatar lynnesbian avatar einliterflasche avatar yejia995 avatar wind-mask avatar dsully avatar yaleman avatar shenjiangqiu avatar oscariremma avatar

Stargazers

Li Yang  avatar aidan avatar Milad avatar FDKevin avatar Alexey avatar YeLi avatar Dudnik Pavel avatar Mihai A. avatar  avatar Joost Bremmer avatar Paul Hüber avatar Mark Homoky avatar  avatar Tomas Berger avatar Kurenai avatar Kuriko Moe avatar  avatar Alex Czar avatar Lalo avatar Lizqwer scott avatar  avatar Nikita avatar David Kowis avatar ɴᴏᴠᴀ-ᴍᴇ avatar LittleBlackBird avatar Stanislav Tkach avatar shkey avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

qbit's Issues

BadResponse Error when trying to login

Hi,

calling

client.login(true).await.unwrap();

fails with a

called `Result::unwrap()` on an `Err` value: BadResponse { explain: "Failed to extract cookie from response" }

error.

This happens when trying to use credentials. When setting the WebUI to bypass authentication it doesn't come up
log.txt

Qbittorrent version: 4.6.4
Qbit-rs: 0.4.1

Cargo fails to build v0.4.2 due to E0445

error[E0445]: private trait `IntoLoginState` in public interface
  --> /home/mojken/.cargo/registry/src/github.com-1ecc6299db9ec823/qbit-rs-0.4.2/src/builder.rs:87:1
   |
17 | trait IntoLoginState {
   | -------------------- `IntoLoginState` declared as private
...
87 | impl<C, U> QbitBuilder<C, reqwest::Client, U>
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait

error[E0445]: private trait `IntoLoginState` in public interface
   --> /home/mojken/.cargo/registry/src/github.com-1ecc6299db9ec823/qbit-rs-0.4.2/src/builder.rs:105:1
    |
17  | trait IntoLoginState {
    | -------------------- `IntoLoginState` declared as private
...
105 | impl<C, U> QbitBuilder<C, (), U>
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait

For more information about this error, try `rustc --explain E0445`.
error: could not compile `qbit-rs` due to 2 previous errors```

problem when trying to add torrent from disk

Hello, I appreciate the availability of this crate. I have encountered an issue while attempting to add a torrent from the local disk. Thank you for your assistance.

    let arg = AddTorrentArg{
        source: TorrentSource::TorrentFiles { torrents: std::fs::read("test.torrent").unwrap() },
        ..AddTorrentArg::default()
    };
    let _res = api.add_torrent(arg).await;
    println!("{:?}", _res);

then catch --> Err(HttpError(reqwest::Error { kind: Builder, source: Custom("unsupported value") }))

It appears that the issue lies in the serialization component.
Method::POST => req = req.form(body), -> serde_urlencoded::to_string(form)

Credentials is private

After running cargo add qbit-rs and trying to use use qbit_rs::{Qbit, Credential} I get an error:

 --> src/qbit_manager.rs:4:21
   |
4  | use qbit_rs::{Qbit, Credential};
   |                     ^^^^^^^^^^ private struct
   |
note: the struct `Credential` is defined here
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/qbit-rs-0.3.7/src/lib.rs:26:21
   |
26 | use crate::{ext::*, model::*};
   |                     ^^^^^

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.