Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
Last active December 3, 2024 20:52
Show Gist options
  • Save jfeilbach/9c93d994333a0fa42dac447619ec3818 to your computer and use it in GitHub Desktop.
Save jfeilbach/9c93d994333a0fa42dac447619ec3818 to your computer and use it in GitHub Desktop.
update_passkey.sh
#!/bin/bash
# only needed on transmission-daemon < version 4
key="<key>"
host="localhost:9091"
total=$(transmission-remote ${host} -l | tail -n 2 | head -n 1 | awk '{ print $1 }')
echo -e "Found ${total} torrents...\n"
echo -e "Inserting ${key} ...\n"
for i in $(seq 1 $total) ; do
id=$(transmission-remote ${host} -t ${i} -it | grep 'Tracker' | head -n 1 | awk '{ print $3 }')
if [ "$id" = "https://example.com:443" ]; then
echo ${i} | tee new.list
name=(transmission-remote ${host} -t ${i} -i | grep 'Name:'b | awk '{ print $2 }')
echo -e "${i} Removing old passkey from torrent..."
transmission-remote ${host} -t ${i} -tr 0
echo -e "${i} Adding new passkey to torrent..."
transmission-remote ${host} -t ${i} -td https://example.com/announce/${key}
transmission-remote ${host} -t ${i} --reannounce
echo -e "${i} Updated ${name}\n"
sleep 1
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment