You are not logged in.
I have just started a small script that can be called by conky to show stats of currently running torrents.
currently it outputs:
Torrent title (removes puncuation and makes it all upper case )
estimated time / stoped / completed / waiting / connecting to peers
TX Speed (per torrent)
RX Speed (per torrent)
script : I placed my script in ~/scripts
dir=/media/downloads ## specify download dir
cutno=30 #Specifies the number of characters to show in the title name, usefull to stop long torrent names from stretching conky
cd $dir/.torrents
echo Transfers: `ls *.stat | wc -l`
echo " "
for file in *.stat; do
echo $file | cut -f1 -d'.' | cut -c 1-$cutno | tr '_' ' ' | tr -d '[{}(),\!]' | tr -d "\'" | tr '[A-Z]' '[a-z]'; ##Displays torrent name, without puncuation
echo `cat $file | head -n 3 | tail -n 1;` : `cat $file | head -n 2 | tail -n 1;`% ##displays the current status of the torrent
echo RX speed: `cat $file | head -n 4 | tail -n 1;` ##displays the downspeed
echo TX speed: `cat $file | head -n 5 | tail -n 1;` ##displays the upspeed
echo Seeds: `cat $file | head -n 7 | tail -n 1 | cut -f1 -d'+';` ##displays the amount of seeds
echo Peers: `cat $file | head -n 8 | tail -n 1 ;` ##displays the amount of peers
echo " "
done
here is my conky rc
background yes
use_xft yes
# xft font when Xft is enabled
xftfont LucidaMacBold:size=7
override_utf8_locale yes
# Text alpha when using Xft
xftalpha 1
update_interval 1
draw_shades no
draw_outline yes
draw_borders no
stippled_borders no
border_margin 0
border_width 1
default_color BFFFB7 #3FB2C1 #CFE5D3 #BFFFB7 #B1B1B1 #FF8086 #61FFE2 #7EFFF7 #7EB6FF #BAF5FF #BFFFB7 #FFF2E6 #9DFFDD #B599FF
default_shade_color ffffff
default_outline_color 303030
own_window yes
own_window_transparent no
own_window_type widget
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
own_window_colour 121212
alignment top_left
gap_x 0
gap_y 0
no_buffers yes
uppercase no
double_buffer yes
use_spacer none
minimum_size 20 0
mail_spool $HOME/Maildir/
#${rss http://www.abc.net.au/news/indexes/idx-australia/rss.xml 60 feed_title}
TEXT
${font LucidaGrande:size=10}${color ffffff}Current Downloads
${font}${execi 10 /home/mark/scripts/torrentstats.sh}
here is a screen shot of my conky.
as u can see my ISP throttle my torrernt traffic (the main reason i want to monitor it constantly), hence the slow downloads
any thing that doesnt seem right, tell me and i will see what i can do.
I am planing to add extra features to it, such as total download / upload soonish.
PS if this is the wrong section, please move it.
Last edited by markp1989 (2008-12-30 20:19:42)
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline
Made a few changes to the script
changes: added ability to show total down/up speed, the size
now curl is required
#!/bin/bash
dir=/media/torrents ## replace with torrentflux download dir can be on this computer, or mounted over nfs
cutno=30 #Specifies the number of characters to show in the title name, usefull to stop
host=127.0.0.1/torrentflux ## the address of your torrent flu
user=******
pass=******
curl -c .tf_cookie -d username=$user -d iamhim=$pass $host/login.php >/dev/null 2>&1
curl -H "Expect:" -b .tf_cookie $host/index.php > .torrentstats.tmp # uses curl to dump the torrent page to file
echo Down Speed `cat .torrentstats.tmp | grep -i '<strong' | tail -n 4| head -n 1 | cut -f3 -d'>' | cut -f1 -d'<';` #Total down
echo Up Speed `cat .torrentstats.tmp | grep -i '<strong' | tail -n 3| head -n 1 | cut -f3 -d'>' | cut -f1 -d'<';` # Total up
echo Free Space `cat .torrentstats.tmp | grep -i '<strong' | tail -n 2| head -n 1 | cut -f3 -d'>' | cut -f1 -d'<';` # remaining space
cd $dir/.torrents
echo Transfers: `ls *.stat | wc -l` ##counts the amount transfers
echo " "
for file in *.stat; do
size=`cat $file | tail -n 1;`
echo $file | cut -f1 -d'.' | cut -c 1-$cutno | tr '_' ' ' | tr -d '[{}(),\!]' | tr -d "\'" | tr '[a-z]' '[A-Z]'; ## displays torrent names
echo `cat $file | head -n 3 | tail -n 1 | tr '[a-z]' '[A-Z]';` : `cat $file | head -n 2 | tail -n 1;`% ## displays the status
echo RX speed: `cat $file | head -n 4 | tail -n 1;` ##displays the current download speed per torrent
echo TX speed: `cat $file | head -n 5 | tail -n 1;` ##displays the current upload speed per torrent
echo size: `expr $size / 1048576` MB ##displays the file size
echo Seeds: `cat $file | head -n 7 | tail -n 1 | cut -f1 -d'+';` ##displays the amount of seeds
echo Peers: `cat $file | head -n 8 | tail -n 1 ;` ##displays the amount of peers
echo " "
done
screen
Any feed back will be appriciated.
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline
Changes:
changed all incorect "cat $file | grep" to "grep $file" which should save a little bit of resorces.
fixed the size line, so that if there are errors on the download, it doesnt give an expr error in the size feild.
#!/bin/dash
dir=/media/downloads ## replace with torrentflux download dir
cutno=26 #Specifies the number of characters to show in the title name
host=http://192.168.1.99/torrentflux
user=mark
pass=*****
rm .tf_cookie
curl -c .tf_cookie -d username=$user -d iamhim=$pass $host/login.php >/dev/null 2>&1
curl -H "Expect:" -b .tf_cookie $host/index.php >/dev/null 2>&1 > .torrentstats.tmp
echo RX Speed `grep -i '<strong' .torrentstats.tmp | tail -n 4| head -n 1 | cut -f3 -d'>' | cut -f1 -d'<';` Kb/s
echo TX Speed `grep -i '<strong' .torrentstats.tmp | tail -n 3| head -n 1 | cut -f3 -d'>' | cut -f1 -d'<';` Kb/s
echo Free Space `grep -i '<strong' .torrentstats.tmp | tail -n 2| head -n 1 | cut -f3 -d'>' | cut -f1 -d'<';`
cd $dir/.torrents
echo Transfers: `ls *.stat | wc -l` ##counts the amount transfers
echo " "
for file in *.stat; do
if grep -qw $user $file ; then
size=`head -n 13 $file | tail -n 1;`
echo $file | cut -f1 -d'.' | cut -c 1-$cutno | tr '_' ' ' | tr -d '[{}(),\!]' | tr -d "\'" | tr '[a-z]' '[A-Z]'; ## displays torrent names, in upper case, without any puncuation
echo `head -n 3 $file | tail -n 1 | tr '[a-z]' '[A-Z]';` : `cat $file | head -n 2 | tail -n 1;`% ## displays the status of the torrent
echo RX speed: `head -n 4 $file | tail -n 1;` ##displays the current download speed per torrent
echo TX speed: `head -n 5 $file | tail -n 1;` ##displays the current upload speed per torrent
echo size: `expr $size / 1048576` MB ##displays the file size
echo Seeds: `head -n 7 $file | tail -n 1 | cut -f1 -d'+';` ##displays the amount of seeds
echo Peers: `head -n 8 $file| tail -n 1 ;` ##displays the amount of peers
echo " "
else
echo "not mine" >/dev/null
fi
done
Desktop: E8400@4ghz - DFI Lanparty JR P45-T2RS - 4gb ddr2 800 - 30gb OCZ Vertex - Geforce 8800 GTS - 2*19" LCD
Server/Media Zotac GeForce 9300-ITX I-E - E5200 - 4gb Ram - 2* ecogreen F2 1.5tb - 1* wd green 500gb - PicoPSU 150xt - rtorrent - xbmc - ipazzport remote - 42" LCD
Offline