Last active
January 28, 2020 20:11
-
-
Save bkanuka/30fe219a998897ac609432aeb2f0224b to your computer and use it in GitHub Desktop.
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/env bash | |
## Uses transmission-remote to remove public torrents only | |
## This keeps private torrents up to keep seeding | |
TORRENTS=$(transmission-remote -t all -i | \ | |
grep -e 'Id:' -e 'Name:' -e 'Percent Done:' -e 'Public torrent:' | \ | |
cut -d':' -f2 | sed -e 's/^[[:space:]]*//' | \ | |
paste -sd '\t\t\t\n') | |
while IFS="\n" read -r torrent; do | |
while IFS=$'\t' read -r id name percent public; do | |
# We now have all the varibles | |
if [[ $percent = "100%" ]]; then | |
if [[ $public = "Yes" ]]; then | |
echo "Torrent $name is complete and public" | |
echo "Removing $name ..." | |
transmission-remote -t "$id" -r | |
fi | |
fi | |
done <<< "$torrent" | |
done <<< "$TORRENTS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment