diff options
author | spoob <spoob@gmx.de> | 2009-06-14 23:38:15 +0200 |
---|---|---|
committer | spoob <spoob@gmx.de> | 2009-06-14 23:38:15 +0200 |
commit | f01b73235fb54fd5a26aaddca8bf35be740eef0f (patch) | |
tree | 554b9a819b0fe080d2c426dca4eaf681c594df59 /pyLoadCli.py | |
parent | Merge with 80e6af340ebfdd0c054e6d2016802698a4730b1d (diff) | |
download | pyload-f01b73235fb54fd5a26aaddca8bf35be740eef0f.tar.xz |
many little changes
Diffstat (limited to 'pyLoadCli.py')
-rw-r--r-- | pyLoadCli.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/pyLoadCli.py b/pyLoadCli.py index d5c2d9f60..0a68cfc45 100644 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -33,19 +33,41 @@ class pyLoadCli: inp = raw_input() print inp[-1] + def format_time(self, seconds): + seconds = int(seconds) + if seconds > 60: + hours, seconds = divmod(seconds, 3600) + minutes, seconds = divmod(seconds, 60) + return "%.2i:%.2i:%.2i" % (hours, minutes, seconds) + return _("%i seconds") % seconds + def data_arrived(self, obj): """Handle incoming data""" if obj.command == "update": - print str(obj.data) - + #print obj.data + print "\033[2;0H%s Downloads" % (len(obj.data)) + line = 2 + for download in obj.data: + if download["status"] == "downloading": + percent = download["percent"] + z = percent/2 + print "\033["+str(line)+";0H[" + z*"#" + (50-z)*" " + "] " + str(percent) + "% of " + download["name"] + line += 1 + line += 2 + print("\033[" + str(line) + ";0HMeldungen:") + for download in obj.data: + if download["status"] == "waiting": + print "\033["+str(line)+";0HWarte %s auf Downlod Ticket für %s" % (self.format_time(download["wait_until"]), download["name"]) + line += 1 if __name__ == "__main__": if len(sys.argv) != 4: address = raw_input("Adress:") port = raw_input("Port:") - pw = raw_input("Password:") - cli = pyLoadCli(adress,port,pw) + password = raw_input("Password:") + #address = "localhost" + #port = "7272" + #password = "pwhere" + cli = pyLoadCli(address,port,password) else: cli = pyLoadCli(*sys.argv[1:]) - - |