summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-05-14 15:37:58 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-05-14 15:37:58 +0200
commit9973f09a616900ab0900974da77d22b566598b5f (patch)
tree0669cdda0a367e1b53b7286f19b6aaf1b9e4004a /module/plugins/hooks
parentrevert premium account change see #309 (diff)
downloadpyload-9973f09a616900ab0900974da77d22b566598b5f.tar.xz
improved some code style issues
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r--module/plugins/hooks/ClickAndLoad.py26
-rw-r--r--module/plugins/hooks/ExternalScripts.py17
-rw-r--r--module/plugins/hooks/IRCInterface.py34
3 files changed, 37 insertions, 40 deletions
diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py
index 0ca492cb7..97e5cd57d 100644
--- a/module/plugins/hooks/ClickAndLoad.py
+++ b/module/plugins/hooks/ClickAndLoad.py
@@ -27,31 +27,32 @@ class ClickAndLoad(Hook):
__name__ = "ClickAndLoad"
__version__ = "0.2"
__description__ = """Gives abillity to use jd's click and load. depends on webinterface"""
- __config__ = [ ("activated", "bool", "Activated" , "True"),
- ("extern", "bool", "Allow external link adding", "False") ]
+ __config__ = [("activated", "bool", "Activated", "True"),
+ ("extern", "bool", "Allow external link adding", "False")]
__author_name__ = ("RaNaN", "mkaay")
__author_mail__ = ("RaNaN@pyload.de", "mkaay@mkaay.de")
-
+
def coreReady(self):
- self.port = int(self.core.config['webinterface']['port'])
+ self.port = int(self.core.config['webinterface']['port'])
if self.core.config['webinterface']['activated']:
try:
- if self.getConfig("extern"):
- ip = "0.0.0.0"
- else:
- ip = "127.0.0.1"
-
+ if self.getConfig("extern"):
+ ip = "0.0.0.0"
+ else:
+ ip = "127.0.0.1"
+
thread.start_new_thread(proxy, (self, ip, self.port, 9666))
except:
self.log.error("ClickAndLoad port already in use.")
def proxy(self, *settings):
- thread.start_new_thread(server, (self,)+settings)
+ thread.start_new_thread(server, (self,) + settings)
lock = thread.allocate_lock()
lock.acquire()
lock.acquire()
+
def server(self, *settings):
try:
dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -72,9 +73,10 @@ def server(self, *settings):
if errno == 98:
self.core.log.warning(_("Click'N'Load: Port 9666 already in use"))
return
- thread.start_new_thread(server, (self,)+settings)
+ thread.start_new_thread(server, (self,) + settings)
except:
- thread.start_new_thread(server, (self,)+settings)
+ thread.start_new_thread(server, (self,) + settings)
+
def forward(source, destination):
string = ' '
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py
index 8d749b5bd..63ff2b170 100644
--- a/module/plugins/hooks/ExternalScripts.py
+++ b/module/plugins/hooks/ExternalScripts.py
@@ -49,18 +49,15 @@ class ExternalScripts(Hook):
self.core.check_file(script_folders, _("folders for scripts"), True)
f = lambda x: False if x.startswith("#") or x.endswith("~") else True
- self.scripts = {}
-
-
- self.scripts['download_preparing'] = filter(f, listdir(join(folder, 'download_preparing')))
- self.scripts['download_finished'] = filter(f, listdir(join(folder, 'download_finished')))
- self.scripts['package_finished'] = filter(f, listdir(join(folder, 'package_finished')))
- self.scripts['before_reconnect'] = filter(f, listdir(join(folder, 'before_reconnect')))
- self.scripts['after_reconnect'] = filter(f, listdir(join(folder, 'after_reconnect')))
- self.scripts['unrar_finished'] = filter(f, listdir(join(folder, 'unrar_finished')))
+ self.scripts = {'download_preparing': filter(f, listdir(join(folder, 'download_preparing'))),
+ 'download_finished': filter(f, listdir(join(folder, 'download_finished'))),
+ 'package_finished': filter(f, listdir(join(folder, 'package_finished'))),
+ 'before_reconnect': filter(f, listdir(join(folder, 'before_reconnect'))),
+ 'after_reconnect': filter(f, listdir(join(folder, 'after_reconnect'))),
+ 'unrar_finished': filter(f, listdir(join(folder, 'unrar_finished')))}
for script_type, script_name in self.scripts.iteritems():
- if script_name != []:
+ if script_name:
self.log.info("Installed %s Scripts: %s" % (script_type, ", ".join(script_name)))
#~ self.core.logger.info("Installed Scripts: %s" % str(self.scripts))
diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py
index 31d693018..0142c3610 100644
--- a/module/plugins/hooks/IRCInterface.py
+++ b/module/plugins/hooks/IRCInterface.py
@@ -132,7 +132,7 @@ class IRCInterface(Thread, Hook):
line = line.rstrip()
first = line.split()
- if(first[0] == "PING"):
+ if first[0] == "PING":
self.sock.send("PONG %s\r\n" % first[1])
if first[0] == "ERROR":
@@ -213,8 +213,7 @@ class IRCInterface(Thread, Hook):
return ["INFO: There are no active downloads currently."]
temp_progress = ""
- lines = []
- lines.append("ID - Name - Status - Speed - ETA - Progress")
+ lines = ["ID - Name - Status - Speed - ETA - Progress"]
for data in downloads:
if data['statusmsg'] == 'waiting':
@@ -401,21 +400,20 @@ class IRCInterface(Thread, Hook):
def event_help(self, args):
- lines = []
- lines.append("The following commands are available:")
- lines.append("add <package|packid> <links> [...] Adds link to package. (creates new package if it does not exist)")
- lines.append("queue Shows all packages in the queue")
- lines.append("collector Shows all packages in collector")
- lines.append("del -p|-l <id> [...] Deletes all packages|links with the ids specified")
- lines.append("info <id> Shows info of the link with id <id>")
- lines.append("packinfo <id> Shows info of the package with id <id>")
- lines.append("more Shows more info when the result was truncated")
- lines.append("start Starts all downloads")
- lines.append("stop Stops the download (but not abort active downloads)")
- lines.append("push <id> Push package to queue")
- lines.append("pull <id> Pull package from queue")
- lines.append("status Show general download status")
- lines.append("help Shows this help message")
+ lines = ["The following commands are available:",
+ "add <package|packid> <links> [...] Adds link to package. (creates new package if it does not exist)",
+ "queue Shows all packages in the queue",
+ "collector Shows all packages in collector",
+ "del -p|-l <id> [...] Deletes all packages|links with the ids specified",
+ "info <id> Shows info of the link with id <id>",
+ "packinfo <id> Shows info of the package with id <id>",
+ "more Shows more info when the result was truncated",
+ "start Starts all downloads",
+ "stop Stops the download (but not abort active downloads)",
+ "push <id> Push package to queue",
+ "pull <id> Pull package from queue",
+ "status Show general download status",
+ "help Shows this help message"]
return lines