tqm
CLI tool to manage your torrent client queues. Primary focus is on removing torrents that meet specific criteria.
Example Configuration
clients:
deluge:
enabled: true
filter: default
download_path: /mnt/local/downloads/torrents/deluge
free_space_path: /mnt/local/downloads/torrents/deluge
download_path_mapping:
/downloads/torrents/deluge: /mnt/local/downloads/torrents/deluge
host: localhost
login: localclient
password: password-from-/opt/deluge/auth
port: 58846
type: deluge
v2: true
qbt:
download_path: /mnt/local/downloads/torrents/qbittorrent/completed
download_path_mapping:
/downloads/torrents/qbittorrent/completed: /mnt/local/downloads/torrents/qbittorrent/completed
enabled: true
filter: default
type: qbittorrent
url: https://qbittorrent.domain.com/
user: user
password: password
filters:
default:
ignore:
# general
- TrackerStatus contains "Tracker is down"
- Downloaded == false && !IsUnregistered()
- SeedingHours < 26 && !IsUnregistered()
# permaseed / un-sorted (unless torrent has been deleted)
- Label startsWith "permaseed-" && !IsUnregistered()
# Filter based on qbittorrent tags (only qbit at the moment)
- '"permaseed" in Tags && !IsUnregistered()'
remove:
# general
- IsUnregistered()
# imported
- Label in ["sonarr-imported", "radarr-imported", "lidarr-imported"] && (Ratio > 4.0 || SeedingDays >= 15.0)
# ipt
- Label in ["autoremove-ipt"] && (Ratio > 3.0 || SeedingDays >= 15.0)
# hdt
- Label in ["autoremove-hdt"] && (Ratio > 3.0 || SeedingDays >= 15.0)
# bhd
- Label in ["autoremove-bhd"] && (Ratio > 3.0 || SeedingDays >= 15.0)
# ptp
- Label in ["autoremove-ptp"] && (Ratio > 3.0 || SeedingDays >= 15.0)
# btn
- Label in ["autoremove-btn"] && (Ratio > 3.0 || SeedingDays >= 15.0)
# hdb
- Label in ["autoremove-hdb"] && (Ratio > 3.0 || SeedingDays >= 15.0)
# Qbit tag utilities
- HasAllTags("480p", "bad-encode") # match if all tags are present
- HasAnyTag("remove-me", "gross") # match if at least 1 tag is present
label:
# btn 1080p season packs to permaseed (all must evaluate to true)
- name: permaseed-btn
update:
- Label == "sonarr-imported"
- TrackerName == "landof.tv"
- Name contains "1080p"
- len(Files) >= 3
# cleanup btn season packs to autoremove-btn (all must evaluate to true)
- name: autoremove-btn
update:
- Label == "sonarr-imported"
- TrackerName == "landof.tv"
- not (Name contains "1080p")
- len(Files) >= 3
# Change qbit tags based on filters
tag:
- name: low-seed
# This must be set
# "mode: full" means tag will be added to
# torrent if matched and removed from torrent if not
# use `add` or `remove` to only add/remove respectivly
# NOTE: Mode does not change the way torrents are flagged,
# meaning, even with "mode: remove",
# tags will be removed if the torrent does NOT match the conditions.
# "mode: remove" simply means that tags will not be added
# to torrents that do match.
mode: full
update:
- Seeds <= 3
Optional - Tracker Configuration
trackers:
bhd:
api_key: your-api-key
ptp:
api_user: your-api-user
api_key: your-api-key
Allows tqm to validate if a torrent was removed from the tracker using the tracker's own API.
Currently implements:
- Beyond-HD
- PTP
Supported Clients
- Deluge
- qBittorrent
Example Commands
- Clean - Retrieve torrent client queue and remove torrents matching its configured filters
tqm clean qbt --dry-run
tqm clean qbt
- Relabel - Retrieve torrent client queue and relabel torrents matching its configured filters
tqm relabel qbt --dry-run
tqm relabel qbt
- Retag - Retrieve torrent client queue and retag torrents matching its configured filters
tqm retag qbt --dry-run
tqm retag qbt
- Orphan - Retrieve torrent client queue and local files/folders in download_path, remove orphan files/folders
tqm orphan qbt --dry-run
tqm orphan qbt
Notes
FreeSpaceSet
and FreeSpaceGB()
are currently only supported for the following clients (when free_space_path
is set):
- Deluge
- qBittorrent
FreeSpaceGB()
will only increase as torrents are hard-removed.
This only works with one disk referenced by free_space_path
and will not account for torrents being on different disks.
Donate
If you find this project helpful, feel free to make a small donation to the developer:
-
Monzo: Credit Cards, Apple Pay, Google Pay
-
GitHub Sponsor: GitHub matches contributions for first 12 months.
-
BTC: 3CiHME1HZQsNNcDL6BArG7PbZLa8zUUgjL