Skip to content

Instantly share code, notes, and snippets.

@itavero
Created April 20, 2017 12:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itavero/3a6bb491780bcd5d67b7fadd148fca44 to your computer and use it in GitHub Desktop.
Save itavero/3a6bb491780bcd5d67b7fadd148fca44 to your computer and use it in GitHub Desktop.
Transmission auto remove
#!/usr/bin/env sh
SERVER="9091 --auth user:pass"
TORRENTLIST=`transmission-remote $SERVER --list | grep 100% | sed "s/^ *//g" | cut -w -f1`
for TORRENTID in $TORRENTLIST
do
echo "Processing $TORRENTID"
TORRENT_INFO=`transmission-remote $SERVER --torrent $TORRENTID --info`
# Check if finished/done
echo $TORRENT_INFO | grep -oh "State: Seeding\|Stopped\|Finished\|Idle"
if [ $? == 0 ]; then
echo "Torrent #$TORRENTID is completed. Removing from list..."
transmission-remote $SERVER --torrent $TORRENTID --remove
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment