Welcome

Hi there my name is Alan MacGregor and this is my blog, hope you enjoy it :)

31 Jan 2009

Viewing Current Transfers in torrentflux-b4rt

I haven't used torrentflux-b4rt in a while on my server mainly due to the fact that it was slightly unstable on my machine however there are still people who use it, for those that do I have a little present.

This python script will display the current transfers of the torrents that are running, all you need to specify is where fluxcli.php is located, as with all my scripts this is free to use in whatever you want, have fun

#!/usr/bin/python

# import modules
import os

os.system("clear")

# Initialise Variables
fluxcli = "/var/www/torrent/bin/fluxcli.php"
temp = "/tmp/current_trans"

print "-------------------------------"
print "------ Current Transfers ------"
print "-------------------------------"

os.system("rm " + temp)
os.system(fluxcli + " transfers >> " + temp)

f = open(temp, 'r')

seeding = []
leeching = []


all_lines = f.readlines()
## Get Number Of Lines
number = 0
for line in all_lines[2:]:
number = number + 1

for line in all_lines[2:number - 3]:

line = line.split("\n")
line = line[0]
line = line.split("- ")
if "0.0 kB/s " == line[8] and line[9]:
templine = ""
elif line[12] == "Download Succeeded! ":
templine = ""
elif line[12] == "Download Succeeded ":
templine = ""
elif line[12] == "Torrent Stopped ":
templine = ""
elif line[12] == "Transfer Died ":
templine = ""
elif line[9] == "- ":
templine = ""
elif line[12] == "Stopped ":
templine = ""
elif line[12] == "repaired ":
templine = ""
else:
leeching.append(line[2] + line[1] + line[8])
if "0.0 kB/s " == line[9] and line[8]:
templine = ""
elif line[12] == "Download Succeeded! ":
templine = ""
elif line[12] == "Download Succeeded ":
templine = ""
elif line[12] == "Torrent Stopped ":
templine = ""
elif line[12] == "Stopped ":
templine = ""
elif line[12] == "Transfer Died ":
templine = ""
elif line[9] == "- ":
templine = ""
elif line[12] == "repaired ":
templine = ""
else:
seeding.append(line[2] + line[1] + line[9])

print "Leeching:"
for i in range(len(leeching)):
print leeching[i]
print "-------"
print "Seeding:"
for i in range(len(seeding)):
print seeding[i]

No comments:

Template by - Abdul Munir | Daya Earth Blogger Template