1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-26 05:08:36 -06:00
random/qbt-send-msg.sh

24 lines
825 B
Bash
Raw Normal View History

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
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