import sys import xmlrpc2scgi as xs rtorrent_host scgi localhost 5000

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
import sys
import xmlrpc2scgi as xs
rtorrent_host='scgi://localhost:5000'
rtc = xs.RTorrentXMLRPCClient(rtorrent_host)
def speed_to_str(b):
ui = 0
units = ['MB/s','KB/s','B/s']
scale = 1024*1024
while (b < scale and scale > 1):
ui = ui + 1
scale = scale / 1024
return b/scale, units[ui]
for infohash in rtc.download_list('incomplete'):
down_rate = speed_to_str(rtc.d.get_down_rate(infohash))
print down_rate
#up_rate = speed_to_str(0)
#print up_rate[0], up_rate[1]