From 78f061eed59e084f001f8a0cd9c5b585f6fc0ce0 Mon Sep 17 00:00:00 2001 From: mkaay Date: Fri, 4 Dec 2009 20:01:17 +0100 Subject: fixes, minimal gui changes --- module/Plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index 7b726c3ac..f343dc62f 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -89,7 +89,10 @@ class Plugin(): return self.parent.url def get_file_name(self): - return re.findall("([^\/=]+)", self.parent.url)[-1] + try: + return re.findall("([^\/=]+)", self.parent.url)[-1] + except: + return "no_name" def wait_until(self): if self.html != None: -- cgit v1.2.3 From de5a37e0ffc97bc5893077f935429ba32a9b8f6c Mon Sep 17 00:00:00 2001 From: spoob Date: Tue, 15 Dec 2009 23:37:20 +0100 Subject: Incomplete: Rapidshare Folder --- module/Plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index f343dc62f..14a480e3b 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -99,8 +99,8 @@ class Plugin(): self.download_html() return self.time_plus_wait - def proceed(self, url, location, folder=""): - self.req.download(url, location, folder) + def proceed(self, url, location): + self.req.download(url, location) def set_config(self): pass -- cgit v1.2.3 From ed14601a9a83439ce096441ad7ca7a8c4d9b13f8 Mon Sep 17 00:00:00 2001 From: spoob Date: Sat, 19 Dec 2009 20:50:26 +0100 Subject: Fixed file_exists function for local files --- module/Plugin.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index 14a480e3b..8e5bbcfe8 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -20,6 +20,8 @@ import ConfigParser import logging import re +from os.path import exists + from module.network.Request import Request @@ -54,7 +56,7 @@ class Plugin(): pyfile.status.exists = self.file_exists() if not pyfile.status.exists: - raise Exception, "The file was not found on the server." + raise Exception, "File not found" return False pyfile.status.filename = self.get_file_name() @@ -75,12 +77,15 @@ class Plugin(): def download_html(self): """ gets the url from self.parent.url saves html in self.html and parses """ - html = "" - self.html = html + self.html = "" def file_exists(self): """ returns True or False """ + if re.search(r"(?!http://).*\.(dlc|ccf|rsdf|txt)", self.parent.url): + return exists(self.parent.url) + elif re.search(r"Not Found", self.parent.url): + return False return True def get_file_url(self): @@ -92,7 +97,7 @@ class Plugin(): try: return re.findall("([^\/=]+)", self.parent.url)[-1] except: - return "no_name" + return self.parent.url[:20] def wait_until(self): if self.html != None: -- cgit v1.2.3 From 73ce2440528681c713085c2ffb1947718e9022c5 Mon Sep 17 00:00:00 2001 From: spoob Date: Sat, 19 Dec 2009 22:23:29 +0100 Subject: Fixed normal hoster file_exists function --- module/Plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index 8e5bbcfe8..3285ae8dd 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -84,7 +84,8 @@ class Plugin(): """ if re.search(r"(?!http://).*\.(dlc|ccf|rsdf|txt)", self.parent.url): return exists(self.parent.url) - elif re.search(r"Not Found", self.parent.url): + header = self.req.load(self.parent.url, just_header=True) + if re.search(r"HTTP/1.1 404 Not Found", header): return False return True -- cgit v1.2.3 From a5ff0482ede8bd7bd932482887f2f7cdae5039d9 Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 23 Dec 2009 00:04:36 +0100 Subject: core: downloadlimit is not far away ;) gui: restart download action --- module/Plugin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index 3285ae8dd..7e6ca4e35 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -85,8 +85,11 @@ class Plugin(): if re.search(r"(?!http://).*\.(dlc|ccf|rsdf|txt)", self.parent.url): return exists(self.parent.url) header = self.req.load(self.parent.url, just_header=True) - if re.search(r"HTTP/1.1 404 Not Found", header): - return False + try: + if re.search(r"HTTP/1.1 404 Not Found", header): + return False + except: + pass return True def get_file_url(self): -- cgit v1.2.3 From 15841561a8e5650d88e4af477b8e4f8f96a81253 Mon Sep 17 00:00:00 2001 From: mkaay Date: Sat, 26 Dec 2009 21:17:45 +0100 Subject: pluginconfig now in xml --- module/Plugin.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index 7e6ca4e35..9390cbe07 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -20,15 +20,16 @@ import ConfigParser import logging import re -from os.path import exists +from os.path import exists, join from module.network.Request import Request +from module.XMLConfigParser import XMLConfigParser class Plugin(): def __init__(self, parent): - self.parser = ConfigParser.SafeConfigParser() + self.configparser = XMLConfigParser(join("module","config","plugin.xml"), join("module","config","plugin_default.xml")) self.config = {} props = {} props['name'] = "BasePlugin" @@ -112,19 +113,19 @@ class Plugin(): self.req.download(url, location) def set_config(self): - pass + for k, v in self.config: + self.configparser.set(self.props['name'], k, v) def get_config(self, value): - self.parser.read("pluginconfig") - return self.parser.get(self.props['name'], value) + self.configparser.loadData() + return self.configparser.get(self.props['name'], value) def read_config(self): - self.parser.read("pluginconfig") - - if self.parser.has_section(self.props['name']): - for option in self.parser.options(self.props['name']): - self.config[option] = self.parser.get(self.props['name'], option, raw=True) - self.config[option] = False if self.config[option].lower() == 'false' else self.config[option] + self.configparser.loadData() + try: + self.config = self.configparser.getConfig()[self.props['name']] + except: + pass def init_ocr(self): modul = __import__("module.captcha." + self.props['name'], fromlist=['captcha']) -- cgit v1.2.3 From ce2a8294b5aefe4497c88f24c817084868b8b1eb Mon Sep 17 00:00:00 2001 From: mkaay Date: Mon, 28 Dec 2009 15:32:06 +0100 Subject: gui now stable --- module/Plugin.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index 9390cbe07..f3830595d 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -1,23 +1,22 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- -# -#Copyright (C) 2009 kingzero, RaNaN -# -#This program is free software; you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation; either version 3 of the License, -#or (at your option) any later version. -# -#This program is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -#See the GNU General Public License for more details. -# -#You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -### -import ConfigParser + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: RaNaN, spoob, mkaay +""" + import logging import re from os.path import exists, join -- cgit v1.2.3 From 7c28259f92c2b3c608583ff128a5ae4134d4c48f Mon Sep 17 00:00:00 2001 From: mkaay Date: Wed, 30 Dec 2009 17:33:14 +0100 Subject: moved captcha stuff, extended serienjunkies, some other stuff --- module/Plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index f3830595d..c33e0d565 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -32,7 +32,7 @@ class Plugin(): self.config = {} props = {} props['name'] = "BasePlugin" - props['version'] = "0.2" + props['version'] = "0.3" props['pattern'] = None props['type'] = "hoster" props['description'] = """Base Plugin""" @@ -47,6 +47,7 @@ class Plugin(): self.multi_dl = True self.ocr = None #captcha reader instance self.logger = logging.getLogger("log") + self.decryptNow = True def prepare(self, thread): pyfile = self.parent @@ -127,7 +128,7 @@ class Plugin(): pass def init_ocr(self): - modul = __import__("module.captcha." + self.props['name'], fromlist=['captcha']) + modul = __import__("module.plugins.captcha." + self.props['name'], fromlist=['captcha']) captchaClass = getattr(modul, self.props['name']) self.ocr = captchaClass() -- cgit v1.2.3 From ae4f0dfc38c49e19ef2b290f0974df9923bf1b94 Mon Sep 17 00:00:00 2001 From: mkaay Date: Sun, 3 Jan 2010 16:21:53 +0100 Subject: SecuredIn plugin --- module/Plugin.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index c33e0d565..7854aa66d 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -21,10 +21,13 @@ import logging import re from os.path import exists, join +from time import sleep from module.network.Request import Request from module.XMLConfigParser import XMLConfigParser +from module.download_thread import CaptchaError + class Plugin(): def __init__(self, parent): @@ -145,3 +148,17 @@ class Plugin(): 20 - unknown error """ return (True, 10) + + def waitForCaptcha(self, captchaData, imgType): + captchaManager = self.parent.core.captchaManager + task = captchaManager.newTask(self) + task.setCaptcha(captchaData, imgType) + task.setWaiting() + while not task.getStatus() == "done": + if not self.parent.core.isGUIConnected(): + task.removeTask() + raise CaptchaError + sleep(1) + result = task.getResult() + task.removeTask() + return result -- cgit v1.2.3 From 205c200b94f3b4edf1220a9ffd5ebeab58aa098b Mon Sep 17 00:00:00 2001 From: spoob Date: Thu, 7 Jan 2010 19:05:42 +0100 Subject: Better ConfigParser --- module/Plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index 7854aa66d..45371c3af 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -31,7 +31,7 @@ from module.download_thread import CaptchaError class Plugin(): def __init__(self, parent): - self.configparser = XMLConfigParser(join("module","config","plugin.xml"), join("module","config","plugin_default.xml")) + self.configparser = XMLConfigParser(join("module","config","plugin.xml")) self.config = {} props = {} props['name'] = "BasePlugin" -- cgit v1.2.3 From 324ed3da96b07d42da753d1314495724ef4c2b7a Mon Sep 17 00:00:00 2001 From: spoob Date: Wed, 13 Jan 2010 11:18:03 +0100 Subject: removed Mp3Convert, just load plugin config once --- module/Plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index 45371c3af..2e61a1b55 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -31,7 +31,7 @@ from module.download_thread import CaptchaError class Plugin(): def __init__(self, parent): - self.configparser = XMLConfigParser(join("module","config","plugin.xml")) + self.configparser = parent.core.parser_plugins self.config = {} props = {} props['name'] = "BasePlugin" -- cgit v1.2.3 From 4eb1404eca2b795d809ee626a057a543043060cb Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 21 Jan 2010 22:13:21 +0100 Subject: some optimizations --- module/Plugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/Plugin.py') diff --git a/module/Plugin.py b/module/Plugin.py index 2e61a1b55..5006da8dd 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -19,12 +19,11 @@ import logging import re -from os.path import exists, join +from os.path import exists from time import sleep from module.network.Request import Request -from module.XMLConfigParser import XMLConfigParser from module.download_thread import CaptchaError -- cgit v1.2.3