summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks
diff options
context:
space:
mode:
authorGravatar Jeix <devnull@localhost> 2010-12-12 21:51:19 +0100
committerGravatar Jeix <devnull@localhost> 2010-12-12 21:51:19 +0100
commit5eae399d3453fe0257738c68b80e560e9714ac3f (patch)
tree61f4786da7504aea03fa703a6dd197ed9f6a418a /module/plugins/hooks
parentChat interfaces (xmpp/irc): push/pull feature (diff)
downloadpyload-5eae399d3453fe0257738c68b80e560e9714ac3f.tar.xz
small update for chat interfaces
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r--module/plugins/hooks/IRCInterface.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py
index b65a2e284..22863916b 100644
--- a/module/plugins/hooks/IRCInterface.py
+++ b/module/plugins/hooks/IRCInterface.py
@@ -194,9 +194,16 @@ class IRCInterface(Thread, Hook):
if not downloads:
return ["INFO: There are no active downloads currently."]
+ temp_progress = ""
lines = []
lines.append("ID - Name - Status - Speed - ETA - Progress")
for data in downloads:
+
+ if data['statusmsg'] == 'waiting':
+ temp_progress = data['format_wait']
+ else:
+ temp_progress = "%d%% (%s)" % (data['percent'], data['format_size'])
+
lines.append("#%d - %s - %s - %s - %s - %s" %
(
data['id'],
@@ -204,7 +211,7 @@ class IRCInterface(Thread, Hook):
data['statusmsg'],
"%.2f kb/s" % data['speed'],
"%s" % data['format_eta'],
- "%d%% (%s)" % (data['percent'], data['format_size'])
+ temp_progress
)
)
return lines
@@ -343,14 +350,14 @@ class IRCInterface(Thread, Hook):
def event_push(self, args):
if not args:
return ["ERROR: Push package to queue like this: push <package id>"]
-
+
id = int(args[0])
if not self.sm.get_package_data(id):
return ["ERROR: Package #%d does not exist." % id]
self.sm.push_package_to_queue(id)
- return ["INFO: Pushed package %d to queue." % id]
-
+ return ["INFO: Pushed package #%d to queue." % id]
+
def event_pull(self, args):
if not args:
return ["ERROR: Pull package from queue like this: pull <package id>"]
@@ -360,8 +367,8 @@ class IRCInterface(Thread, Hook):
return ["ERROR: Package #%d does not exist." % id]
self.sm.pull_out_package(id)
- return ["INFO: Pulled package %d from queue to collector." % id]
-
+ return ["INFO: Pulled package #%d from queue to collector." % id]
+
def event_help(self, args):
lines = []
lines.append("The following commands are available:")
@@ -385,4 +392,4 @@ class IRCError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
- return repr(self.value) \ No newline at end of file
+ return repr(self.value)