Last active
January 6, 2024 22:48
-
-
Save chrodriguez/eeb55e52917b8c4effeb to your computer and use it in GitHub Desktop.
Transmission delete finished torrents
This file contains 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
#!/bin/sh | |
TORRENTLIST=`transmission-remote --auth=user:pass --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=' ' --fields=1` | |
for TORRENTID in $TORRENTLIST | |
do | |
echo "* * * * * Operations on torrent ID $TORRENTID starting. * * * * *" | |
DL_COMPLETED=`transmission-remote --auth=user:pass --torrent $TORRENTID --info | grep "Percent Done: 100%"` | |
STATE_STOPPED=`transmission-remote --auth=user:pass --torrent $TORRENTID --info | grep "State: Stopped\|Finished\|Idle"` | |
if [ "$DL_COMPLETED" != "" ] && [ "$STATE_STOPPED" != "" ]; then | |
echo "Torrent #$TORRENTID is completed." | |
echo "Removing torrent from list." | |
transmission-remote --auth=user:pass --torrent $TORRENTID --remove | |
else | |
echo "Torrent #$TORRENTID is not completed. Ignoring." | |
fi | |
echo "* * * * * Operations on torrent ID $TORRENTID completed. * * * * *" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment