25th Feb, 2015, 12:47 AM
Fellow Xbianians,
I'm searching for a script that removes finished torrents from transmission. I came across some but they are for different devices.
I was wondering if anyone got this to work on the xbian setup. I'm a bit o a linux & scripting noob just started digging in last week. it might be that "transmission-remote" doesn't get found in this? but what do i know...[/term]
I know your gonna say "just use rtorrent!" but i installed koper89's package and is doesn't communicate with SR or CP. I tried changing the socket stuff to ports, per directions in the thread, but this didn't help rutorrent just couldn't find rtorrent anymore.
If anyone has any directions on either one, it would be much apreciated.
Cheers,
Ragman
I'm searching for a script that removes finished torrents from transmission. I came across some but they are for different devices.
script 1 (Click to View)
#!/bin/sh
# the folder to move completed downloads to
# port, username, password
SERVER="9091 --auth transmission:transmission"
# use transmission-remote to get torrent list from transmission-remote list
# use sed to delete first / last line of output, and remove leading spaces
# use cut to get first field from each line
TORRENTLIST=`transmission-remote $SERVER --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=" " --fields=1`
transmission-remote $SERVER --list
# for each torrent in the list
for TORRENTID in $TORRENTLIST
do
echo Processing : $TORRENTID
# check if torrent download is completed
DL_COMPLETED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "Percent Done: 100%"`
# check torrents current state is
STATE_STOPPED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "State: Seeding\|Stopped\|Finished\|Idle"`
echo $STATE_STOPPED
# if the torrent is "Stopped", "Finished", or "Idle after downloading 100%"
if [ "$DL_COMPLETED" ] && [ "$STATE_STOPPED" ]; then
# move the files and remove the torrent from Transmission
echo "Torrent #$TORRENTID is completed"
echo "Removing torrent from list"
transmission-remote $SERVER --torrent $TORRENTID --remove
else
echo "Torrent #$TORRENTID is not completed. Ignoring."
fi
done
# the folder to move completed downloads to
# port, username, password
SERVER="9091 --auth transmission:transmission"
# use transmission-remote to get torrent list from transmission-remote list
# use sed to delete first / last line of output, and remove leading spaces
# use cut to get first field from each line
TORRENTLIST=`transmission-remote $SERVER --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=" " --fields=1`
transmission-remote $SERVER --list
# for each torrent in the list
for TORRENTID in $TORRENTLIST
do
echo Processing : $TORRENTID
# check if torrent download is completed
DL_COMPLETED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "Percent Done: 100%"`
# check torrents current state is
STATE_STOPPED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "State: Seeding\|Stopped\|Finished\|Idle"`
echo $STATE_STOPPED
# if the torrent is "Stopped", "Finished", or "Idle after downloading 100%"
if [ "$DL_COMPLETED" ] && [ "$STATE_STOPPED" ]; then
# move the files and remove the torrent from Transmission
echo "Torrent #$TORRENTID is completed"
echo "Removing torrent from list"
transmission-remote $SERVER --torrent $TORRENTID --remove
else
echo "Torrent #$TORRENTID is not completed. Ignoring."
fi
done
and this (Click to View)
#!/bin/bash
/usr/bin/transmission-remote 127.0.0.1:9091 -l | grep 100% | awk '{print $1}' | xargs -n 1 -I % /usr/bin/transmission-remote 127.0.0.1:9091 -t % -r
/usr/bin/transmission-remote 127.0.0.1:9091 -l | grep 100% | awk '{print $1}' | xargs -n 1 -I % /usr/bin/transmission-remote 127.0.0.1:9091 -t % -r
I know your gonna say "just use rtorrent!" but i installed koper89's package and is doesn't communicate with SR or CP. I tried changing the socket stuff to ports, per directions in the thread, but this didn't help rutorrent just couldn't find rtorrent anymore.
If anyone has any directions on either one, it would be much apreciated.
Cheers,
Ragman