Last active
August 18, 2021 17:11
-
-
Save Adadov/e352c05cf2f90031e5b9b623509a02da to your computer and use it in GitHub Desktop.
t411 mass replace tracker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# t411 key | |
KEY="******" | |
HOST="myhost.example:9091" # Transmission daemon host | |
AUTH=0 # Authentification to transmission-daemon ? 1 = True | |
TDUSER="" | |
TDPASS="" | |
if [ ${AUTH} -eq 1 ]; then | |
OPTS="${HOST} -n ${TDUSER}:${TDPASS}" | |
else | |
OPTS="${HOST}" | |
fi | |
# Tracker to replace | |
OLD="t411.download" | |
# New tracker URL | |
NEW="https://tracker.t411.ai" | |
LISTID=$(transmission-remote ${OPTS} -l | awk '{print $1}' | grep -E '^[0-9]+' | sed -r -e 's/^([0-9]*).*$/\1/') # Get all torrents ID | |
for id in ${LISTID}; do | |
echo "=========================" | |
TRACKS=$(transmission-remote ${OPTS} -t ${id} -it | grep -E 'Tracker [0-9]+') # Get all trackers | |
TRTEST=$(echo "${TRACKS}" | grep ${OLD}) # Is there the tracker to replace ? | |
if [ $? -eq 0 ]; then | |
TRKID=$(echo "${TRACKS}" | grep ${OLD} | sed -r -e 's/Tracker ([0-9]+).*/\1/') # Get tracker ID | |
transmission-remote ${OPTS} -t ${id} -tr ${TRKID} | |
transmission-remote ${OPTS} -t ${id} -td "${NEW}/${KEY}/announce" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! But nowhere to download
transmission-remote
. So I use https://github.com/transmission-remote-gui/transgui instead.