/ Published in: Bash
This is a little script to stop the torrents in Transmission that are finished downloading. You can put this in a cron job and let it run every hour or less. Essentially turning you into UBER leecher. Hey don't scowl at me, I have to pay for bandwidth!
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/sh # Download dir, may contain spaces: watchdir="/share/Download/" bin="/opt/sybhttpd/localhost.drives/HARD_DISK/Apps/Transmission/bin/transmission-remote" # Authentication "username:password": tr_auth="nmt:1234" # Transmission host "ip:port": tr_host="127.0.0.1:9091" if [ -n "$tr_auth" ]; then tr_auth="--auth=$tr_auth" fi # Ok from this point on its a bit hack and slash so apologies # But we essentially go through the transmission list of torrents # If the torrent is downloaded 100% # Then we take it out of transmission and we make .finished file $bin "$tr_host" "$tr_auth" -l | awk '{ if ($1 != "Sum:" && $1 != "ID") { print $1,$2 } }' | while read id percent do if [ $percent = "100%" ] then reply="`$bin -t "$id" -i | grep -E '^ Name|^ Hash'`" name="`echo "$reply" | grep '^ Name' | cut -c 9-`" hash="`echo "$reply" | grep '^ Hash' | cut -c 9-`" touch "$watchdir$name.finished" t=`$bin -t $id -r` sleep 5 fi done exit 0