2023-05-30 18:01:39 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-06-23 19:29:06 -05:00
|
|
|
# A very simple script to send message using ntfy.sh whenever a torrent is added/completed
|
2023-05-30 18:01:39 -05:00
|
|
|
# in qBittorrent. Just call the script from qBittorrent's external script option
|
|
|
|
# using <script> "%N" "%Z" (add/fin)
|
2023-06-23 19:29:06 -05:00
|
|
|
# It also adds trackers using https://github.com/Jorman/Scripts/blob/master/AddqBittorrentTrackers.sh
|
2023-05-30 18:01:39 -05:00
|
|
|
|
|
|
|
name="$1"
|
|
|
|
|
|
|
|
if [ "$3" == "add" ]; then
|
2023-06-23 19:29:06 -05:00
|
|
|
message="The torrent '$name' has been added."
|
2023-05-30 18:01:39 -05:00
|
|
|
elif [ "$3" == "fin" ]; then
|
2023-06-22 00:53:01 -05:00
|
|
|
size="$(echo $2 | numfmt --to=iec --format %.2f)B"
|
2023-06-23 19:29:06 -05:00
|
|
|
message="The torrent '$name' ($size) has finished downloading."
|
|
|
|
else
|
|
|
|
exit
|
2023-05-30 18:01:39 -05:00
|
|
|
fi
|
2023-06-23 19:29:06 -05:00
|
|
|
|
|
|
|
curl -H "Icon: https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/New_qBittorrent_Logo.svg/240px-New_qBittorrent_Logo.svg.png" \
|
|
|
|
-H "Title: qBittorrent" \
|
|
|
|
-H "Priority: low" \
|
|
|
|
-d "$message" \
|
|
|
|
https://ntfy.sh/topic-name
|