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
775 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-10-26 11:57:07 -05:00
message="Added: $name"
2023-05-30 18:01:39 -05:00
elif [ "$3" == "fin" ]; then
size="$(echo $2 | numfmt --to=iec --format %.2f)B"
2023-10-26 11:57:07 -05:00
message="Finished: [$size] $name"
2023-06-23 19:29:06 -05:00
else
2023-12-04 19:09:11 -06:00
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" \
2023-12-04 19:09:11 -06:00
-H "Title: qBittorrent" \
-H "Priority: low" \
-d "$message" \
https://ntfy.sh/topic-name