Discussion of Transmission that doesn't fit in the other categories
maldax
Posts: 4 Joined: Tue Jan 18, 2011 7:47 pm
Post
by maldax » Tue Jan 18, 2011 7:59 pm
Hello all,
I have installed freeNAS and using Transmission & Sick Beard together. As Sick Beard moves completed downloads to new file structure I was always cleaning up completed downloads so knocked up a little script that I cron every 30 mins. Works a treat so thought I would share
Code: Select all
#!/bin/bash
#delete seeds
USER=xxxxxxxx
PASSWD=xxxxxxxxxx
torrent_ids=$(/usr/local/bin/transmission-remote -n $USER:$PASSWD -l | grep "100%" | cut -b 1-4 )
for index in $torrent_ids; do
/usr/local/bin/transmission-remote -n $USER:$PASSWD -t $index --remove
done
Last edited by
maldax on Tue Jan 18, 2011 8:13 pm, edited 1 time in total.
ijuxda
Post
by ijuxda » Tue Jan 18, 2011 8:07 pm
In case the torrent ids exceed 4 digits, instead of
perhaps
would be better.
Last edited by ijuxda on Mon Feb 14, 2011 4:01 am, edited 1 time in total.
maldax
Posts: 4 Joined: Tue Jan 18, 2011 7:47 pm
Post
by maldax » Tue Jan 18, 2011 8:11 pm
Hi
Yea I went with that to start but sometimes had an * at the end of the torrent id.
ijuxda
Post
by ijuxda » Tue Jan 18, 2011 10:04 pm
Then perhaps
Code: Select all
awk '{ if ($2 == "100%") print $1 }' | sed 's/*$//'
would be best. It also handles the case when the string "100%" happens to be part of the file name.
Last edited by ijuxda on Mon Feb 14, 2011 4:02 am, edited 1 time in total.
ijuxda
Post
by ijuxda » Tue Jan 18, 2011 10:06 pm
I.e.
Code: Select all
torrent_ids=$(/usr/local/bin/transmission-remote -n $USER:$PASSWD -l | awk '{ if ($2 == "100%") print $1 }' | sed 's/*$//')
Last edited by ijuxda on Mon Feb 14, 2011 4:02 am, edited 1 time in total.
maldax
Posts: 4 Joined: Tue Jan 18, 2011 7:47 pm
Post
by maldax » Tue Jan 18, 2011 11:37 pm
Thanks for that! Had not thought of the "100%" in the filename thing. That was what I had first but didnt think of piping in through sed
maldax
Posts: 4 Joined: Tue Jan 18, 2011 7:47 pm
Post
by maldax » Tue Jan 18, 2011 11:40 pm
Version 2
Code: Select all
#!/bin/bash
#delete seeds
USER=xxxxxxxx
PASSWD=xxxxxxxxxx
torrent_ids=$(/usr/local/bin/transmission-remote -n $USER:$PASSWD -l | awk '{ if ($2 == "100%") print $1 }' | sed 's/*$//')
for index in $torrent_ids; do
/usr/local/bin/transmission-remote -n $USER:$PASSWD -t $index --remove
done
killemov
Posts: 573 Joined: Sat Jul 31, 2010 5:04 pm
Post
by killemov » Sun Feb 20, 2011 9:39 am
How would Sick Beard know when a torrent is finished? Does it interface with transmission? If so, then that would probably be the proper channel for cleanup.
This construction would only work with a 1-file torrent. I suggest implementing some file-move-and-cleanup functionality in a torrent-done script.