A simple Python script to remove completed torrents from qBittorrent.
Note: PowerShell version no longer maintained!
- Configurable delay (only remove torrents once completed for X minutes)
- Skip torrents in certain category (useful for Sonarr)
- qBittorrent 4.1 or later
- Python 3 +
requests
module
- Run
pip install requests
If that fails, google how to install pip into python 3 for your environment. - Update script config variables for your setup:
server
,username
andpassword
. - Run script with
python3 /path/to/script/pruner.py
- If this doesn't work your python or pip is set up wrong.
- Enable home folders via DSM
(Control Panel > User > Advanced > Enable user home service). - Enable SSH access via DSM and log in as
admin
user
Using the defaultadmin
account makes your NAS vulnerable to brute force attacks but we will use it here for simplicity. - Install Python 3 package via DSM. (3.8.2 used)
-
Invoke pip using this command to install the
requests
moduleadmin@server:~$ /volume1/\@appstore/py3k/usr/local/bin/pip3 install requests
-
Put the configured
pruner.py
script somewhere on your NAS. -
Test it manually from the shell to make sure it works.
admin@server:~$ python3 /volume1/configs/scripts/pruner.py
-
Create a cron job (scheduled task) in Synology DSM with the above command to run as
admin
user.
- 0.4 - Added option to exclude by category.
- 0.3 - Added authentication support, fix delete API call to use GET method.
- 0.2 - Updated to work with qBittorrent API v2.
- 0.1 - Convert to Python. Fix bug with prune age detection.