Skip to content

Instantly share code, notes, and snippets.

@Adadov
Last active August 18, 2021 17:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Adadov/e352c05cf2f90031e5b9b623509a02da to your computer and use it in GitHub Desktop.
Save Adadov/e352c05cf2f90031e5b9b623509a02da to your computer and use it in GitHub Desktop.
t411 mass replace tracker
#!/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
@liukun
Copy link

liukun commented Jul 12, 2019

Thanks! But nowhere to download transmission-remote. So I use https://github.com/transmission-remote-gui/transgui instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment