An open API service indexing awesome lists of open source software.

https://github.com/bpazy/qbt-cli

A cli to manage qBittorrent
https://github.com/bpazy/qbt-cli

cli qbittorrent

Last synced: about 1 year ago
JSON representation

A cli to manage qBittorrent

Awesome Lists containing this project

README

          

# qbt-cli
[![Build And Test](https://github.com/Bpazy/qbt-cli/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/Bpazy/qbt-cli/actions/workflows/build-and-test.yml)
![LICENSE](https://img.shields.io/github/license/Bpazy/qbt-cli)

A cli to manage qBittorrent.

## Installing qbt-cli
### Install from package
#### Windows
```ps1
scoop install https://raw.githubusercontent.com/Bpazy/qbt-cli/master/qbt-cli.json
```

### Install from cargo
```sh
cargo install qbt
```

### Install from download
Download latest stable release version from [release page](https://github.com/Bpazy/qbt-cli/releases). And put it under the `$PATH`.

Linux example:
```
wget -O /usr/local/bin/qbt https://github.com/Bpazy/qbt-cli/releases/latest/download/qbt-${REPLACE_ME_WITH_VERSION}-linux-amd64
chmod +x /usr/local/bin/qbt
```

## Exmaple
### 1. Example: List all magnets
```sh
$ qbt list
36ef3f773e0916beea0946913462c32f5b927635 0.0% metaDL 0.00MiB/s 神探伽利略禁断的魔术.mkv
```

### 2. Example: Delete all magnets
```sh
qbt list | awk '{print $1}' | xargs -n 1 qbt delete
```

## Usage
### 1. Usage: Overview
```ps1
PS C:\> qbt -h
Usage: qbt.exe [OPTIONS]

Commands:
add Add new torrent
list Get torrent list
help Print this message or the help of the given subcommand(s)

Options:
--verbose Use verbose output
-h, --help Print help information
-V, --version Print version information
```
### 2. Usage: Add new torrent
```ps1
PS C:\> qbt add -h
Add new torrent

Usage: qbt.exe add [OPTIONS]

Arguments:
URLs separated with newlines

Options:
--savepath
Download folder
--cookie
Cookie sent to download the .torrent file
-c, --category
Category for the torrent
-t, --tags
Tags for the torrent, split by ','
--skip-checking
Skip hash checking. Possible values are true, false (default)
--paused
Add torrents in the paused state. Possible values are true, false (default)
--root-folder
Create the root folder. Possible values are true, false, unset (default)
-r, --rename
Rename torrent
--up-limit
Set torrent upload speed limit. Unit in bytes/second
--dl-limit
Set torrent download speed limit. Unit in bytes/second
--ratio-limit
Set torrent share ratio limit
--seeding-time-limit
Set torrent seeding time limit. Unit in minutes
--auto-tmm
Whether Automatic Torrent Management should be used
--sequential-download
Enable sequential download. Possible values are true, false (default)
--first-last-piece-prio
Prioritize download first last piece. Possible values are true, false (default)
-h, --help
Print help information
```
### 3. Usage: Get torrent list
```ps1
PS C:\> qbt list -h
Get torrent list

Usage: qbt.exe list [OPTIONS]

Options:
-f, --filter Filter torrent list by state. Allowed state filters: all, downloading, seeding, completed, paused, active, inactive, resumed, stalled, stalled_uploading, stalled_downloading, errored
-c, --category Get torrents with the given category (empty string means "without category"; no "category" parameter means "any category". Remember to URL-encode the category name. For example, My category becomes My%20category
-t, --tag Get torrents with the given tag (empty string means "without tag"; no "tag" parameter means "any tag". Remember to URL-encode the category name. For example, My tag becomes My%20tag
-s, --sort Sort torrents by given key. They can be sorted using any field of the response's JSON array (which are documented below) as the sort key
-r, --reverse Enable reverse sorting. Defaults to false [possible values: true, false]
-l, --limit Limit the number of torrents returned
-o, --offset Set offset (if less than 0, offset from end)
--hashes Filter by hashes. Can contain multiple hashes separated by |
--age Filter by age. Number + 'd' for days, 'h' for hours. Prefix with "<" for newer than, ">" (or no prefix) for older than. Examples: "7d", "<16h"
-h, --help Print help information
```

### 4. Usage: Delete torrent
```
PS C:\> qbt delete -h
Delete torrent

Usage: qbt.exe delete [OPTIONS]

Arguments:
The hashes of the torrents you want to delete. `hashes` can contain multiple hashes separated by `|`, to delete multiple torrents, or set to all, to delete all torrents

Options:
-f, --delete-files If set to true, the downloaded data will also be deleted, otherwise has no effect
-h, --help Print help information
```

## Configure
`$HOME/.config/qbt/config.toml`:
```toml
qbittorrent_host="http://qbittorrent.example.host"
username="YOUR_USERNAME"
password="YOUR_PASSWORD"
```