diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-05 21:49:35 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-09-05 21:49:35 +0200 |
commit | 00b4a7e6b57f12eb5086e244948a0cd8ad0c2188 (patch) | |
tree | 28c9a2c9202dc062f95118669f5698c8b5976e32 | |
parent | italian setup file (diff) | |
download | pyload-00b4a7e6b57f12eb5086e244948a0cd8ad0c2188.tar.xz |
MU fix + others
-rw-r--r-- | module/plugins/Plugin.py | 11 | ||||
-rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 43 | ||||
-rwxr-xr-x | pyLoadCore.py | 8 | ||||
-rwxr-xr-x | pyLoadGui.py | 6 |
4 files changed, 57 insertions, 11 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 9995da59a..449a032a7 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -206,9 +206,12 @@ class Plugin(object): temp.write(content) temp.close() - - Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__) - if Ocr and not forceUser and self.core.captcha: + if self.core.captcha: + Ocr = self.core.pluginManager.getCaptchaPlugin(self.__name__) + else: + Ocr = None + + if Ocr and not forceUser: sleep(randint(3000, 5000) / 1000.0) if self.pyfile.abort: raise Abort @@ -224,7 +227,7 @@ class Plugin(object): if not self.core.isClientConnected(): task.removeTask() #temp.unlink(temp.name) - self.fail(_("No Client connected for captcha decrypting.")) + self.fail(_("No Client connected for captcha decrypting, or pil and tesseract not installed")) if self.pyfile.abort: raise Abort sleep(1) result = task.getResult() diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 8f22f4a66..94c845a08 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -55,10 +55,13 @@ class MegauploadCom(Hoster): def setup(self): self.html = [None, None] self.multiDL = False + self.api = {} def process(self, pyfile): self.pyfile = pyfile self.download_html() + self.download_api() + if not self.file_exists(): self.offline() @@ -98,17 +101,51 @@ class MegauploadCom(Hoster): if re.search(r"Waiting time before each download begins", self.html[1]) is not None: break + def download_api(self): + + url = "http://megaupload.com/mgr_linkcheck.php" + + id = self.pyfile.url.split("=")[-1] + + + post = {"id0": id} + + api = self.load(url, {}, post) + api = [x.split("&") for x in re.split(r"&?(?=id[\d]+=)", api)] + + for data in api: + if data[0].startswith("id"): + tmp = [x.split("=") for x in data] + if tmp[2][1] == "3": + status = 3 + elif tmp[0][1] == "0": + status = 2 + elif tmp[0][1] == "1": + self.offline() + else: + status = 3 + + name = tmp[3][1] + #size = tmp[1][1] + + self.api["name"] = name + self.pyfile.name = name + + def get_file_url(self): file_url_pattern = 'id="downloadlink"><a href="(.*)" onclick="' search = re.search(file_url_pattern, self.html[1]) return search.group(1).replace(" ", "%20") def get_file_name(self): - file_name_pattern = 'id="downloadlink"><a href="(.*)" onclick="' - return re.search(file_name_pattern, self.html[1]).group(1).split("/")[-1] + if not self.api: + file_name_pattern = 'id="downloadlink"><a href="(.*)" onclick="' + return re.search(file_name_pattern, self.html[1]).group(1).split("/")[-1] + else: + return self.api["name"] def file_exists(self): - self.download_html() + #self.download_html() if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) is not None or \ re.search(r"Download limit exceeded", self.html[0]) is not None: return False diff --git a/pyLoadCore.py b/pyLoadCore.py index 310c3e2e5..c1c1f8fbb 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -154,7 +154,7 @@ class Core(object): self.log.info(_("Received Quit signal")) _exit(1) - def start(self): + def start(self, xmlrpc=True, web=True): """ starts the fun :D """ if not exists("pyload.conf"): @@ -235,8 +235,10 @@ class Core(object): self.log.info(_("Downloadtime: %s") % self.server_methods.is_time_download()) - self.init_server() - self.init_webserver() + if xmlrpc: + self.init_server() + if web: + self.init_webserver() #linkFile = self.config['general']['link_file'] diff --git a/pyLoadGui.py b/pyLoadGui.py index df21555f8..c3703a1c5 100755 --- a/pyLoadGui.py +++ b/pyLoadGui.py @@ -430,11 +430,15 @@ class main(QObject): elif data["type"] == "internal": from pyLoadCore import Core + from module.ConfigParser import ConfigParser as CoreConfig import thread if not self.core: + + config = CoreConfig() #create so at least default config exists + self.core = Core() - thread.start_new_thread(self.core.start, ()) + thread.start_new_thread(self.core.start, (False,False)) self.connector.setAddr(("core", self.core)) |