Code Monkey home page Code Monkey logo

qbittorrent-cli's Introduction

qbittorrent-cli

goreleaser

A cli to manage qBittorrent. Add torrents, reannounce and import from other clients.

Features

  • Add torrents to qBittorrent from file or magnet link. Useful in combination with autodl-irssi
  • Reannounce torrents for troublesome trackers
  • Set limits on how many simultaneously active downloads are allowed
  • Import torrents with state from Deluge and rTorrent

Install

Download the latest binary and put somewhere in $PATH.

Extract binary

tar -xzvf qbt_$VERSION_linux_amd64.tar.gz

Move to somewhere in $PATH. Need sudo if not already root. Or put it in your user $HOME/bin or similar.

sudo mv qbt /usr/bin/

Verify that it runs

qbt

This should print out basic usage.

Thanks to Go we can build binaries for multiple platforms, but currently only 32 and 64bit linux is built. Add an issue if you need it built for something else.

Build from source

You can also build it yourself if you have Go installed locally, or with goreleaser.

With make

make build

Or with only go

go build -o bin/qbt cmd/qbt/main.go

Multi-platform with goreleaser

Builds with goreleaser will also include version info.

goreleaser release --snapshot --skip-publish --clean

Configuration

Create a new configuration file .qbt.toml in $HOME/.config/qbt/.

mkdir -p ~/.config/qbt && touch ~/.config/qbt/.qbt.toml

A bare minimum config. Check full example config.

[qbittorrent]
host     = "127.0.0.1" # qbittorrent webui-api hostname/ip
port     = 6776        # qbittorrent webui-api port
login    = "user"      # qbittorrent webui-api user
password = "password"  # qbittorrent webui-api password

[rules]
enabled              = true   # enable or disable rules
max_active_downloads = 2      # set max active downloads
  • If running on HDDs and 1Gbit - max_active_downloads = 2 is a good setting to not overload the disks and gives as much bandwidth as possible to the torrents.
  • For SSDs and 1Gbit+ you can increase this value.

autodl-irssi setup

Edit autodl.cfg

Global action:

[options]
...
upload-type = exec
upload-command = /usr/bin/qbt
upload-args = add "$(TorrentPathName)"

Per filter:

[filter example_filter_action]
...
upload-type = exec
upload-command = /usr/bin/qbt
upload-args = add "$(TorrentPathName)" --category cat1 --tags tag1

rutorrent

In rutrorrent, go to autodl-irssi Preferences, and then the Action tab. Put in the following for the global action. This can be set per filter as well, then you can add category, tags etc.

Choose .torrent action: Run Program
Command: /usr/bin/qbt
Arguments: add "$(TorrentPathName)"

Usage

Use qbt help to find out more about how to use.

Commands:

  • add
  • list
  • version
  • help
  • move
  • compare
  • edit
  • reannounce

Global flags:

  • --config - override config file

Use "qbt [command] --help" for more information about a command.

Add

Add a new torrent to qBittorrent.

qbt add my-torrent-file.torrent

Optional flags:

  • --dry-run - Run without doing anything
  • --magnet <LINK> - Add magnet link instead of torrent file
  • --paused - Add torrent in paused state
  • --skip-hash-check - Skip hash check
  • --save-path <PATH> - Add torrent to the specified path
  • --category <CATEGORY> - Add torrent to the specified category
  • --tags <TAG,TAG> - Add tags to the torrent. Use multiple or comma-separate tags e.g. --tags linux,iso. Supported in 4.3.2+
  • --ignore-rules - Ignore rules set in config
  • --limit-ul <SPEED> - Set torrent upload speed limit. Unit in bytes/second
  • --limit-dl <SPEED> - Set torrent download speed limit. Unit in bytes/second

Move

Move torrents from one or multiple categories to some other category.

By using ATM (Automatic Torrent Mode) and the default behavior of categories mapped to folders this can be used to move from NVME to HDD storage after a min-seed-time.

qbt move --from categroy1 --to category2 --min-seed-time 45

