Skip to content

Instantly share code, notes, and snippets.

@pentago
Last active January 26, 2023 20:31
Show Gist options
  • Save pentago/3fb10c82eb7d5e5c14cb5c21a8a84e62 to your computer and use it in GitHub Desktop.
Save pentago/3fb10c82eb7d5e5c14cb5c21a8a84e62 to your computer and use it in GitHub Desktop.
qBittorent Beforescript
#!/bin/sh
# to use, create a new script file, like beforescript.sh and place it somewhere where qbittorrent can reach it
# In qbittorrent/downloads section, enable the "Run external program on torrent added" and call the beforescript.sh along with all possible parameters:
# /config/beforescript.sh %N %L %G %F %R %D %C %Z %T %I %J %K
# just in case you want more stuff added to the script later and make use of parameters qBittorrent provides
TAG="cross-seed"
USERNAME="Cross-Seed"
AVATAR="https://i.imgur.com/9IYMd5x.png"
PAYLOAD="{\"username\":\"$USERNAME\",\"avatar_url\":\"$AVATAR\",\"content\":\"$1\"}"
WEBHOOK="" # Discord channel webhook URL
[ "$3" = "$TAG" ] && if curl -s -X POST -H "Content-Type:application/json" -d "$PAYLOAD" "$WEBHOOK"
then echo "Cross-seeding $1"
else echo "Discord cross-seeding notification failed"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment