Limit active torrents for transmission-daemon?

Discussion of Transmission that doesn't fit in the other categories
Post Reply
bigeyes0x0
Posts: 3
Joined: Thu Jul 23, 2009 3:49 pm

Limit active torrents for transmission-daemon?

Post by bigeyes0x0 »

Is there a way to do this? I checked the edit config wiki page to no avail. Did I miss something?

EDIT: I'm using transmission 1.72 on freenas 0.7RC2b4840
erlebnishengst
Posts: 2
Joined: Wed Aug 12, 2009 1:35 pm

Re: Limit active torrents for transmission-daemon?

Post by erlebnishengst »

I'm using a simple bash-script to move finished torrents and add new ones from a folder, as long as the queue isn't full. Maybe you can use it.

Code: Select all

#!/bin/sh
#Check if a torrent is finished and not seeding anymore (check ratio-limit in config-file), move it to DESTDIR and remove.
#Check the number of active torrents, add from TORRENTDIR-folder if necessary, remove source file

# *************
REMOTE="/usr/local/bin/transmission-remote"
DESTDIR=/media/Finished
TORRENTDIR=/media/Torrents
MAXACTIVE="6"
USER=something
PASS=secret
# *************

# Move Finished, when not seeding.
FINISHED="$($REMOTE -l -n $USER:$PASS | tail --lines=+2 | grep 100% | grep -v Seeding |  awk '{ print $1; }')"
for i in $FINISHED; do
	echo Torrent No. $FINISHED is finished.
	$REMOTE -n $USER:$PASS -t $i --move $DESTDIR
	$REMOTE -n $USER:$PASS -t $i -r
done

# Add new torrents and delete source file.
ACTIVE="$[ $($REMOTE -n $USER:$PASS -l | grep -v Stopped | wc -l) - 2 ]"
echo $ACTIVE active torrents.
if [ $ACTIVE -gt $MAXACTIVE ]; then
    echo Queue full.
	exit 0
else
	until [ $ACTIVE -eq $MAXACTIVE ]; do
		find $TORRENTDIR -name '*'.torrent | head -n1 | xargs -I {} -i bash -c "$REMOTE -n $USER:$PASS -a "{}" &> /dev/null && rm -f "{}" && echo Added" \;
		let ACTIVE=ACTIVE+1
		echo $ACTIVE active torrents.
	done
	exit 0
fi
Post Reply