I decided to write a bash script designed to run as a cron job to handle queuing. It's in its infancy, but please check it out and let me know what you think
Edit:
Found the orignal. Big Thanks to wereHamster
http://pastie.org/357236
Edit 2010.01.23:
Version 0.2 released
Incorporated changes from super-poussin and Kirbo - awesome work, guys
Code: Select all
#!/bin/sh
# *************
# transmission-remote-queue version 0.2
# Contact sam.day (at) gmail.com with suggestions, corrections, etc.
# Based on wereHampster's script from http://pastie.org/357236
# *************
# Variables
#
# Path to transmission-remote
REMOTE="/usr/local/bin/transmission-remote"
# Maximum number of active torrents (downloading + seeding)
MAXACTIVE="3"
# Maximum number of downloading torrents
MAXDOWNLOADING="2"
# Download ratio at which to stop seeding
DESIREDRATIO="1.5"
# Options to be passed to transmission-remote
TRANSOPT=" localhost:9091"
# Turn on/off adding extra slots if bandwidth to spare. Boolean.
# Recommend disabling if using 'turtle mode'
MODSLOTS=0
# Extra download slot added if download speed is below this value and MODSLOT=1
DOWNLOADLIMIT="700.0"
# *************
# Add extra download slot if required
if [ $MODSLOTS -eq 1 ]; then
DOWNLOADSPEED="$($REMOTE -l | tail -n -1 | awk '{ print $5; }')"
if expr $DOWNLOADSPEED \<= $DOWNLOADLIMIT > /dev/null; then
MAXDOWNLOADING=$(($MAXDOWNLOADING+1))
fi
if [ $MAXDOWNLOADING -gt $MAXACTIVE ]; then
MAXACTIVE=$MAXDOWNLOADING
fi
# debugging output (3 lines)
echo "Current download speed: $DOWNLOADSPEED KB/s"
echo "Lower threshold before adding a slot: $DOWNLOADLIMIT KB/s"
echo "Download slots: $MAXDOWNLOADING"
fi
# Stop torrents upper desired ratio
LIST="$($REMOTE $TRANSOPT -l | tail -n +2 | head -n -1 | grep 100% |grep Seeding | awk '{ print $1; }')"
for ID in $LIST; do
RATIO="$($REMOTE $TRANSOPT -t $ID -i | grep Ratio | awk '{ print $2; }')"
if expr $RATIO \>= $DESIREDRATIO > /dev/null; then
NAME="$($REMOTE $TRANSOPT --torrent $ID --info | grep Name:)"
echo "Stop Torrent: $ID - ${NAME#*Name: } (Ratio $RATIO)"
$REMOTE $TRANSOPT --torrent $ID --stop > /dev/null
fi
done
# Start downloading new torrents if download slots exist
DOWNLOADING="$($REMOTE $TRANSOPT -l | tail -n +2 | head -n -1 | grep -v Stopped | grep -v 100% | wc -l)"
if [ $DOWNLOADING -lt $MAXDOWNLOADING ]; then
LIST="$($REMOTE $TRANSOPT -l | tail -n +2 | head -n -1 | grep -v 100% | grep Stopped | head -n $(expr $MAXDOWNLOADING - $DOWNLOADING) | awk '{ print $1; }')"
for ID in $LIST; do
NAME="$($REMOTE $TRANSOPT --torrent $ID --info | grep Name:)"
echo "Downloading Torrent: $ID - ${NAME#*Name: }"
$REMOTE $TRANSOPT --torrent $ID --start --verify > /dev/null
done
fi
# Seed torrents below desired ratio if slots exist
ACTIVE="$($REMOTE $TRANSOPT -l | tail -n +2 | head -n -1 | grep -v Stopped | wc -l)"
if [ $ACTIVE -lt $MAXACTIVE ]; then
LIST="$($REMOTE $TRANSOPT -l | tail -n +2 | head -n -1 | grep 100% | tail -n $(expr $MAXACTIVE - $ACTIVE) | awk '{ print $1; }')"
RAT="$($REMOTE $TRANSOPT -l | tail -n +2 | head -n -1 | grep 100% | tail -n $(expr $MAXACTIVE - $ACTIVE) | awk '{ print $8; }')"
RAT2=$(echo $RAT | sed 's/ /\n/g' | sort -u)
for LOWEST in $RAT2; do
for ID in $LIST; do
RATIO="$($REMOTE $TRANSOPT -t $ID -i | grep Ratio | awk '{ print $2; }')"
if expr $RATIO \= $LOWEST > /dev/null; then
NAME="$($REMOTE $TRANSOPT --torrent $ID --info | grep Name:)"
echo "Seeding Torrent: $ID - ${NAME#*Name: } (Ratio $RATIO)"
$REMOTE $TRANSOPT --torrent $ID --start --verify > /dev/null
break
fi
done
done
fi
# List Active Torrents
LIST="$($REMOTE $TRANSOPT -l | tail -n +2 | head -n -1 | grep -v Stopped | awk '{ print $1; }')"
for ID in $LIST; do
NAME="$($REMOTE $TRANSOPT --torrent $ID --info | grep Name:)"
echo "Active: $ID - ${NAME#*Name: }"
done