1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-26 21:18:36 -06:00

change: Switched to ntfy.sh

This commit is contained in:
Sayantan Santra 2023-06-23 19:29:06 -05:00
parent 70e293673d
commit 059e214cf8
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F

View file

@ -1,16 +1,23 @@
#!/bin/bash #!/bin/bash
# A very simple script to send message using Gotify whenever a torrent is added/completed # A very simple script to send message using ntfy.sh whenever a torrent is added/completed
# in qBittorrent. Just call the script from qBittorrent's external script option # in qBittorrent. Just call the script from qBittorrent's external script option
# using <script> "%N" "%Z" (add/fin) # using <script> "%N" "%Z" (add/fin)
# It also adds trackers using https://github.com/Jorman/Scripts/blob/master/AddqBittorrentTrackers.sh
name="$1" name="$1"
size="$(echo $2 | numfmt --to=iec --format %.2f)B"
url="https://example.com/message?token=<token>"
if [ "$3" == "add" ]; then if [ "$3" == "add" ]; then
curl -X POST "$url" -F "title=qBittorrent" -F "message=The torrent '$name' has been added." -F "priority=4" message="The torrent '$name' has been added."
elif [ "$3" == "fin" ]; then elif [ "$3" == "fin" ]; then
size="$(echo $2 | numfmt --to=iec --format %.2f)B" size="$(echo $2 | numfmt --to=iec --format %.2f)B"
curl -X POST "$url" -F "title=qBittorrent" -F "message=The torrent '$name' ($size) has finished downloading." message="The torrent '$name' ($size) has finished downloading."
else
exit
fi fi
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