diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-12-10 15:44:37 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-12-10 15:44:37 +0100 |
commit | 2c7203032324820c122b1e7b77604212391f75f9 (patch) | |
tree | cc5e1b4802672a2927de922ccfe884dd93eb2e6c /module | |
parent | incomplete: gui model-view stuff (diff) | |
download | pyload-2c7203032324820c122b1e7b77604212391f75f9.tar.xz |
cleaned some code, pyLoad Script Support (closed #16)
Diffstat (limited to 'module')
-rw-r--r-- | module/captcha/LinksaveIn.py | 2 | ||||
-rw-r--r-- | module/network/Keepalive.py | 1 | ||||
-rw-r--r-- | module/plugins/HotfileCom.py | 1 | ||||
-rw-r--r-- | module/plugins/LinkList.py | 1 | ||||
-rw-r--r-- | module/plugins/RapidshareCom.py | 1 | ||||
-rw-r--r-- | module/thread_list.py | 26 | ||||
-rw-r--r-- | module/web/WebServer.py | 1 |
7 files changed, 22 insertions, 11 deletions
diff --git a/module/captcha/LinksaveIn.py b/module/captcha/LinksaveIn.py index 15ccdb1ac..d6f61e362 100644 --- a/module/captcha/LinksaveIn.py +++ b/module/captcha/LinksaveIn.py @@ -6,7 +6,6 @@ from os.path import abspath from glob import glob import tempfile -from pprint import pprint class LinksaveIn(OCR): def __init__(self): @@ -144,7 +143,6 @@ class LinksaveIn(OCR): self.clean(4) self.image.save(self.data_dir+"cleaned_pass2.png") letters = self.split_captcha_letters() - org = self.image final = "" for n, letter in enumerate(letters): self.image = letter diff --git a/module/network/Keepalive.py b/module/network/Keepalive.py index 2443f5bbf..0ab3431ad 100644 --- a/module/network/Keepalive.py +++ b/module/network/Keepalive.py @@ -609,7 +609,6 @@ def test(url, N=10): test_timeout(url) if __name__ == '__main__': - import time import sys try: N = int(sys.argv[1]) diff --git a/module/plugins/HotfileCom.py b/module/plugins/HotfileCom.py index 7ae432c78..a046cb6b1 100644 --- a/module/plugins/HotfileCom.py +++ b/module/plugins/HotfileCom.py @@ -2,7 +2,6 @@ # -*- coding: utf-8 -*- import re -import urllib from time import time from module.Plugin import Plugin diff --git a/module/plugins/LinkList.py b/module/plugins/LinkList.py index c934ca464..dba78ffd2 100644 --- a/module/plugins/LinkList.py +++ b/module/plugins/LinkList.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import re from module.Plugin import Plugin diff --git a/module/plugins/RapidshareCom.py b/module/plugins/RapidshareCom.py index f7bcb5de8..778383338 100644 --- a/module/plugins/RapidshareCom.py +++ b/module/plugins/RapidshareCom.py @@ -6,7 +6,6 @@ from time import time from module.Plugin import Plugin import hashlib -import logging class RapidshareCom(Plugin): diff --git a/module/thread_list.py b/module/thread_list.py index 3c69121c2..2faec1581 100644 --- a/module/thread_list.py +++ b/module/thread_list.py @@ -18,12 +18,12 @@ # ### from __future__ import with_statement +from os.path import exists import re import subprocess +from threading import RLock import time import urllib2 -from os.path import exists -from threading import RLock from download_thread import Download_Thread @@ -75,6 +75,7 @@ class Thread_List(object): if pyfile: self.py_downloading.append(pyfile) + self.scripts_download_preparing(pyfile.modul.__name__, pyfile.url) if not pyfile.plugin.multi_dl: self.occ_plugins.append(pyfile.modul.__name__) pyfile.active = True @@ -133,7 +134,7 @@ class Thread_List(object): pyfile.plugin.req.init_curl() elif pyfile.status.type == "failed": - self.parent.logger.warning("Download failed: " + pyfile.url+ " | " + pyfile.status.error) + self.parent.logger.warning("Download failed: " + pyfile.url + " | " + pyfile.status.error) with open(self.parent.config['general']['failed_file'], 'a') as f: f.write(pyfile.url + "\n") @@ -142,6 +143,8 @@ class Thread_List(object): self.list.save() + self.scripts_download_finished(pyfile.modul.__name__, pyfile.url, pyfile.status.filename, pyfile.download_folder) + self.lock.release() return True @@ -186,7 +189,7 @@ class Thread_List(object): return False def reconnect(self): - reconn = subprocess.Popen(self.parent.config['general']['reconnect_method']) + reconn = subprocess.Popen(self.parent.config['general']['reconnect_method'], stdout=subprocess.PIPE) reconn.wait() time.sleep(1) ip = "" @@ -197,3 +200,18 @@ class Thread_List(object): ip = "" time.sleep(1) self.parent.logger.info("Reconnected, new IP: " + ip) + + + def scripts_download_preparing(self, pluginname, url): + for script in self.parent.scripts['download_preparing']: + out = subprocess.Popen([script, pluginname, url], stdout=subprocess.PIPE) + out.wait() + + def scripts_download_finished(self, pluginname, url, filename, location): + map(lambda script: subprocess.Popen([script, pluginname, url, filename, location], stdout=subprocess.PIPE), self.parent.scripts['download_finished']) + + def scripts_package_finished(self, name, location): #@TODO Implement! + map(lambda script: subprocess.Popen([script, name, location], stdout=subprocess.PIPE), self.parent.scripts['download_finished']) + + def scripts_reconnected(self, ip): + map(lambda script: subprocess.Popen([script, ip], stdout=subprocess.PIPE), self.parent.scripts['download_finished']) diff --git a/module/web/WebServer.py b/module/web/WebServer.py index 3486bf7cb..15541676b 100644 --- a/module/web/WebServer.py +++ b/module/web/WebServer.py @@ -103,7 +103,6 @@ from bottle import route from bottle import run from bottle import send_file from bottle import template -from bottle import validate core = None |