Optional flags:

  • --dry-run - Run without doing anything
  • --min-seed-time - Only move torrents with a minimum active seedtime of X minutes
  • --include-tags - Only move torrents with any of the tags in comma separate list (tag1,tag2)
  • --exclude-tags - Don't move torrents with any of the tags in comma separate list (tag1,tag2)

Usable with cron as well. Run every 15 min.

*/15 * * * * /usr/bin/qbt move --from nvme --to hdd --min-seed-time 30

Compare

Compare torrents between two instances. Source instance and compare instance.

Required flags:

  • --addr - Host url with http and port if needed

  • --user - Host user

  • --pass - Host pass

  • --basic-user - Host basic auth user

  • --basic-pass - Host basic auth pass

  • --compare-addr - url with http and port if needed

  • --compare-user - user

  • --compare-pass - pass

  • --compare-basic-user - basic auth user

  • --compare-basic-pass - basic auth pass

Optional flags:

  • --dry-run - Run without doing anything
  • --tag-duplicates - Tag duplicates with compare-dupe tag, only on compare host
  • --tag - Override the default tag compare-dupe
qbt compare --addr http://url.com:10000 --user u --pass p --compare-addr http://url.com:10000 --compare-user u --compare-pass p

Edit

Edit fastresume data like save-path. Make sure to shut down the client and backup the data before running this.

Required flags:

  • --dir - Dir to the fastresume data. Usually ~/.local/share/qBittorrent/BT_backup
  • --pattern - The pattern to replace. Eg. /home/user01/torrents
  • --replace - The replacement text. Eg. /home/test/torrents

Optional flags:

  • --dry-run - Dry run without editing files
  • --verbose, -v - Verbose output
qbt edit --dir /home/user/.local/share/qBittorrent/BT_backup --pattern '/home/user01/torrents' --replace '/home/test/torrents'

Import

Import torrents from other client into qBittorrent, and keep state.

Required flags:

  • --source <NAME> - Import from client [deluge, rtorrent]
  • --source-dir <PATH> - State/session dir for client
  • --qbit-dir <PATH> - qBittorrent dir (~/.local/share/data/qBittorrent/BT_backup)

Supported clients:

  • Deluge
  • rTorrent

Optional flags:

  • --dry-run - don't write anything to disk
  • --skip-backup - skip backup of state dirs before importing data

WARNING: Make sure to stop both the source client and qBittorrent before importing.

Example with Deluge.

qbt import --source deluge --source-dir ~/.config/deluge/state/ --qbit-dir ~/.local/share/data/qBittorrent/BT_backup --dry-run

After the import you will have to manually delete the torrents from the source client, but don't check the "also delete files" as currently the import DOES NOT move the actual data.

Caveats

  • Does not support changing paths for data, it expects data to be at same place as the source client.
  • Does not support renamed files either.
  • Does not import labels/categories/tags
  • Use at own caution. The backups are there if something goes wrong.

Workflow

Torrents imported into qBittorrent does not have automatic management enabled, because it's default behavior is to move data.

  1. Stop source client and qBittorrent.
  2. Start with a dry run and see what it does qbt import ..... --dry-run
  3. If it looks ok, run without --dry-run
  4. Start clients again, go into the source client and stop everything.
  5. Set categories/tags in batches. Start to add a category, then set "Automatic torrent management" for it to automatically move the files to the categories specified directory.

Reannounce

Reannounce torrents.

qbt reannounce

Optional flags:

  • --dry-run - Run without doing anything
  • --category <CATEGORY> - Only look for torrents with the provided category
  • --tag <TAG> - Only look for torrents with the provided tag
  • --hash <HASH> - Only look for torrents with the provided hash
  • --interval <INTERVAL> - Override default interval of 7000 ms (7s)
  • --attempts <ATTEMPTS> - Override default attempts of 50

qbittorrent-cli's People

Contributors

baukezwart avatar fabricionaweb avatar klahaha avatar ludviglundgren avatar mikluko avatar s0up4200 avatar xel86 avatar

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.