Discord notification script for qBittorrent
This is a simple bash script for sending notifications to a Discord webhook for completed downloads from qBittorrent. Useful for those already using radarr, sonarr, readarr for downloading.
Features
- Uses embed styling for a nicer look. Read more about Discord embeds here
- Can be adapted to create different messages based on qBittorrent categories (optional).
- Easily expanded to capture other parameters from qBittorrent.
- Will automatically convert size from bytes to kB, MB or GB based on the size of the torrent. Useful if you are downloading shows, movies and books in various sizes.
- Tested in qBittorrent for docker but should work in all versions.
Usage
- Create a Discord webhook URL - instructions
- Download the bash script and make it available to qBittorrent. For docker instances, ensure it is placed in a mounted folder. Make it executable with
chmod +X /path/to/script/discord_qbit_notification.sh
.
- Input your Discord webhook URL at the top of the script.
- Adapt the categories to align with your qBittorrent instance. For example, besides the usual sonarr, radarr categories, I have watch folders for manually adding torrents which I like to use for notifications.
- You can test the script by running it in your terminal with some test parameters. For example:
bash /path/to/script/discord_qbit_notification.sh TestName 9999922 12 tracker.com radarr savepath
. If successful you should see confirmation in the terminal along with a discord notification.
- Add the following to 'run external program on torrent completion' under your qBittorrent settings:
/path/to/script/discord_qbit_notification.sh "%N" "%Z" "%C" "%T" "%L" "%D"
Note: The order of the parameters is important as they are captured accordingly in the script, make sure to edit accordingly if adapting the script for different parameters.
- Done!
Tip: adding categories to watched folders in qBittorrent (docker)
If you're using qBittorrent through linuxserver's container, the webUI doesn't surface a way to add categories to watched folders. To do this, you have to edit the watched_folders.json
file located in the containers config folder. The path will be something like containerConfig/qbittorrent/qBittorrent/watched_folders.json
. An example is provided in the repo.