From 2bb8e1913e46f9c313619a83790bb6f1332e7256 Mon Sep 17 00:00:00 2001 From: Marius Sandu-Popa Date: Fri, 30 Apr 2010 18:47:13 +0300 Subject: [PATCH] autorun:updated Commander --- autorun/commander/Commander.py | 15 +++++++++------ autorun/commander/XMLParser.py | 5 +++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/autorun/commander/Commander.py b/autorun/commander/Commander.py index 6b34ade..72360ab 100644 --- a/autorun/commander/Commander.py +++ b/autorun/commander/Commander.py @@ -161,7 +161,10 @@ class Commander(Thread): if ret: self.printNodeInfo(node) for l in ret: - print " -" + l[0] + " client(pid:" + str(l[1]) +") on \"" + l[2] +"\"" + si = self.swarm.getSIByPid(l[1]) + if si: + self.printClientInfo(si) + print "\t|-" + "with pid:" + str(l[1]) +" on \"" + l[2] +"\"" def getNodeOutput(self, node): ret = self.Commander.getOutput(node.public_address, @@ -169,9 +172,9 @@ class Commander(Thread): if ret: self.printNodeInfo(node) for l in ret: - print " -" + l[0] + " client on \"" + l[1] + "\" outputs at:" + print " |-" + l[0] + " client on \"" + l[1] + "\" outputs at:" for ll in l[2:]: - print "\t" + ll[1] + ": "+ll[0] + print "\t|-" + ll[1] + ": "+ll[0] print "" def nodeArchive(self, node): @@ -180,7 +183,7 @@ class Commander(Thread): if ret: self.printNodeInfo(node) for l in ret: - print " archiving ... " +l + print " |-archiving ... " +l def cleanNode(self, node): pass @@ -247,8 +250,8 @@ class Commander(Thread): ":" +node.listen_port +')' def printClientInfo(self, si): - print ' - client ' + si.id +' (' + si.btclient + ', Down:' + si.download_limit + \ - " KB/s" + ", Up:" +si.upload_limit + " KB/s" + ' )' + print ' |-client ' + si.id +' (' + si.btclient + ', Down:' + si.download_limit + \ + " KB/s" + ", Up:" +si.upload_limit + " KB/s" + ')' def about(self): print "Commander version 1.1" diff --git a/autorun/commander/XMLParser.py b/autorun/commander/XMLParser.py index 0077364..7f8105c 100644 --- a/autorun/commander/XMLParser.py +++ b/autorun/commander/XMLParser.py @@ -113,6 +113,11 @@ class Swarm: if si.id == id: return si + def getSIByPid(self, pid): + for si in self.swarm: + if si.pid == pid: + return si + def getTorrentFile(self): return self.torrent_file -- 2.20.1