diff options
Diffstat (limited to 'module/plugins')
382 files changed, 2234 insertions, 2011 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py index c147404e0..f8014908f 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -1,29 +1,13 @@ # -*- coding: utf-8 -*- -""" - 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 <http://www.gnu.org/licenses/>. - - @author: mkaay -""" - from random import choice from time import time from traceback import print_exc from threading import RLock -from Plugin import Base -from module.utils import compare_time, parseFileSize, lock +from pyload.plugin.Plugin import Base +from pyload.utils import compare_time, parseFileSize, lock + class WrongPassword(Exception): pass @@ -35,17 +19,19 @@ class Account(Base): Just overwrite `login` and cookies will be stored and account becomes accessible in\ associated hoster plugin. Plugin should also provide `loadAccountInfo` """ - __name__ = "Account" - __version__ = "0.2" - __type__ = "account" - __description__ = """Account Plugin""" - __author_name__ = ("mkaay") - __author_mail__ = ("mkaay@mkaay.de") + __name__ = "Account" + __type__ = "account" + __version__ = "0.03" + + __description__ = """Base account plugin""" + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] - #: after that time [in minutes] pyload will relogin the account - login_timeout = 600 - #: account data will be reloaded after this time - info_threshold = 600 + + #: after that time (in minutes) pyload will relogin the account + login_timeout = 10 * 60 + #: after that time (in minutes) account data will be reloaded + info_threshold = 10 * 60 def __init__(self, manager, accounts): @@ -53,16 +39,19 @@ class Account(Base): self.manager = manager self.accounts = {} - self.infos = {} # cache for account information + self.infos = {} #: cache for account information self.lock = RLock() - self.timestamps = {} - self.setAccounts(accounts) + self.init() + self.setAccounts(accounts) + + def init(self): pass + def login(self, user, data, req): """login into account, the cookies will be saved so user can be recognized @@ -72,29 +61,34 @@ class Account(Base): """ pass + @lock def _login(self, user, data): # set timestamp for login self.timestamps[user] = time() - + req = self.getAccountRequest(user) try: self.login(user, data, req) except WrongPassword: self.logWarning( - _("Could not login with account %(user)s | %(msg)s") % {"user": user - , "msg": _("Wrong Password")}) - data["valid"] = False - + _("Could not login with account %(user)s | %(msg)s") % {"user": user, + "msg": _("Wrong Password")}) + success = data['valid'] = False except Exception, e: self.logWarning( - _("Could not login with account %(user)s | %(msg)s") % {"user": user - , "msg": e}) - data["valid"] = False + _("Could not login with account %(user)s | %(msg)s") % {"user": user, + "msg": e}) + success = data['valid'] = False if self.core.debug: print_exc() + else: + success = True finally: - if req: req.close() + if req: + req.close() + return success + def relogin(self, user): req = self.getAccountRequest(user) @@ -104,7 +98,8 @@ class Account(Base): if user in self.infos: del self.infos[user] #delete old information - self._login(user, self.accounts[user]) + return self._login(user, self.accounts[user]) + def setAccounts(self, accounts): self.accounts = accounts @@ -112,24 +107,26 @@ class Account(Base): self._login(user, data) self.infos[user] = {} + def updateAccounts(self, user, password=None, options={}): """ updates account and return true if anything changed """ if user in self.accounts: - self.accounts[user]["valid"] = True #do not remove or accounts will not login + self.accounts[user]['valid'] = True #do not remove or accounts will not login if password: - self.accounts[user]["password"] = password + self.accounts[user]['password'] = password self.relogin(user) return True if options: - before = self.accounts[user]["options"] - self.accounts[user]["options"].update(options) - return self.accounts[user]["options"] != before + before = self.accounts[user]['options'] + self.accounts[user]['options'].update(options) + return self.accounts[user]['options'] != before else: self.accounts[user] = {"password": password, "options": options, "valid": True} self._login(user, self.accounts[user]) return True + def removeAccount(self, user): if user in self.accounts: del self.accounts[user] @@ -138,6 +135,7 @@ class Account(Base): if user in self.timestamps: del self.timestamps[user] + @lock def getAccountInfo(self, name, force=False): """retrieve account infos for an user, do **not** overwrite this method!\\ @@ -159,12 +157,14 @@ class Account(Base): raise Exception("Wrong return format") except Exception, e: infos = {"error": str(e)} + print_exc() - if req: req.close() + if req: + req.close() - self.logDebug("Account Info: %s" % str(infos)) + self.logDebug("Account Info: %s" % infos) - infos["timestamp"] = time() + infos['timestamp'] = time() self.infos[name] = infos elif "timestamp" in self.infos[name] and self.infos[name][ "timestamp"] + self.info_threshold * 60 < time(): @@ -174,9 +174,11 @@ class Account(Base): data.update(self.infos[name]) return data + def isPremium(self, user): info = self.getAccountInfo(user) - return info["premium"] + return info['premium'] + def loadAccountInfo(self, name, req=None): """this should be overwritten in account plugin,\ @@ -186,22 +188,22 @@ class Account(Base): :param req: `Request` instance :return: """ - return { - "validuntil": None, # -1 for unlimited - "login": name, - #"password": self.accounts[name]["password"], #@XXX: security - "options": self.accounts[name]["options"], - "valid": self.accounts[name]["valid"], - "trafficleft": None, # in kb, -1 for unlimited - "maxtraffic": None, - "premium": True, #useful for free accounts - "timestamp": 0, #time this info was retrieved - "type": self.__name__, - } + return {"validuntil" : None, #: -1 for unlimited + "login" : name, + # "password" : self.accounts[name]['password'], #: commented due security reason + "options" : self.accounts[name]['options'], + "valid" : self.accounts[name]['valid'], + "trafficleft": None, #: in bytes, -1 for unlimited + "maxtraffic" : None, + "premium" : None, + "timestamp" : 0, #: time this info was retrieved + "type" : self.__name__} + def getAllAccounts(self, force=False): return [self.getAccountInfo(user, force) for user, data in self.accounts.iteritems()] + def getAccountRequest(self, user=None): if not user: user, data = self.selectAccount() @@ -211,6 +213,7 @@ class Account(Base): req = self.core.requestFactory.getRequest(self.__name__, user) return req + def getAccountCookies(self, user=None): if not user: user, data = self.selectAccount() @@ -220,31 +223,33 @@ class Account(Base): cj = self.core.requestFactory.getCookieJar(self.__name__, user) return cj + def getAccountData(self, user): return self.accounts[user] + def selectAccount(self): """ returns an valid account name and data""" usable = [] for user, data in self.accounts.iteritems(): - if not data["valid"]: continue + if not data['valid']: continue - if "time" in data["options"] and data["options"]["time"]: + if "time" in data['options'] and data['options']['time']: time_data = "" try: - time_data = data["options"]["time"][0] + time_data = data['options']['time'][0] start, end = time_data.split("-") if not compare_time(start.split(":"), end.split(":")): continue - except: + except Exception: self.logWarning(_("Your Time %s has wrong format, use: 1:22-3:44") % time_data) if user in self.infos: if "validuntil" in self.infos[user]: - if self.infos[user]["validuntil"] > 0 and time() > self.infos[user]["validuntil"]: + if self.infos[user]['validuntil'] > 0 and time() > self.infos[user]['validuntil']: continue if "trafficleft" in self.infos[user]: - if self.infos[user]["trafficleft"] == 0: + if self.infos[user]['trafficleft'] == 0: continue usable.append((user, data)) @@ -252,15 +257,21 @@ class Account(Base): if not usable: return None, None return choice(usable) + def canUse(self): return False if self.selectAccount() == (None, None) else True - def parseTraffic(self, string): #returns kbyte - return parseFileSize(string) / 1024 + + def parseTraffic(self, value, unit=None): #: return bytes + if not unit and not isinstance(value, basestring): + unit = "KB" + return parseFileSize(value, unit) + def wrongPassword(self): raise WrongPassword + def empty(self, user): if user in self.infos: self.logWarning(_("Account %s has not enough traffic, checking again in 30min") % user) @@ -268,6 +279,7 @@ class Account(Base): self.infos[user].update({"trafficleft": 0}) self.scheduleRefresh(user, 30 * 60) + def expired(self, user): if user in self.infos: self.logWarning(_("Account %s is expired, checking again in 1h") % user) @@ -275,18 +287,21 @@ class Account(Base): self.infos[user].update({"validuntil": time() - 1}) self.scheduleRefresh(user, 60 * 60) + def scheduleRefresh(self, user, time=0, force=True): """ add task to refresh account info to sheduler """ self.logDebug("Scheduled Account refresh for %s in %s seconds." % (user, time)) self.core.scheduler.addJob(time, self.getAccountInfo, [user, force]) + @lock def checkLogin(self, user): """ checks if user is still logged in """ if user in self.timestamps: - if self.timestamps[user] + self.login_timeout * 60 < time(): + if self.login_timeout > 0 and self.timestamps[user] + self.login_timeout * 60 < time(): self.logDebug("Reached login timeout for %s" % user) - self.relogin(user) - return False - - return True + return self.relogin(user) + else: + return True + else: + return False diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py deleted file mode 100644 index fc521d36c..000000000 --- a/module/plugins/AccountManager.py +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - 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 <http://www.gnu.org/licenses/>. - - @author: RaNaN -""" - -from os.path import exists -from shutil import copy - -from threading import Lock - -from module.PullEvents import AccountUpdateEvent -from module.utils import chmod, lock - -ACC_VERSION = 1 - -class AccountManager(): - """manages all accounts""" - - #---------------------------------------------------------------------- - def __init__(self, core): - """Constructor""" - - self.core = core - self.lock = Lock() - - self.initPlugins() - self.saveAccounts() # save to add categories to conf - - def initPlugins(self): - self.accounts = {} # key = ( plugin ) - self.plugins = {} - - self.initAccountPlugins() - self.loadAccounts() - - - def getAccountPlugin(self, plugin): - """get account instance for plugin or None if anonymous""" - if plugin in self.accounts: - if plugin not in self.plugins: - self.plugins[plugin] = self.core.pluginManager.loadClass("accounts", plugin)(self, self.accounts[plugin]) - - return self.plugins[plugin] - else: - return None - - def getAccountPlugins(self): - """ get all account instances""" - - plugins = [] - for plugin in self.accounts.keys(): - plugins.append(self.getAccountPlugin(plugin)) - - return plugins - #---------------------------------------------------------------------- - def loadAccounts(self): - """loads all accounts available""" - - if not exists("accounts.conf"): - f = open("accounts.conf", "wb") - f.write("version: " + str(ACC_VERSION)) - f.close() - - f = open("accounts.conf", "rb") - content = f.readlines() - version = content[0].split(":")[1].strip() if content else "" - f.close() - - if not version or int(version) < ACC_VERSION: - copy("accounts.conf", "accounts.backup") - f = open("accounts.conf", "wb") - f.write("version: " + str(ACC_VERSION)) - f.close() - self.core.log.warning(_("Account settings deleted, due to new config format.")) - return - - - - plugin = "" - name = "" - - for line in content[1:]: - line = line.strip() - - if not line: continue - if line.startswith("#"): continue - if line.startswith("version"): continue - - if line.endswith(":") and line.count(":") == 1: - plugin = line[:-1] - self.accounts[plugin] = {} - - elif line.startswith("@"): - try: - option = line[1:].split() - self.accounts[plugin][name]["options"][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:]) - except: - pass - - elif ":" in line: - name, sep, pw = line.partition(":") - self.accounts[plugin][name] = {"password": pw, "options": {}, "valid": True} - #---------------------------------------------------------------------- - def saveAccounts(self): - """save all account information""" - - f = open("accounts.conf", "wb") - f.write("version: " + str(ACC_VERSION) + "\n") - - for plugin, accounts in self.accounts.iteritems(): - f.write("\n") - f.write(plugin+":\n") - - for name,data in accounts.iteritems(): - f.write("\n\t%s:%s\n" % (name,data["password"]) ) - if data["options"]: - for option, values in data["options"].iteritems(): - f.write("\t@%s %s\n" % (option, " ".join(values))) - - f.close() - chmod(f.name, 0600) - - - #---------------------------------------------------------------------- - def initAccountPlugins(self): - """init names""" - for name in self.core.pluginManager.getAccountPlugins(): - self.accounts[name] = {} - - @lock - def updateAccount(self, plugin , user, password=None, options={}): - """add or update account""" - if plugin in self.accounts: - p = self.getAccountPlugin(plugin) - updated = p.updateAccounts(user, password, options) - #since accounts is a ref in plugin self.accounts doesnt need to be updated here - - self.saveAccounts() - if updated: p.scheduleRefresh(user, force=False) - - @lock - def removeAccount(self, plugin, user): - """remove account""" - - if plugin in self.accounts: - p = self.getAccountPlugin(plugin) - p.removeAccount(user) - - self.saveAccounts() - - @lock - def getAccountInfos(self, force=True, refresh=False): - data = {} - - if refresh: - self.core.scheduler.addJob(0, self.core.accountManager.getAccountInfos) - force = False - - for p in self.accounts.keys(): - if self.accounts[p]: - p = self.getAccountPlugin(p) - data[p.__name__] = p.getAllAccounts(force) - else: - data[p] = [] - e = AccountUpdateEvent() - self.core.pullManager.addEvent(e) - return data - - def sendChange(self): - e = AccountUpdateEvent() - self.core.pullManager.addEvent(e) diff --git a/module/plugins/Addon.py b/module/plugins/Addon.py new file mode 100644 index 000000000..ca36fe4ae --- /dev/null +++ b/module/plugins/Addon.py @@ -0,0 +1,185 @@ +# -*- coding: utf-8 -*- + +from traceback import print_exc + +from pyload.plugin.Plugin import Base +from pyload.utils import has_method + + +class Expose(object): + """ used for decoration to declare rpc services """ + + def __new__(cls, f, *args, **kwargs): + addonManager.addRPC(f.__module__, f.func_name, f.func_doc) + return f + + +def threaded(fn): + + def run(*args,**kwargs): + addonManager.startThread(fn, *args, **kwargs) + + return run + + +class Addon(Base): + """ + Base class for addon plugins. + """ + __name__ = "Addon" + __type__ = "addon" + __version__ = "0.03" + + __config__ = [] #: [("name", "type", "desc", "default")] + + __description__ = """Base addon/hook plugin""" + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de"), + ("RaNaN", "RaNaN@pyload.org")] + + + #: automatically register event listeners for functions, attribute will be deleted dont use it yourself + event_map = {} + + # Deprecated alternative to event_map + #: List of events the plugin can handle, name the functions exactly like eventname. + event_list = [] #@NOTE: dont make duplicate entries in event_map + + + def __init__(self, core, manager): + Base.__init__(self, core) + + #: Provide information in dict here, usable by API `getInfo` + self.info = {} + + #: Callback of periodical job task, used by AddonManager + self.cb = None + self.interval = 60 + + #: `AddonManager` + self.manager = manager + + #register events + if self.event_map: + for event, funcs in self.event_map.iteritems(): + if type(funcs) in (list, tuple): + for f in funcs: + self.manager.addEvent(event, getattr(self,f)) + else: + self.manager.addEvent(event, getattr(self,funcs)) + + #delete for various reasons + self.event_map = None + + if self.event_list: + for f in self.event_list: + self.manager.addEvent(f, getattr(self,f)) + + self.event_list = None + + self.setup() + + # self.initPeriodical() + + + def initPeriodical(self, delay=0, threaded=False): + self.cb = self.core.scheduler.addJob(delay, self._periodical, args=[threaded], threaded=threaded) + + + def _periodical(self, threaded): + if self.interval < 0: + self.cb = None + return + + try: + self.periodical() + + except Exception, e: + self.logError(_("Error executing addon: %s") % e) + if self.core.debug: + print_exc() + + self.cb = self.core.scheduler.addJob(self.interval, self._periodical, threaded=threaded) + + + def __repr__(self): + return "<Addon %s>" % self.__name__ + + + def setup(self): + """ more init stuff if needed """ + pass + + + def deactivate(self): + """ called when addon was deactivated """ + if has_method(self.__class__, "unload"): + self.unload() + + def unload(self): # Deprecated, use method deactivate() instead + pass + + + def isActivated(self): + """ checks if addon is activated""" + return self.core.config.getPlugin(self.__name__, "activated") + + + # Event methods - overwrite these if needed + def activate(self): + """ called when addon was activated """ + if has_method(self.__class__, "coreReady"): + self.coreReady() + + def coreReady(self): # Deprecated, use method activate() instead + pass + + + def exit(self): + """ called by core.shutdown just before pyLoad exit """ + if has_method(self.__class__, "coreExiting"): + self.coreExiting() + + def coreExiting(self): # Deprecated, use method exit() instead + pass + + + def downloadPreparing(self, pyfile): + pass + + + def downloadFinished(self, pyfile): + pass + + + def downloadFailed(self, pyfile): + pass + + + def packageFinished(self, pypack): + pass + + + def beforeReconnecting(self, ip): + pass + + + def afterReconnecting(self, ip): + pass + + + def periodical(self): + pass + + + def captchaTask(self, task): + """ new captcha task for the plugin, it MUST set the handler and timeout or will be ignored """ + pass + + + def captchaCorrect(self, task): + pass + + + def captchaInvalid(self, task): + pass diff --git a/module/plugins/Captcha.py b/module/plugins/Captcha.py new file mode 100644 index 000000000..ace488994 --- /dev/null +++ b/module/plugins/Captcha.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Plugin import Plugin + + +class Captcha(Plugin): + __name__ = "Captcha" + __type__ = "captcha" + __version__ = "0.14" + + __description__ = """Base captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + + + KEY_PATTERN = None + + key = None #: last key detected + + + def __init__(self, plugin): + self.plugin = plugin + + + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = _("%s html not found") % self.__name__ + self.plugin.error(errmsg) + raise TypeError(errmsg) + + m = re.search(self.KEY_PATTERN, html) + if m: + self.key = m.group("KEY") + self.plugin.logDebug("%s key: %s" % (self.__name__, self.key)) + return self.key + else: + self.plugin.logDebug("%s key not found" % self.__name__) + return None + + + def challenge(self, key=None): + raise NotImplementedError + + + def result(self, server, challenge): + raise NotImplementedError diff --git a/module/plugins/Container.py b/module/plugins/Container.py index c233d3710..bfc5713a7 100644 --- a/module/plugins/Container.py +++ b/module/plugins/Container.py @@ -1,36 +1,27 @@ # -*- coding: utf-8 -*- -""" - 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 <http://www.gnu.org/licenses/>. - - @author: mkaay -""" - -from module.plugins.Crypter import Crypter - -from os.path import join, exists, basename -from os import remove +from __future__ import with_statement + import re +from os import remove +from os.path import basename, exists + +from pyload.plugin.internal.Crypter import Crypter +from pyload.utils import safe_join + + class Container(Crypter): - __name__ = "Container" - __version__ = "0.1" - __pattern__ = None - __type__ = "container" - __description__ = """Base container plugin""" - __author_name__ = ("mkaay") - __author_mail__ = ("mkaay@mkaay.de") + __name__ = "Container" + __type__ = "container" + __version__ = "0.01" + + __pattern__ = r'^unmatchable$' + __config__ = [] #: [("name", "type", "desc", "default")] + + __description__ = """Base container decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] def preprocessing(self, thread): @@ -38,38 +29,38 @@ class Container(Crypter): self.setup() self.thread = thread - + self.loadToDisk() self.decrypt(self.pyfile) self.deleteTmp() - + self.createPackages() - + def loadToDisk(self): - """loads container to disk if its stored remotely and overwrite url, + """loads container to disk if its stored remotely and overwrite url, or check existent on several places at disk""" - + if self.pyfile.url.startswith("http"): self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] content = self.load(self.pyfile.url) - self.pyfile.url = join(self.config["general"]["download_folder"], self.pyfile.name) - f = open(self.pyfile.url, "wb" ) - f.write(content) - f.close() - + self.pyfile.url = safe_join(self.core.config['general']['download_folder'], self.pyfile.name) + try: + with open(self.pyfile.url, "wb") as f: + f.write(content) + except IOError, e: + self.fail(str(e)) + else: self.pyfile.name = basename(self.pyfile.url) if not exists(self.pyfile.url): - if exists(join(pypath, self.pyfile.url)): - self.pyfile.url = join(pypath, self.pyfile.url) + if exists(safe_join(pypath, self.pyfile.url)): + self.pyfile.url = safe_join(pypath, self.pyfile.url) else: - self.fail(_("File not exists.")) - + self.fail(_("File not exists")) + def deleteTmp(self): if self.pyfile.name.startswith("tmp_"): remove(self.pyfile.url) - - diff --git a/module/plugins/Crypter.py b/module/plugins/Crypter.py index d1549fe80..f93ee254a 100644 --- a/module/plugins/Crypter.py +++ b/module/plugins/Crypter.py @@ -1,72 +1,107 @@ # -*- coding: utf-8 -*- -""" - 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. +from urlparse import urlparse - 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. +from pyload.plugin.Plugin import Plugin +from pyload.utils import decode, safe_filename - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. - - @author: mkaay -""" - -from module.plugins.Plugin import Plugin class Crypter(Plugin): - __name__ = "Crypter" - __version__ = "0.1" - __pattern__ = None - __type__ = "container" - __description__ = """Base crypter plugin""" - __author_name__ = ("mkaay") - __author_mail__ = ("mkaay@mkaay.de") - + __name__ = "Crypter" + __type__ = "crypter" + __version__ = "0.05" + + __pattern__ = r'^unmatchable$' + __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] + ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + + __description__ = """Base decrypter plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + html = None #: last html loaded + + def __init__(self, pyfile): - Plugin.__init__(self, pyfile) - #: Put all packages here. It's a list of tuples like: ( name, [list of links], folder ) self.packages = [] #: List of urls, pyLoad will generate packagenames self.urls = [] - - self.multiDL = True - self.limitDL = 0 - - - def preprocessing(self, thread): - """prepare""" - self.setup() - self.thread = thread - - self.decrypt(self.pyfile) - + + Plugin.__init__(self, pyfile) + + + def process(self, pyfile): + """ main method """ + + self.decrypt(pyfile) + + if self.urls: + self.generatePackages() + + elif not self.packages: + self.error(_("No link extracted"), "decrypt") + self.createPackages() - + def decrypt(self, pyfile): raise NotImplementedError + + def generatePackages(self): + """ generate new packages from self.urls """ + + packages = map(lambda name, links: (name, links, None), self.core.api.generatePackages(self.urls).iteritems()) + self.packages.extend(packages) + + def createPackages(self): """ create new packages from self.packages """ + + package_folder = self.pyfile.package().folder + package_password = self.pyfile.package().password + package_queue = self.pyfile.package().queue + + folder_per_package = self.core.config['general']['folder_per_package'] + try: + use_subfolder = self.getConfig('use_subfolder') + except Exception: + use_subfolder = folder_per_package + try: + subfolder_per_package = self.getConfig('subfolder_per_package') + except Exception: + subfolder_per_package = True + for pack in self.packages: + name, links, folder = pack - self.log.debug("Parsed package %(name)s with %(len)d links" % { "name" : pack[0], "len" : len(pack[1]) } ) - - links = [x.decode("utf-8") for x in pack[1]] - - pid = self.core.api.addPackage(pack[0], links, self.pyfile.package().queue) + self.logDebug("Parsed package: %s" % name, + "%d links" % len(links), + "Saved to folder: %s" % folder if folder else "Saved to download folder") - if self.pyfile.package().password: - self.core.api.setPackageData(pid, {"password": self.pyfile.package().password}) + links = map(decode, links) - if self.urls: - self.core.api.generateAndAddPackages(self.urls) - + pid = self.core.api.addPackage(name, links, package_queue) + + if package_password: + self.core.api.setPackageData(pid, {"password": package_password}) + + setFolder = lambda x: self.core.api.setPackageData(pid, {"folder": x or ""}) #: Workaround to do not break API addPackage method + + if use_subfolder: + if not subfolder_per_package: + setFolder(package_folder) + self.logDebug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder}) + + elif not folder_per_package or name != folder: + if not folder: + folder = urlparse(name).path.split("/")[-1] + + setFolder(safe_filename(folder)) + self.logDebug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder}) + + elif folder_per_package: + setFolder(None) diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py deleted file mode 100644 index 5efd08bae..000000000 --- a/module/plugins/Hook.py +++ /dev/null @@ -1,161 +0,0 @@ -# -*- coding: utf-8 -*- - -""" - 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 <http://www.gnu.org/licenses/>. - - @author: mkaay - @interface-version: 0.2 -""" - -from traceback import print_exc - -from Plugin import Base - -class Expose(object): - """ used for decoration to declare rpc services """ - - def __new__(cls, f, *args, **kwargs): - hookManager.addRPC(f.__module__, f.func_name, f.func_doc) - return f - -def threaded(f): - def run(*args,**kwargs): - hookManager.startThread(f, *args, **kwargs) - return run - -class Hook(Base): - """ - Base class for hook plugins. - """ - __name__ = "Hook" - __version__ = "0.2" - __type__ = "hook" - __threaded__ = [] - __config__ = [ ("name", "type", "desc" , "default") ] - __description__ = """interface for hook""" - __author_name__ = ("mkaay", "RaNaN") - __author_mail__ = ("mkaay@mkaay.de", "RaNaN@pyload.org") - - #: automatically register event listeners for functions, attribute will be deleted dont use it yourself - event_map = None - - # Alternative to event_map - #: List of events the plugin can handle, name the functions exactly like eventname. - event_list = None # dont make duplicate entries in event_map - - - #: periodic call interval in secondc - interval = 60 - - def __init__(self, core, manager): - Base.__init__(self, core) - - #: Provide information in dict here, usable by API `getInfo` - self.info = None - - #: Callback of periodical job task, used by hookmanager - self.cb = None - - #: `HookManager` - self.manager = manager - - #register events - if self.event_map: - for event, funcs in self.event_map.iteritems(): - if type(funcs) in (list, tuple): - for f in funcs: - self.manager.addEvent(event, getattr(self,f)) - else: - self.manager.addEvent(event, getattr(self,funcs)) - - #delete for various reasons - self.event_map = None - - if self.event_list: - for f in self.event_list: - self.manager.addEvent(f, getattr(self,f)) - - self.event_list = None - - self.initPeriodical() - self.setup() - - def initPeriodical(self): - if self.interval >=1: - self.cb = self.core.scheduler.addJob(0, self._periodical, threaded=False) - - def _periodical(self): - try: - if self.isActivated(): self.periodical() - except Exception, e: - self.core.log.error(_("Error executing hooks: %s") % str(e)) - if self.core.debug: - print_exc() - - self.cb = self.core.scheduler.addJob(self.interval, self._periodical, threaded=False) - - - def __repr__(self): - return "<Hook %s>" % self.__name__ - - def setup(self): - """ more init stuff if needed """ - pass - - def unload(self): - """ called when hook was deactivated """ - pass - - def isActivated(self): - """ checks if hook is activated""" - return self.config.getPlugin(self.__name__, "activated") - - - #event methods - overwrite these if needed - def coreReady(self): - pass - - def coreExiting(self): - pass - - def downloadPreparing(self, pyfile): - pass - - def downloadFinished(self, pyfile): - pass - - def downloadFailed(self, pyfile): - pass - - def packageFinished(self, pypack): - pass - - def beforeReconnecting(self, ip): - pass - - def afterReconnecting(self, ip): - pass - - def periodical(self): - pass - - def newCaptchaTask(self, task): - """ new captcha task for the plugin, it MUST set the handler and timeout or will be ignored """ - pass - - def captchaCorrect(self, task): - pass - - def captchaInvalid(self, task): - pass
\ No newline at end of file diff --git a/module/plugins/Hoster.py b/module/plugins/Hoster.py index 814a70949..2d43ee845 100644 --- a/module/plugins/Hoster.py +++ b/module/plugins/Hoster.py @@ -1,33 +1,21 @@ # -*- coding: utf-8 -*- -""" - 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. +from pyload.plugin.Plugin import Plugin - 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 <http://www.gnu.org/licenses/>. - - @author: mkaay -""" - -from module.plugins.Plugin import Plugin def getInfo(self): #result = [ .. (name, size, status, url) .. ] return + class Hoster(Plugin): - __name__ = "Hoster" - __version__ = "0.1" - __pattern__ = None - __type__ = "hoster" + __name__ = "Hoster" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'^unmatchable$' + __config__ = [] #: [("name", "type", "desc", "default")] + __description__ = """Base hoster plugin""" - __author_name__ = ("mkaay") - __author_mail__ = ("mkaay@mkaay.de") + __license__ = "GPLv3" + __authors__ = [("mkaay", "mkaay@mkaay.de")] diff --git a/module/plugins/captcha/captcha.py b/module/plugins/OCR.py index 1874ba07d..f309394f5 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/OCR.py @@ -48,9 +48,9 @@ class OCR(object): def run(self, command): """Run a command""" - popen = subprocess.Popen(command, bufsize = -1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + popen = subprocess.Popen(command, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) popen.wait() - output = popen.stdout.read() +" | "+ popen.stderr.read() + output = popen.stdout.read() + " | " + popen.stderr.read() popen.stdout.close() popen.stderr.close() self.logger.debug("Tesseract ReturnCode %s Output: %s" % (popen.returncode, output)) @@ -78,7 +78,7 @@ class OCR(object): else: tessparams = ["tesseract"] - tessparams.extend( [os.path.abspath(tmpTif.name), os.path.abspath(tmpTxt.name).replace(".txt", "")] ) + tessparams.extend([os.path.abspath(tmpTif.name), os.path.abspath(tmpTxt.name).replace(".txt", "")] ) if subset and (digits or lowercase or uppercase): #tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") @@ -151,11 +151,11 @@ class OCR(object): count = 0 try: - if pixels[x-1, y-1] != 255: + if pixels[x - 1, y - 1] != 255: count += 1 - if pixels[x-1, y] != 255: + if pixels[x - 1, y] != 255: count += 1 - if pixels[x-1, y + 1] != 255: + if pixels[x - 1, y + 1] != 255: count += 1 if pixels[x, y + 1] != 255: count += 1 @@ -163,19 +163,19 @@ class OCR(object): count += 1 if pixels[x + 1, y] != 255: count += 1 - if pixels[x + 1, y-1] != 255: + if pixels[x + 1, y - 1] != 255: count += 1 - if pixels[x, y-1] != 255: + if pixels[x, y - 1] != 255: count += 1 except Exception: pass - # not enough neighbors are dark pixels so mark this pixel - # to be changed to white + # not enough neighbors are dark pixels so mark this pixel + # to be changed to white if count < allowed: pixels[x, y] = 1 - # second pass: this time set all 1's to 255 (white) + # second pass: this time set all 1's to 255 (white) for x in xrange(w): for y in xrange(h): if pixels[x, y] == 1: @@ -211,7 +211,6 @@ class OCR(object): if pixels[x, y] == 0: pixels[x, y] = 255 - count = {} for x in xrange(w): diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 15bf3971f..0a9c647fb 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -1,21 +1,6 @@ # -*- coding: utf-8 -*- -""" - 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 <http://www.gnu.org/licenses/>. - - @author: RaNaN, spoob, mkaay -""" +from __future__ import with_statement from time import time, sleep from random import randint @@ -30,8 +15,11 @@ if os.name != "nt": from grp import getgrnam from itertools import islice +from traceback import print_exc +from urlparse import urlparse + +from pyload.utils import fs_decode, fs_encode, safe_filename, safe_join -from module.utils import save_join, save_path, fs_encode, fs_decode def chunks(iterable, size): it = iter(iterable) @@ -69,28 +57,40 @@ class Base(object): def __init__(self, core): #: Core instance self.core = core - #: logging instance - self.log = core.log - #: core config - self.config = core.config - #log functions + + def _log(self, type, args): + msg = " | ".join([encode(a).strip() for a in args if a]) + logger = getattr(self.core.log, type) + logger("%s: %s" % (self.__name__, msg or _("%s MARK" % type.upper()))) + + + def logDebug(self, *args): + if self.core.debug: + return self._log("debug", args) + + def logInfo(self, *args): - self.log.info("%s: %s" % (self.__name__, " | ".join([a if isinstance(a, basestring) else str(a) for a in args]))) + return self._log("info", args) + def logWarning(self, *args): - self.log.warning("%s: %s" % (self.__name__, " | ".join([a if isinstance(a, basestring) else str(a) for a in args]))) + return self._log("warning", args) + def logError(self, *args): - self.log.error("%s: %s" % (self.__name__, " | ".join([a if isinstance(a, basestring) else str(a) for a in args]))) + return self._log("error", args) - def logDebug(self, *args): - self.log.debug("%s: %s" % (self.__name__, " | ".join([a if isinstance(a, basestring) else str(a) for a in args]))) + + def logCritical(self, *args): + return self._log("critical", args) + #: Deprecated method def setConf(self, option, value): """ see `setConfig` """ - self.core.config.setPlugin(self.__name__, option, value) + self.setConfig(option, value) + def setConfig(self, option, value): """ Set config value for current plugin @@ -99,11 +99,14 @@ class Base(object): :param value: :return: """ - self.setConf(option, value) + self.core.config.setPlugin(self.__name__, option, value) + + #: Deprecated method def getConf(self, option): """ see `getConfig` """ - return self.core.config.getPlugin(self.__name__, option) + return self.getConfig(option) + def getConfig(self, option): """ Returns config value for current plugin @@ -111,26 +114,31 @@ class Base(object): :param option: :return: """ - return self.getConf(option) + return self.core.config.getPlugin(self.__name__, option) + def setStorage(self, key, value): """ Saves a value persistently to the database """ self.core.db.setStorage(self.__name__, key, value) + def store(self, key, value): """ same as `setStorage` """ self.core.db.setStorage(self.__name__, key, value) + def getStorage(self, key=None, default=None): """ Retrieves saved value or dict of all saved entries if key is None """ - if key is not None: + if key: return self.core.db.getStorage(self.__name__, key) or default return self.core.db.getStorage(self.__name__, key) + def retrieve(self, *args, **kwargs): """ same as `getStorage` """ return self.getStorage(*args, **kwargs) + def delStorage(self, key): """ Delete entry in db """ self.core.db.delStorage(self.__name__, key) @@ -141,22 +149,33 @@ class Plugin(Base): Base plugin for hoster/crypter. Overwrite `process` / `decrypt` in your subclassed plugin. """ - __name__ = "Plugin" - __version__ = "0.4" - __pattern__ = None - __type__ = "hoster" - __config__ = [("name", "type", "desc", "default")] - __description__ = """Base Plugin""" - __author_name__ = ("RaNaN", "spoob", "mkaay") - __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "mkaay@mkaay.de") + __name__ = "Plugin" + __type__ = "hoster" + __version__ = "0.07" + + __pattern__ = r'^unmatchable$' + __config__ = [] #: [("name", "type", "desc", "default")] + + __description__ = """Base plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de")] + + + info = {} #: file info dict + def __init__(self, pyfile): Base.__init__(self, pyfile.m.core) + #: engage wan reconnection self.wantReconnect = False - #: enables simultaneous processing of multiple downloads + + #: enable simultaneous processing of multiple downloads self.multiDL = True self.limitDL = 0 + #: chunk limit self.chunkLimit = 1 self.resumeDownload = False @@ -165,7 +184,9 @@ class Plugin(Base): self.waitUntil = 0 self.waiting = False - self.ocr = None #captcha reader instance + #: captcha reader instance + self.ocr = None + #: account handler instance, see :py:class:`Account` self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__) @@ -174,7 +195,9 @@ class Plugin(Base): #: username/login self.user = None - if self.account and not self.account.canUse(): self.account = None + if self.account and not self.account.canUse(): + self.account = None + if self.account: self.user, data = self.account.selectAccount() #: Browser instance, see `network.Browser` @@ -190,37 +213,46 @@ class Plugin(Base): #: associated pyfile instance, see `PyFile` self.pyfile = pyfile + self.thread = None # holds thread in future #: location where the last call to download was saved self.lastDownload = "" #: re match of the last call to `checkDownload` self.lastCheck = None + #: js engine, see `JsEngine` self.js = self.core.js - self.cTask = None #captcha task - self.retries = 0 # amount of retries already made - self.html = None # some plugins store html code here + #: captcha task + self.cTask = None + + self.html = None #@TODO: Move to hoster class in 0.4.10 + self.retries = 0 self.init() + def getChunkCount(self): if self.chunkLimit <= 0: - return self.config["download"]["chunks"] - return min(self.config["download"]["chunks"], self.chunkLimit) + return self.core.config['download']['chunks'] + return min(self.core.config['download']['chunks'], self.chunkLimit) + def __call__(self): return self.__name__ + def init(self): """initialize the plugin (in addition to `__init__`)""" pass + def setup(self): """ setup for enviroment and other things, called before downloading (possibly more than one time)""" pass + def preprocessing(self, thread): """ handles important things to do before starting """ self.thread = thread @@ -241,12 +273,14 @@ class Plugin(Base): """the 'main' method of every plugin, you **have to** overwrite it""" raise NotImplementedError + def resetAccount(self): """ dont use account and retry download """ self.account = None self.req = self.core.requestFactory.getRequest(self.__name__) self.retry() + def checksum(self, local_file=None): """ return codes: @@ -256,51 +290,119 @@ class Plugin(Base): 10 - not implemented 20 - unknown error """ - #@TODO checksum check hook + #@TODO checksum check addon return True, 10 - def setWait(self, seconds, reconnect=False): + def setReconnect(self, reconnect): + reconnect = bool(reconnect) + self.logDebug("Set wantReconnect to: %s (previous: %s)" % (reconnect, self.wantReconnect)) + self.wantReconnect = reconnect + + + def setWait(self, seconds, reconnect=None): """Set a specific wait time later used with `wait` - + :param seconds: wait time in seconds :param reconnect: True if a reconnect would avoid wait time """ - if reconnect: - self.wantReconnect = True - self.pyfile.waitUntil = time() + int(seconds) + wait_time = int(seconds) + 1 + wait_until = time() + wait_time + + self.logDebug("Set waitUntil to: %f (previous: %f)" % (wait_until, self.pyfile.waitUntil), + "Wait: %d seconds" % wait_time) - def wait(self): + self.pyfile.waitUntil = wait_until + + if reconnect is not None: + self.setReconnect(reconnect) + + + def wait(self, seconds=None, reconnect=None): """ waits the time previously set """ + + pyfile = self.pyfile + + if seconds is not None: + self.setWait(seconds) + + if reconnect is not None: + self.setReconnect(reconnect) + self.waiting = True - self.pyfile.setStatus("waiting") - while self.pyfile.waitUntil > time(): - self.thread.m.reconnecting.wait(2) + status = pyfile.status + pyfile.setStatus("waiting") - if self.pyfile.abort: raise Abort - if self.thread.m.reconnecting.isSet(): - self.waiting = False - self.wantReconnect = False - raise Reconnect + self.logInfo(_("Wait: %d seconds") % (pyfile.waitUntil - time()), + _("Reconnect: %s") % self.wantReconnect) + + if self.account: + self.logDebug("Ignore reconnection due account logged") + + while pyfile.waitUntil > time(): + if pyfile.abort: + self.abort() + + sleep(1) + else: + while pyfile.waitUntil > time(): + self.thread.m.reconnecting.wait(2) + + if pyfile.abort: + self.abort() + + if self.thread.m.reconnecting.isSet(): + self.waiting = False + self.wantReconnect = False + raise Reconnect + + sleep(1) self.waiting = False - self.pyfile.setStatus("starting") + + pyfile.status = status + def fail(self, reason): """ fail and give reason """ raise Fail(reason) - def offline(self): + + def abort(self, reason=""): + """ abort and give reason """ + if reason: + self.pyfile.error = str(reason) + raise Abort + + + def error(self, reason="", type=""): + if not reason and not type: + type = "unknown" + + msg = _("%s error") % _(type.strip().capitalize()) if type else _("Error") + msg += ": " + reason.strip() if reason else "" + msg += _(" | Plugin may be out of date") + + raise Fail(msg) + + + def offline(self, reason=""): """ fail and indicate file is offline """ + if reason: + self.pyfile.error = str(reason) raise Fail("offline") - def tempOffline(self): + + def tempOffline(self, reason=""): """ fail and indicates file ist temporary offline, the core may take consequences """ + if reason: + self.pyfile.error = str(reason) raise Fail("temp. offline") - def retry(self, max_tries=3, wait_time=1, reason=""): + + def retry(self, max_tries=5, wait_time=1, reason=""): """Retries and begin again from the beginning :param max_tries: number of maximum retries @@ -308,26 +410,28 @@ class Plugin(Base): :param reason: reason for retrying, will be passed to fail if max_tries reached """ if 0 < max_tries <= self.retries: - if not reason: reason = "Max retries reached" - raise Fail(reason) + self.error(reason or _("Max retries reached"), "retry") - self.wantReconnect = False - self.setWait(wait_time) - self.wait() + self.wait(wait_time, False) self.retries += 1 raise Retry(reason) + def invalidCaptcha(self): + self.logError(_("Invalid captcha")) if self.cTask: self.cTask.invalid() + def correctCaptcha(self): + self.logInfo(_("Correct captcha")) if self.cTask: self.cTask.correct() + def decryptCaptcha(self, url, get={}, post={}, cookies=False, forceUser=False, imgtype='jpg', - result_type='textual'): + result_type='textual', timeout=290): """ Loads a captcha and decrypts it with ocr, plugin, user input :param url: url of captcha image @@ -339,40 +443,41 @@ class Plugin(Base): :param result_type: 'textual' if text is written on the captcha\ or 'positional' for captcha where the user have to click\ on a specific region on the captcha - + :return: result of decrypting """ img = self.load(url, get=get, post=post, cookies=cookies) id = ("%.2f" % time())[-6:].replace(".", "") - temp_file = open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__name__, id, imgtype)), "wb") - temp_file.write(img) - temp_file.close() - has_plugin = self.__name__ in self.core.pluginManager.captchaPlugins + with open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__name__, id, imgtype)), "wb") as tmpCaptcha: + tmpCaptcha.write(img) + + has_plugin = self.__name__ in self.core.pluginManager.ocrPlugins if self.core.captcha: - Ocr = self.core.pluginManager.loadClass("captcha", self.__name__) + Ocr = self.core.pluginManager.loadClass("ocr", self.__name__) else: Ocr = None if Ocr and not forceUser: sleep(randint(3000, 5000) / 1000.0) - if self.pyfile.abort: raise Abort + if self.pyfile.abort: + self.abort() ocr = Ocr() - result = ocr.get_captcha(temp_file.name) + result = ocr.get_captcha(tmpCaptcha.name) else: captchaManager = self.core.captchaManager - task = captchaManager.newTask(img, imgtype, temp_file.name, result_type) + task = captchaManager.newTask(img, imgtype, tmpCaptcha.name, result_type) self.cTask = task - captchaManager.handleCaptcha(task) + captchaManager.handleCaptcha(task, timeout) while task.isWaiting(): if self.pyfile.abort: captchaManager.removeTask(task) - raise Abort + self.abort() sleep(1) captchaManager.removeTask(task) @@ -382,21 +487,21 @@ class Plugin(Base): elif task.error: self.fail(task.error) elif not task.result: - self.fail(_("No captcha result obtained in appropiate time by any of the plugins.")) + self.fail(_("No captcha result obtained in appropiate time by any of the plugins")) result = task.result - self.log.debug("Received captcha result: %s" % str(result)) + self.logDebug("Received captcha result: %s" % result) if not self.core.debug: try: - remove(temp_file.name) - except: + remove(tmpCaptcha.name) + except Exception: pass return result - def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False): + def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False, follow_location=True, save_cookies=True): """Load content at url and returns it :param url: @@ -404,35 +509,42 @@ class Plugin(Base): :param post: :param ref: :param cookies: - :param just_header: if True only the header will be retrieved and returned as dict + :param just_header: If True only the header will be retrieved and returned as dict :param decode: Wether to decode the output according to http header, should be True in most cases + :param follow_location: If True follow location else not + :param save_cookies: If True saves received cookies else discard them :return: Loaded content """ - if self.pyfile.abort: raise Abort - #utf8 vs decode -> please use decode attribute in all future plugins - if type(url) == unicode: url = str(url) + if self.pyfile.abort: + self.abort() + + if not url: + self.fail(_("No url given")) - res = self.req.load(url, get, post, ref, cookies, just_header, decode=decode) + url = encode(url).strip() #@NOTE: utf8 vs decode -> please use decode attribute in all future plugins if self.core.debug: - from inspect import currentframe + self.logDebug("Load url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")]) - frame = currentframe() - if not exists(join("tmp", self.__name__)): - makedirs(join("tmp", self.__name__)) + res = self.req.load(url, get, post, ref, cookies, just_header, decode=decode, follow_location=follow_location, save_cookies=save_cookies) - f = open( - join("tmp", self.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) - , "wb") - del frame # delete the frame or it wont be cleaned + if decode: + res = encode(res) + if self.core.debug: + from inspect import currentframe + + frame = currentframe() + framefile = safe_join("tmp", self.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) try: - tmp = res.encode("utf8") - except: - tmp = res + if not exists(join("tmp", self.__name__)): + makedirs(join("tmp", self.__name__)) - f.write(tmp) - f.close() + with open(framefile, "wb") as f: + del frame #: delete the frame or it wont be cleaned + f.write(res) + except IOError, e: + self.logError(e) if just_header: #parse header @@ -442,7 +554,7 @@ class Plugin(Base): if not line or ":" not in line: continue key, none, value = line.partition(":") - key = key.lower().strip() + key = key.strip().lower() value = value.strip() if key in header: @@ -456,6 +568,7 @@ class Plugin(Base): return res + def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): """Downloads the content at url to download folder @@ -468,34 +581,44 @@ class Plugin(Base): the filename will be changed if needed :return: The location where the file was saved """ + if self.pyfile.abort: + self.abort() + + if not url: + self.fail(_("No url given")) + + url = encode(url).strip() + + if self.core.debug: + self.logDebug("Download url: " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")]) self.checkForSameFiles() self.pyfile.setStatus("downloading") - download_folder = self.config['general']['download_folder'] + download_folder = self.core.config['general']['download_folder'] - location = save_join(download_folder, self.pyfile.package().folder) + location = safe_join(download_folder, self.pyfile.package().folder) if not exists(location): - makedirs(location, int(self.core.config["permission"]["folder"], 8)) - - if self.core.config["permission"]["change_dl"] and os.name != "nt": - try: - uid = getpwnam(self.config["permission"]["user"])[2] - gid = getgrnam(self.config["permission"]["group"])[2] + try: + makedirs(location, int(self.core.config['permission']['folder'], 8)) + if self.core.config['permission']['change_dl'] and os.name != "nt": + uid = getpwnam(self.core.config['permission']['user'])[2] + gid = getgrnam(self.core.config['permission']['group'])[2] chown(location, uid, gid) - except Exception, e: - self.log.warning(_("Setting User and Group failed: %s") % str(e)) + + except Exception, e: + self.fail(e) # convert back to unicode location = fs_decode(location) - name = save_path(self.pyfile.name) + name = safe_filename(self.pyfile.name) filename = join(location, name) - self.core.hookManager.dispatchEvent("downloadStarts", self.pyfile, url, filename) + self.core.addonManager.dispatchEvent("download-start", self.pyfile, url, filename) try: newname = self.req.httpDownload(url, filename, get=get, post=post, ref=ref, cookies=cookies, @@ -504,31 +627,38 @@ class Plugin(Base): finally: self.pyfile.size = self.req.size - if disposition and newname and newname != name: #triple check, just to be sure - self.log.info("%(name)s saved as %(newname)s" % {"name": name, "newname": newname}) - self.pyfile.name = newname - filename = join(location, newname) + if newname: + newname = urlparse(newname).path.split("/")[-1] - fs_filename = fs_encode(filename) + if disposition and newname != name: + self.logInfo(_("%(name)s saved as %(newname)s") % {"name": name, "newname": newname}) + self.pyfile.name = newname + filename = join(location, newname) - if self.core.config["permission"]["change_file"]: - chmod(fs_filename, int(self.core.config["permission"]["file"], 8)) + fs_filename = fs_encode(filename) - if self.core.config["permission"]["change_dl"] and os.name != "nt": + if self.core.config['permission']['change_file']: try: - uid = getpwnam(self.config["permission"]["user"])[2] - gid = getgrnam(self.config["permission"]["group"])[2] + chmod(fs_filename, int(self.core.config['permission']['file'], 8)) + except Exception, e: + self.logWarning(_("Setting file mode failed"), e) + if self.core.config['permission']['change_dl'] and os.name != "nt": + try: + uid = getpwnam(self.core.config['permission']['user'])[2] + gid = getgrnam(self.core.config['permission']['group'])[2] chown(fs_filename, uid, gid) + except Exception, e: - self.log.warning(_("Setting User and Group failed: %s") % str(e)) + self.logWarning(_("Setting User and Group failed"), e) self.lastDownload = filename return self.lastDownload + def checkDownload(self, rules, api_size=0, max_size=50000, delete=True, read_size=0): """ checks the content of the last downloaded file, re match is saved to `lastCheck` - + :param rules: dict with names and rules to match (compiled regexp or strings) :param api_size: expected file size :param max_size: if the file is larger then it wont be checked @@ -537,21 +667,23 @@ class Plugin(Base): :return: dictionary key of the first rule that matched """ lastDownload = fs_encode(self.lastDownload) - if not exists(lastDownload): return None + if not exists(lastDownload): + return None size = stat(lastDownload) size = size.st_size if api_size and api_size <= size: return None elif size > max_size and not read_size: return None - self.log.debug("Download Check triggered") - f = open(lastDownload, "rb") - content = f.read(read_size if read_size else -1) - f.close() + self.logDebug("Download Check triggered") + + with open(lastDownload, "rb") as f: + content = f.read(read_size if read_size else -1) + #produces encoding errors, better log to other file in the future? - #self.log.debug("Content: %s" % content) + #self.logDebug("Content: %s" % content) for name, rule in rules.iteritems(): - if type(rule) in (str, unicode): + if isinstance(rule, basestring): if rule in content: if delete: remove(lastDownload) @@ -589,29 +721,33 @@ class Plugin(Base): 5, 7) and starting: #a download is waiting/starting and was appenrently started before raise SkipDownload(pyfile.pluginname) - download_folder = self.config['general']['download_folder'] - location = save_join(download_folder, pack.folder, self.pyfile.name) + download_folder = self.core.config['general']['download_folder'] + location = safe_join(download_folder, pack.folder, self.pyfile.name) if starting and self.core.config['download']['skip_existing'] and exists(location): size = os.stat(location).st_size if size >= self.pyfile.size: - raise SkipDownload("File exists.") + raise SkipDownload("File exists") pyfile = self.core.db.findDuplicates(self.pyfile.id, self.pyfile.package().folder, self.pyfile.name) if pyfile: if exists(location): raise SkipDownload(pyfile[0]) - self.log.debug("File %s not skipped, because it does not exists." % self.pyfile.name) + self.logDebug("File %s not skipped, because it does not exists." % self.pyfile.name) + def clean(self): """ clean everything and remove references """ if hasattr(self, "pyfile"): del self.pyfile + if hasattr(self, "req"): self.req.close() del self.req + if hasattr(self, "thread"): del self.thread + if hasattr(self, "html"): del self.html diff --git a/module/plugins/PluginManager.py b/module/plugins/PluginManager.py deleted file mode 100644 index f3f5f47bc..000000000 --- a/module/plugins/PluginManager.py +++ /dev/null @@ -1,380 +0,0 @@ -# -*- coding: utf-8 -*- - -""" - 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 <http://www.gnu.org/licenses/>. - - @author: mkaay, RaNaN -""" - -import re -import sys - -from os import listdir, makedirs -from os.path import isfile, join, exists, abspath -from sys import version_info -from itertools import chain -from traceback import print_exc - -from module.lib.SafeEval import const_eval as literal_eval -from module.ConfigParser import IGNORE - -class PluginManager: - ROOT = "module.plugins." - USERROOT = "userplugins." - TYPES = ("crypter", "container", "hoster", "captcha", "accounts", "hooks", "internal") - - PATTERN = re.compile(r'__pattern__.*=.*r("|\')([^"\']+)') - VERSION = re.compile(r'__version__.*=.*("|\')([0-9.]+)') - CONFIG = re.compile(r'__config__.*=.*\[([^\]]+)', re.MULTILINE) - DESC = re.compile(r'__description__.?=.?("|"""|\')([^"\']+)') - - - def __init__(self, core): - self.core = core - - #self.config = self.core.config - self.log = core.log - - self.plugins = {} - self.createIndex() - - #register for import hook - sys.meta_path.append(self) - - - def createIndex(self): - """create information for all plugins available""" - - sys.path.append(abspath("")) - - if not exists("userplugins"): - makedirs("userplugins") - if not exists(join("userplugins", "__init__.py")): - f = open(join("userplugins", "__init__.py"), "wb") - f.close() - - self.plugins["crypter"] = self.crypterPlugins = self.parse("crypter", pattern=True) - self.plugins["container"] = self.containerPlugins = self.parse("container", pattern=True) - self.plugins["hoster"] = self.hosterPlugins = self.parse("hoster", pattern=True) - - self.plugins["captcha"] = self.captchaPlugins = self.parse("captcha") - self.plugins["accounts"] = self.accountPlugins = self.parse("accounts") - self.plugins["hooks"] = self.hookPlugins = self.parse("hooks") - self.plugins["internal"] = self.internalPlugins = self.parse("internal") - - self.log.debug("created index of plugins") - - def parse(self, folder, pattern=False, home={}): - """ - returns dict with information - home contains parsed plugins from module. - - { - name : {path, version, config, (pattern, re), (plugin, class)} - } - - """ - plugins = {} - if home: - pfolder = join("userplugins", folder) - if not exists(pfolder): - makedirs(pfolder) - if not exists(join(pfolder, "__init__.py")): - f = open(join(pfolder, "__init__.py"), "wb") - f.close() - - else: - pfolder = join(pypath, "module", "plugins", folder) - - for f in listdir(pfolder): - if (isfile(join(pfolder, f)) and f.endswith(".py") or f.endswith("_25.pyc") or f.endswith( - "_26.pyc") or f.endswith("_27.pyc")) and not f.startswith("_"): - data = open(join(pfolder, f)) - content = data.read() - data.close() - - if f.endswith("_25.pyc") and version_info[0:2] != (2, 5): - continue - elif f.endswith("_26.pyc") and version_info[0:2] != (2, 6): - continue - elif f.endswith("_27.pyc") and version_info[0:2] != (2, 7): - continue - - name = f[:-3] - if name[-1] == ".": name = name[:-4] - - version = self.VERSION.findall(content) - if version: - version = float(version[0][1]) - else: - version = 0 - - # home contains plugins from pyload root - if home and name in home: - if home[name]["v"] >= version: - continue - - if name in IGNORE or (folder, name) in IGNORE: - continue - - plugins[name] = {} - plugins[name]["v"] = version - - module = f.replace(".pyc", "").replace(".py", "") - - # the plugin is loaded from user directory - plugins[name]["user"] = True if home else False - plugins[name]["name"] = module - - if pattern: - pattern = self.PATTERN.findall(content) - - if pattern: - pattern = pattern[0][1] - else: - pattern = "^unmachtable$" - - plugins[name]["pattern"] = pattern - - try: - plugins[name]["re"] = re.compile(pattern) - except: - self.log.error(_("%s has a invalid pattern.") % name) - - - # internals have no config - if folder == "internal": - self.core.config.deleteConfig(name) - continue - - config = self.CONFIG.findall(content) - if config: - config = literal_eval(config[0].strip().replace("\n", "").replace("\r", "")) - desc = self.DESC.findall(content) - desc = desc[0][1] if desc else "" - - if type(config[0]) == tuple: - config = [list(x) for x in config] - else: - config = [list(config)] - - if folder == "hooks": - append = True - for item in config: - if item[0] == "activated": append = False - - # activated flag missing - if append: config.append(["activated", "bool", "Activated", False]) - - try: - self.core.config.addPluginConfig(name, config, desc) - except: - self.log.error("Invalid config in %s: %s" % (name, config)) - - elif folder == "hooks": #force config creation - desc = self.DESC.findall(content) - desc = desc[0][1] if desc else "" - config = (["activated", "bool", "Activated", False],) - - try: - self.core.config.addPluginConfig(name, config, desc) - except: - self.log.error("Invalid config in %s: %s" % (name, config)) - - if not home: - temp = self.parse(folder, pattern, plugins) - plugins.update(temp) - - return plugins - - - def parseUrls(self, urls): - """parse plugins for given list of urls""" - - last = None - res = [] # tupels of (url, plugin) - - for url in urls: - if type(url) not in (str, unicode, buffer): continue - found = False - - if last and last[1]["re"].match(url): - res.append((url, last[0])) - continue - - for name, value in chain(self.crypterPlugins.iteritems(), self.hosterPlugins.iteritems(), - self.containerPlugins.iteritems()): - if value["re"].match(url): - res.append((url, name)) - last = (name, value) - found = True - break - - if not found: - res.append((url, "BasePlugin")) - - return res - - def findPlugin(self, name, pluginlist=("hoster", "crypter", "container")): - for ptype in pluginlist: - if name in self.plugins[ptype]: - return self.plugins[ptype][name], ptype - return None, None - - def getPlugin(self, name, original=False): - """return plugin module from hoster|decrypter|container""" - plugin, type = self.findPlugin(name) - - if not plugin: - self.log.warning("Plugin %s not found." % name) - plugin = self.hosterPlugins["BasePlugin"] - - if "new_module" in plugin and not original: - return plugin["new_module"] - - return self.loadModule(type, name) - - def getPluginName(self, name): - """ used to obtain new name if other plugin was injected""" - plugin, type = self.findPlugin(name) - - if "new_name" in plugin: - return plugin["new_name"] - - return name - - def loadModule(self, type, name): - """ Returns loaded module for plugin - - :param type: plugin type, subfolder of module.plugins - :param name: - """ - plugins = self.plugins[type] - if name in plugins: - if "module" in plugins[name]: return plugins[name]["module"] - try: - module = __import__(self.ROOT + "%s.%s" % (type, plugins[name]["name"]), globals(), locals(), - plugins[name]["name"]) - plugins[name]["module"] = module #cache import, maybe unneeded - return module - except Exception, e: - self.log.error(_("Error importing %(name)s: %(msg)s") % {"name": name, "msg": str(e)}) - if self.core.debug: - print_exc() - - def loadClass(self, type, name): - """Returns the class of a plugin with the same name""" - module = self.loadModule(type, name) - if module: return getattr(module, name) - - def getAccountPlugins(self): - """return list of account plugin names""" - return self.accountPlugins.keys() - - def find_module(self, fullname, path=None): - #redirecting imports if necesarry - if fullname.startswith(self.ROOT) or fullname.startswith(self.USERROOT): #seperate pyload plugins - if fullname.startswith(self.USERROOT): user = 1 - else: user = 0 #used as bool and int - - split = fullname.split(".") - if len(split) != 4 - user: return - type, name = split[2 - user:4 - user] - - if type in self.plugins and name in self.plugins[type]: - #userplugin is a newer version - if not user and self.plugins[type][name]["user"]: - return self - #imported from userdir, but pyloads is newer - if user and not self.plugins[type][name]["user"]: - return self - - - def load_module(self, name, replace=True): - if name not in sys.modules: #could be already in modules - if replace: - if self.ROOT in name: - newname = name.replace(self.ROOT, self.USERROOT) - else: - newname = name.replace(self.USERROOT, self.ROOT) - else: newname = name - - base, plugin = newname.rsplit(".", 1) - - self.log.debug("Redirected import %s -> %s" % (name, newname)) - - module = __import__(newname, globals(), locals(), [plugin]) - #inject under new an old name - sys.modules[name] = module - sys.modules[newname] = module - - return sys.modules[name] - - - def reloadPlugins(self, type_plugins): - """ reloads and reindexes plugins """ - if not type_plugins: return False - - self.log.debug("Request reload of plugins: %s" % type_plugins) - - as_dict = {} - for t,n in type_plugins: - if t in as_dict: - as_dict[t].append(n) - else: - as_dict[t] = [n] - - # we do not reload hooks or internals, would cause to much side effects - if "hooks" in as_dict or "internal" in as_dict: - return False - - for type in as_dict.iterkeys(): - for plugin in as_dict[type]: - if plugin in self.plugins[type]: - if "module" in self.plugins[type][plugin]: - self.log.debug("Reloading %s" % plugin) - reload(self.plugins[type][plugin]["module"]) - - #index creation - self.plugins["crypter"] = self.crypterPlugins = self.parse("crypter", pattern=True) - self.plugins["container"] = self.containerPlugins = self.parse("container", pattern=True) - self.plugins["hoster"] = self.hosterPlugins = self.parse("hoster", pattern=True) - self.plugins["captcha"] = self.captchaPlugins = self.parse("captcha") - self.plugins["accounts"] = self.accountPlugins = self.parse("accounts") - - if "accounts" in as_dict: #accounts needs to be reloaded - self.core.accountManager.initPlugins() - self.core.scheduler.addJob(0, self.core.accountManager.getAccountInfos) - - return True - - - -if __name__ == "__main__": - _ = lambda x: x - pypath = "/home/christian/Projekte/pyload-0.4/module/plugins" - - from time import time - - p = PluginManager(None) - - a = time() - - test = ["http://www.youtube.com/watch?v=%s" % x for x in range(0, 100)] - print p.parseUrls(test) - - b = time() - - print b - a, "s" - diff --git a/module/plugins/__init__.py b/module/plugins/__init__.py index e69de29bb..40a96afc6 100644 --- a/module/plugins/__init__.py +++ b/module/plugins/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index c830f0c09..7fc11e343 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -7,7 +7,7 @@ from time import time from BeautifulSoup import BeautifulSoup -from module.plugins.Account import Account +from pyload.plugin.Account import Account class AlldebridCom(Account): diff --git a/module/plugins/accounts/BillionuploadsCom.py b/module/plugins/accounts/BillionuploadsCom.py index 11af36591..a3325c427 100644 --- a/module/plugins/accounts/BillionuploadsCom.py +++ b/module/plugins/accounts/BillionuploadsCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class BillionuploadsCom(XFSAccount): diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 412aae534..4774b9062 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from pyload.plugin.Account import Account class BitshareCom(Account): @@ -10,7 +10,7 @@ class BitshareCom(Account): __description__ = """Bitshare account plugin""" __license__ = "GPLv3" - __authors__ = [("Paul King", None)] + __authors__ = [("Paul King", "")] def loadAccountInfo(self, user, req): diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index ec4d706ae..a604ebff1 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -4,7 +4,7 @@ import re from time import mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class CatShareNet(Account): @@ -14,7 +14,7 @@ class CatShareNet(Account): __description__ = """CatShareNet account plugin""" __license__ = "GPLv3" - __authors__ = [("prOq", None)] + __authors__ = [("prOq", "")] PREMIUM_PATTERN = r'<a href="/premium">Konto:[\s\n]*Premium' diff --git a/module/plugins/accounts/CramitIn.py b/module/plugins/accounts/CramitIn.py index a9e2274a2..21503f625 100644 --- a/module/plugins/accounts/CramitIn.py +++ b/module/plugins/accounts/CramitIn.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class CramitIn(XFSAccount): diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 202a88e25..dfe78c21c 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -3,7 +3,7 @@ from time import mktime, strptime import re -from module.plugins.Account import Account +from pyload.plugin.Account import Account class CzshareCom(Account): diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 50f9aea27..de97f6e64 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -4,7 +4,7 @@ import re from time import mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class DebridItaliaCom(Account): @@ -22,14 +22,14 @@ class DebridItaliaCom(Account): def loadAccountInfo(self, user, req): - info = {"premium": False, "validuntil": None, "trafficleft": None} + info = {'premium': False, 'validuntil': None, 'trafficleft': None} html = req.load("http://debriditalia.com/") if 'Account premium not activated' not in html: m = re.search(self.WALID_UNTIL_PATTERN, html) if m: validuntil = mktime(strptime(m.group(1), "%d/%m/%Y %H:%M")) - info = {"premium": True, "validuntil": validuntil, "trafficleft": -1} + info = {'premium': True, 'validuntil': validuntil, 'trafficleft': -1} else: self.logError(_("Unable to retrieve account information")) diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index dfe430276..b3e896d31 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -4,7 +4,7 @@ import re from time import strptime, mktime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class DepositfilesCom(Account): diff --git a/module/plugins/hoster/DropboxCom.py b/module/plugins/accounts/DropboxCom.py index a8ef5b4bc..bcaa24b8e 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/accounts/DropboxCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DropboxCom(SimpleHoster): diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index 93d3e2c19..c7d717474 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class EasybytezCom(XFSAccount): diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index f92a4e821..b37fc68fa 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -3,7 +3,7 @@ from time import mktime, strptime import re -from module.plugins.Account import Account +from pyload.plugin.Account import Account class EuroshareEu(Account): diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index 51be3880f..69f78c3d9 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class FastixRu(Account): diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py index d6e94f2e3..8fe98438b 100644 --- a/module/plugins/accounts/FastshareCz.py +++ b/module/plugins/accounts/FastshareCz.py @@ -2,7 +2,8 @@ import re -from module.plugins.Account import Account +from pyload.plugin.Account import Account +from pyload.utils import parseFileSize class FastshareCz(Account): diff --git a/module/plugins/accounts/File4SafeCom.py b/module/plugins/accounts/File4SafeCom.py index 50fe1aac8..c48956d38 100644 --- a/module/plugins/accounts/File4SafeCom.py +++ b/module/plugins/accounts/File4SafeCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class File4SafeCom(XFSAccount): diff --git a/module/plugins/accounts/FileParadoxIn.py b/module/plugins/accounts/FileParadoxIn.py index c12d99d6a..02b923519 100644 --- a/module/plugins/accounts/FileParadoxIn.py +++ b/module/plugins/accounts/FileParadoxIn.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class FileParadoxIn(XFSAccount): diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 8ca55b1bc..6d2dcb92a 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class FilecloudIo(Account): diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index 426d572db..3395b3f90 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -5,7 +5,7 @@ from time import mktime, strptime from pycurl import REFERER -from module.plugins.Account import Account +from pyload.plugin.Account import Account class FilefactoryCom(Account): diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index 9f7474207..2c476bffb 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -3,7 +3,7 @@ import re from time import mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class FilejungleCom(Account): diff --git a/module/plugins/accounts/FileomCom.py b/module/plugins/accounts/FileomCom.py index 7c743f56a..36a11e411 100644 --- a/module/plugins/accounts/FileomCom.py +++ b/module/plugins/accounts/FileomCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class FileomCom(XFSAccount): diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 4067445af..f3cc42367 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -3,7 +3,7 @@ import re import time -from module.plugins.Account import Account +from pyload.plugin.Account import Account class FilerNet(Account): diff --git a/module/plugins/accounts/FilerioCom.py b/module/plugins/accounts/FilerioCom.py index 4c6755293..1d9f8744b 100644 --- a/module/plugins/accounts/FilerioCom.py +++ b/module/plugins/accounts/FilerioCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class FilerioCom(XFSAccount): diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index 15926589e..e6afd0168 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from pyload.plugin.Account import Account class FilesMailRu(Account): diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 1cf2a3a3c..9aab88d2b 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -2,8 +2,8 @@ from time import mktime, strptime -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class FileserveCom(Account): diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index 2777a142a..127f9d58a 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from pyload.plugin.Account import Account +from pyload.utils import json_loads class FourSharedCom(Account): diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index 83f4a9a84..9c61ac513 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -4,7 +4,7 @@ import re from time import strptime, mktime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class FreakshareCom(Account): diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 14b9f1e9a..dcd9d34cf 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class FreeWayMe(Account): diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 66d912958..282a17751 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -4,7 +4,7 @@ import re from time import mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class FshareVn(Account): diff --git a/module/plugins/accounts/Ftp.py b/module/plugins/accounts/Ftp.py index f978d2fa0..67cde2cdd 100644 --- a/module/plugins/accounts/Ftp.py +++ b/module/plugins/accounts/Ftp.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from pyload.plugin.Account import Account class Ftp(Account): @@ -13,5 +13,5 @@ class Ftp(Account): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - info_threshold = 1000000 - login_timeout = 1000000 + login_timeout = -1 #: Unlimited + info_threshold = -1 #: Unlimited diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index e559b28e1..94467b375 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -3,7 +3,7 @@ import re import time -from module.plugins.Account import Account +from pyload.plugin.Account import Account class HellshareCz(Account): diff --git a/module/plugins/accounts/Http.py b/module/plugins/accounts/Http.py index 07e46eb07..2571ef712 100644 --- a/module/plugins/accounts/Http.py +++ b/module/plugins/accounts/Http.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from pyload.plugin.Account import Account class Http(Account): @@ -13,5 +13,5 @@ class Http(Account): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - info_threshold = 1000000 - login_timeout = 1000000 + login_timeout = -1 #: Unlimited + info_threshold = -1 #: Unlimited diff --git a/module/plugins/accounts/HugefilesNet.py b/module/plugins/accounts/HugefilesNet.py index 5da3bbc37..eb383fb17 100644 --- a/module/plugins/accounts/HugefilesNet.py +++ b/module/plugins/accounts/HugefilesNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class HugefilesNet(XFSAccount): diff --git a/module/plugins/accounts/HundredEightyUploadCom.py b/module/plugins/accounts/HundredEightyUploadCom.py index 319a3feee..72185a4bb 100644 --- a/module/plugins/accounts/HundredEightyUploadCom.py +++ b/module/plugins/accounts/HundredEightyUploadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class HundredEightyUploadCom(XFSAccount): diff --git a/module/plugins/accounts/JunocloudMe.py b/module/plugins/accounts/JunocloudMe.py index b0fc160f3..0ffa92eb6 100644 --- a/module/plugins/accounts/JunocloudMe.py +++ b/module/plugins/accounts/JunocloudMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class JunocloudMe(XFSAccount): diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py index 9f28799a2..7ed15dc62 100644 --- a/module/plugins/accounts/Keep2ShareCc.py +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -4,30 +4,29 @@ import re from time import gmtime, mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account -class Keep2ShareCc(Account): - __name__ = "Keep2ShareCc" +class Keep2shareCc(Account): + __name__ = "Keep2shareCc" __type__ = "account" - __version__ = "0.05" + __version__ = "0.02" - __description__ = """Keep2Share.cc account plugin""" + __description__ = """Keep2share.cc account plugin""" __license__ = "GPLv3" - __authors__ = [("aeronaut", "aeronaut@pianoguy.de"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("aeronaut", "aeronaut@pianoguy.de")] - VALID_UNTIL_PATTERN = r'Premium expires:\s*<b>(.+?)<' - TRAFFIC_LEFT_PATTERN = r'Available traffic \(today\):\s*<b><a href="/user/statistic.html">(.+?)<' + VALID_UNTIL_PATTERN = r'Premium expires: <b>(.+?)</b>' + TRAFFIC_LEFT_PATTERN = r'Available traffic \(today\):<b><a href="/user/statistic.html">(.+?)</a>' LOGIN_FAIL_PATTERN = r'Please fix the following input errors' def loadAccountInfo(self, user, req): validuntil = None - trafficleft = -1 - premium = False + trafficleft = None + premium = None html = req.load("http://keep2share.cc/site/profile.html", decode=True) @@ -36,26 +35,26 @@ class Keep2ShareCc(Account): expiredate = m.group(1).strip() self.logDebug("Expire date: " + expiredate) - if expiredate == "LifeTime": - premium = True - validuntil = -1 - else: - try: - validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) + try: + validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) - except Exception, e: - self.logError(e) + except Exception, e: + self.logError(e) + else: + if validuntil > mktime(gmtime()): + premium = True else: - premium = True if validuntil > mktime(gmtime()) else False + premium = False + validuntil = None - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - if m: - try: - trafficleft = self.parseTraffic(m.group(1)) + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + try: + trafficleft = self.parseTraffic(m.group(1)) - except Exception, e: - self.logError(e) + except Exception, e: + self.logError(e) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} @@ -64,11 +63,7 @@ class Keep2ShareCc(Account): req.cj.setCookie("keep2share.cc", "lang", "en") html = req.load("http://keep2share.cc/login.html", - post={'LoginForm[username]' : user, - 'LoginForm[password]' : data['password'], - 'LoginForm[rememberMe]': 1, - 'yt0' : ""}, - decode=True) + post={'LoginForm[username]': user, 'LoginForm[password]': data['password']}) if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrongPassword() diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index 7f973d2d3..d0f08d0bb 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account -# from module.common.json_layer import json_loads, json_dumps +from pyload.plugin.Account import Account +# from pyload.utils import json_loads, json_dumps class LetitbitNet(Account): diff --git a/module/plugins/accounts/LinestorageCom.py b/module/plugins/accounts/LinestorageCom.py index a48d5beb9..7a5d63a47 100644 --- a/module/plugins/accounts/LinestorageCom.py +++ b/module/plugins/accounts/LinestorageCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class LinestorageCom(XFSAccount): diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 97e368285..0b1176ee9 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -2,8 +2,8 @@ from hashlib import md5 -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class LinksnappyCom(Account): diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py index a082b97af..c2e64bcc7 100644 --- a/module/plugins/accounts/MegaDebridEu.py +++ b/module/plugins/accounts/MegaDebridEu.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class MegaDebridEu(Account): diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index b229fe47d..5596fd623 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -3,7 +3,7 @@ import re from time import mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class MegaRapidCz(Account): diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index 127ebadc8..53b854f65 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -3,7 +3,7 @@ import re from time import mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class MegasharesCom(Account): diff --git a/module/plugins/accounts/MovReelCom.py b/module/plugins/accounts/MovReelCom.py index 6128cddc8..4d2855de1 100644 --- a/module/plugins/accounts/MovReelCom.py +++ b/module/plugins/accounts/MovReelCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class MovReelCom(XFSAccount): diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 0ac764ee1..9b4f4447b 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -2,7 +2,7 @@ import re -from module.plugins.Account import Account +from pyload.plugin.Account import Account class MultishareCz(Account): diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index 4c75b27f0..838a1eefd 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -2,8 +2,8 @@ from time import time -from module.common.json_layer import json_loads -from module.plugins.Account import Account +from pyload.plugin.Account import Account +from pyload.utils import json_loads class MyfastfileCom(Account): diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 1abd7fa84..68982e828 100644 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -3,7 +3,7 @@ import re from time import time -from module.plugins.Account import Account +from pyload.plugin.Account import Account class NetloadIn(Account): diff --git a/module/plugins/accounts/NosuploadCom.py b/module/plugins/accounts/NosuploadCom.py index e523ee2f4..7fc8b49de 100644 --- a/module/plugins/accounts/NosuploadCom.py +++ b/module/plugins/accounts/NosuploadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class NosuploadCom(XFSAccount): diff --git a/module/plugins/accounts/NovafileCom.py b/module/plugins/accounts/NovafileCom.py index ab61bf0fc..71a7dc2dc 100644 --- a/module/plugins/accounts/NovafileCom.py +++ b/module/plugins/accounts/NovafileCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class NovafileCom(XFSAccount): diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index f44ae3865..8359e0410 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -4,7 +4,7 @@ import re from time import gmtime, mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class NowVideoSx(Account): diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 0acacbb2a..012fb42c3 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -4,8 +4,8 @@ import time from beaker.crypto.pbkdf2 import PBKDF2 -from module.common.json_layer import json_loads -from module.plugins.Account import Account +from pyload.utils import json_loads +from pyload.plugin.Account import Account class OboomCom(Account): diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index 1fc8d994d..65ec841c4 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -6,7 +6,7 @@ from time import strptime, mktime from pycurl import REFERER -from module.plugins.Account import Account +from pyload.plugin.Account import Account class OneFichierCom(Account): diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index d59944e63..d945dd7bd 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class OverLoadMe(Account): diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index c8ea2fa26..04bbc10d5 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from pyload.plugin.Account import Account class PremiumTo(Account): @@ -15,6 +15,7 @@ class PremiumTo(Account): ("stickell", "l.stickell@yahoo.it")] + def loadAccountInfo(self, user, req): traffic = req.load("http://premium.to/api/straffic.php", get={'username': self.username, 'password': self.password}) diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index 7d061ec2d..3cd15ce23 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from pyload.plugin.Account import Account -from module.common.json_layer import json_loads +from pyload.utils import json_loads class PremiumizeMe(Account): diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 16141d63e..2bcde1c9d 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -2,7 +2,7 @@ import re -from module.plugins.Account import Account +from pyload.plugin.Account import Account class QuickshareCz(Account): diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index 829e54a46..e0b35b68c 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class RPNetBiz(Account): diff --git a/module/plugins/accounts/RapidfileshareNet.py b/module/plugins/accounts/RapidfileshareNet.py index c0dd7eaee..ec0bf8db4 100644 --- a/module/plugins/accounts/RapidfileshareNet.py +++ b/module/plugins/accounts/RapidfileshareNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class RapidfileshareNet(XFSAccount): diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 23d7aff53..7643f07d2 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class RapidgatorNet(Account): diff --git a/module/plugins/accounts/RarefileNet.py b/module/plugins/accounts/RarefileNet.py index 577a6c8f6..1dc93681c 100644 --- a/module/plugins/accounts/RarefileNet.py +++ b/module/plugins/accounts/RarefileNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class RarefileNet(XFSAccount): diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 41d8a0975..07ff70496 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -2,7 +2,7 @@ import xml.dom.minidom as dom -from module.plugins.Account import Account +from pyload.plugin.Account import Account class RealdebridCom(Account): diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 04e71c9ad..d62e1918a 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from pyload.plugin.Account import Account class RehostTo(Account): diff --git a/module/plugins/accounts/RyushareCom.py b/module/plugins/accounts/RyushareCom.py index 8c56ff20f..466d971f6 100644 --- a/module/plugins/accounts/RyushareCom.py +++ b/module/plugins/accounts/RyushareCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class RyushareCom(XFSAccount): diff --git a/module/plugins/accounts/SafesharingEu.py b/module/plugins/accounts/SafesharingEu.py index 2e58d33b3..f5cbf050e 100644 --- a/module/plugins/accounts/SafesharingEu.py +++ b/module/plugins/accounts/SafesharingEu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class SafesharingEu(XFSAccount): diff --git a/module/plugins/accounts/SecureUploadEu.py b/module/plugins/accounts/SecureUploadEu.py index b335c94da..bb47bcba3 100644 --- a/module/plugins/accounts/SecureUploadEu.py +++ b/module/plugins/accounts/SecureUploadEu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class SecureUploadEu(XFSAccount): diff --git a/module/plugins/accounts/SendmywayCom.py b/module/plugins/accounts/SendmywayCom.py index 4fcbe0b7a..d64658de3 100644 --- a/module/plugins/accounts/SendmywayCom.py +++ b/module/plugins/accounts/SendmywayCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class SendmywayCom(XFSAccount): diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 7e05e2e76..28bc3b9bc 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -2,7 +2,7 @@ import re -from module.plugins.Account import Account +from pyload.plugin.Account import Account class ShareonlineBiz(Account): diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 8caf600f9..298ad8d59 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads -from module.plugins.Account import Account +from pyload.utils import json_loads +from pyload.plugin.Account import Account class SimplyPremiumCom(Account): diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index 29be2f73d..a826e44c7 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -2,7 +2,7 @@ from time import mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class SimplydebridCom(Account): diff --git a/module/plugins/accounts/StahnuTo.py b/module/plugins/accounts/StahnuTo.py index 882dbd2c3..ed8df3b77 100644 --- a/module/plugins/accounts/StahnuTo.py +++ b/module/plugins/accounts/StahnuTo.py @@ -2,7 +2,7 @@ import re -from module.plugins.Account import Account +from pyload.plugin.Account import Account class StahnuTo(Account): diff --git a/module/plugins/accounts/StreamcloudEu.py b/module/plugins/accounts/StreamcloudEu.py index aa1eafcbd..3ac74fbd0 100644 --- a/module/plugins/accounts/StreamcloudEu.py +++ b/module/plugins/accounts/StreamcloudEu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class StreamcloudEu(XFSAccount): diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index a857649eb..e3c07da2a 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -3,7 +3,7 @@ import re from time import mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class TurbobitNet(Account): diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py index 279dfd00a..84e9ef9c6 100644 --- a/module/plugins/accounts/TusfilesNet.py +++ b/module/plugins/accounts/TusfilesNet.py @@ -4,7 +4,7 @@ import re from time import mktime, strptime, gmtime -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class TusfilesNet(XFSAccount): @@ -12,7 +12,7 @@ class TusfilesNet(XFSAccount): __type__ = "account" __version__ = "0.06" - __description__ = """ Tusfile.net account plugin """ + __description__ = """Tusfile.net account plugin""" __license__ = "GPLv3" __authors__ = [("guidobelix", "guidobelix@hotmail.it")] diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 7236a4fa8..1570419b0 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -4,7 +4,7 @@ import re from urlparse import urljoin -from module.plugins.Account import Account +from pyload.plugin.Account import Account class UlozTo(Account): @@ -15,7 +15,7 @@ class UlozTo(Account): __description__ = """Uloz.to account plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("pulpe", None)] + ("pulpe", "")] TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title="[^"]*?GB = ([\d.]+) MB"' diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py index 6a8187234..d8d7789bb 100644 --- a/module/plugins/accounts/UnrestrictLi.py +++ b/module/plugins/accounts/UnrestrictLi.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account -from module.common.json_layer import json_loads +from pyload.plugin.Account import Account +from pyload.utils import json_loads class UnrestrictLi(Account): diff --git a/module/plugins/accounts/UploadcCom.py b/module/plugins/accounts/UploadcCom.py index d1e1a2ead..66863c456 100644 --- a/module/plugins/accounts/UploadcCom.py +++ b/module/plugins/accounts/UploadcCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class UploadcCom(XFSAccount): diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 4e5c8035b..3b0d957a5 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -3,7 +3,7 @@ import re from time import time -from module.plugins.Account import Account +from pyload.plugin.Account import Account class UploadedTo(Account): diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index 714f5b0a6..c73fc30f5 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -4,7 +4,7 @@ import re import datetime import time -from module.plugins.Account import Account +from pyload.plugin.Account import Account class UploadheroCom(Account): diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index c70d2ec11..6d54469e8 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -4,8 +4,8 @@ import re from time import time, strptime, mktime -from module.plugins.Account import Account -from module.plugins.internal.SimpleHoster import set_cookies +from pyload.plugin.Account import Account +from pyload.plugin.internal.SimpleHoster import set_cookies class UploadingCom(Account): diff --git a/module/plugins/accounts/UptoboxCom.py b/module/plugins/accounts/UptoboxCom.py index c40dbd6e6..f7cb7a82e 100644 --- a/module/plugins/accounts/UptoboxCom.py +++ b/module/plugins/accounts/UptoboxCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class UptoboxCom(XFSAccount): diff --git a/module/plugins/accounts/VidPlayNet.py b/module/plugins/accounts/VidPlayNet.py index 5bfc24963..390520a00 100644 --- a/module/plugins/accounts/VidPlayNet.py +++ b/module/plugins/accounts/VidPlayNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class VidPlayNet(XFSAccount): diff --git a/module/plugins/accounts/XFileSharingPro.py b/module/plugins/accounts/XFileSharingPro.py index 8dc7f3a30..216af5385 100644 --- a/module/plugins/accounts/XFileSharingPro.py +++ b/module/plugins/accounts/XFileSharingPro.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSAccount import XFSAccount +from pyload.plugin.internal.XFSAccount import XFSAccount class XFileSharingPro(XFSAccount): diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py index 33602a2fe..150b0d931 100644 --- a/module/plugins/accounts/YibaishiwuCom.py +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.Account import Account +from pyload.plugin.Account import Account class YibaishiwuCom(Account): diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index d1585111a..db23170f3 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -2,7 +2,7 @@ from time import mktime, strptime -from module.plugins.Account import Account +from pyload.plugin.Account import Account class ZeveraCom(Account): diff --git a/module/plugins/accounts/__init__.py b/module/plugins/accounts/__init__.py index e69de29bb..40a96afc6 100644 --- a/module/plugins/accounts/__init__.py +++ b/module/plugins/accounts/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/addon/Checksum.py index 064375a41..35be60773 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/addon/Checksum.py @@ -9,8 +9,8 @@ import zlib from os import remove from os.path import getsize, isfile, splitext -from module.plugins.Hook import Hook -from module.utils import save_join, fs_encode +from pyload.plugin.Addon import Addon +from pyload.utils import safe_join, fs_encode def computeChecksum(local_file, algorithm): @@ -37,16 +37,17 @@ def computeChecksum(local_file, algorithm): return None -class Checksum(Hook): +class Checksum(Addon): __name__ = "Checksum" - __type__ = "hook" + __type__ = "addon" __version__ = "0.16" - __config__ = [("check_checksum", "bool", "Check checksum? (If False only size will be verified)", True), - ("check_action", "fail;retry;nothing", "What to do if check fails?", "retry"), - ("max_tries", "int", "Number of retries", 2), - ("retry_action", "fail;nothing", "What to do if all retries fail?", "fail"), - ("wait_time", "int", "Time to wait before each retry (seconds)", 1)] + __config__ = [("activated" , "bool" , "Activated" , True ), + ("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ), + ("check_action" , "fail;retry;nothing", "What to do if check fails?" , "retry"), + ("max_tries" , "int" , "Number of retries" , 2 ), + ("retry_action" , "fail;nothing" , "What to do if all retries fail?" , "fail" ), + ("wait_time" , "int" , "Time to wait before each retry (seconds)" , 1 )] __description__ = """Verify downloaded file size and checksum""" __license__ = "GPLv3" @@ -64,12 +65,7 @@ class Checksum(Hook): 'default': r'^(?P<HASH>[0-9A-Fa-f]+)\s+\*?(?P<NAME>.+)$'} - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def coreReady(self): + def activate(self): if not self.getConfig("check_checksum"): self.logInfo(_("Checksum validation is disabled in plugin configuration")) @@ -108,7 +104,7 @@ class Checksum(Hook): local_file = fs_encode(pyfile.plugin.lastDownload) #download_folder = self.config['general']['download_folder'] - #local_file = fs_encode(save_join(download_folder, pyfile.package().folder, pyfile.name)) + #local_file = fs_encode(safe_join(download_folder, pyfile.package().folder, pyfile.name)) if not isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") @@ -168,7 +164,7 @@ class Checksum(Hook): def packageFinished(self, pypack): - download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "") + download_folder = safe_join(self.config['general']['download_folder'], pypack.folder, "") for link in pypack.getChildren().itervalues(): file_type = splitext(link['name'])[1][1:].lower() @@ -176,7 +172,7 @@ class Checksum(Hook): if file_type not in self.formats: continue - hash_file = fs_encode(save_join(download_folder, link['name'])) + hash_file = fs_encode(safe_join(download_folder, link['name'])) if not isfile(hash_file): self.logWarning(_("File not found"), link['name']) continue @@ -188,7 +184,7 @@ class Checksum(Hook): data = m.groupdict() self.logDebug(link['name'], data) - local_file = fs_encode(save_join(download_folder, data['NAME'])) + local_file = fs_encode(safe_join(download_folder, data['NAME'])) algorithm = self.methods.get(file_type, file_type) checksum = computeChecksum(local_file, algorithm) if checksum == data['HASH']: diff --git a/module/plugins/addon/ClickAndLoad.py b/module/plugins/addon/ClickAndLoad.py new file mode 100644 index 000000000..5fe6e4bec --- /dev/null +++ b/module/plugins/addon/ClickAndLoad.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- + +from socket import socket, error +from threading import Thread + +from pyload.plugin.Addon import Addon + + +def forward(source, destination): + string = ' ' + while string: + string = source.recv(1024) + if string: + destination.sendall(string) + else: + #source.shutdown(socket.SHUT_RD) + destination.shutdown(socket.SHUT_WR) + + +class ClickAndLoad(Addon): + __name__ = "ClickAndLoad" + __type__ = "addon" + __version__ = "0.23" + + __config__ = [("activated", "bool", "Activated" , True ), + ("port" , "int" , "Port" , 9666 ), + ("extern" , "bool", "Allow external link adding", False)] + + __description__ = """Click'N'Load hook plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.de"), + ("mkaay", "mkaay@mkaay.de"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + def setup(self): + self.interval = 300 + + + def activate(self): + self.initPeriodical() + + + def periodical(self): + webip = "0.0.0.0" if self.getConfig("extern") else "127.0.0.1" + webport = self.config['webinterface']['port'] + cnlport = self.getConfig("port")) + + try: + s = socket() + s.bind((webip, cnlport)) + s.listen(5) + + client = s.accept()[0] + server = socket() + + server.connect(("127.0.0.1", webport)) + + except error, e: + if hasattr(e, "errno"): + errno = e.errno + else: + errno = e.args[0] + + if errno == 98: + self.logWarning(_("Port %d already in use") % cnlport) + else: + self.logDebug(e) + + else: + self.core.scheduler.removeJob(self.cb) + t = Thread(target=forward, args=[client, server]) + t.setDaemon(True) + t.start() diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/addon/DeleteFinished.py index 5d2b78d50..59f2e3321 100644 --- a/module/plugins/hooks/DeleteFinished.py +++ b/module/plugins/addon/DeleteFinished.py @@ -1,17 +1,16 @@ # -*- coding: utf-8 -*- -from module.database import style -from module.plugins.Hook import Hook +from pyload.database import style +from pyload.plugin.Addon import Addon -class DeleteFinished(Hook): +class DeleteFinished(Addon): __name__ = "DeleteFinished" - __type__ = "hook" + __type__ = "addon" __version__ = "1.11" - __config__ = [('activated', 'bool', 'Activated', 'False'), - ('interval', 'int', 'Delete every (hours)', '72'), - ('deloffline', 'bool', 'Delete packages with offline links', 'False')] + __config__ = [('interval' , 'int' , 'Delete every (hours)' , '72' ), + ('deloffline', 'bool', 'Delete packages with offline links', 'False')] __description__ = """Automatically delete all finished packages from queue""" __license__ = "GPLv3" @@ -39,11 +38,11 @@ class DeleteFinished(Hook): self.initPeriodical() - def unload(self): + def deactivate(self): self.removeEvent('packageFinished', self.wakeup) - def coreReady(self): + def activate(self): self.info = {'sleep': True} interval = self.getConfig('interval') self.pluginConfigChanged(self.__name__, 'interval', interval) @@ -75,5 +74,6 @@ class DeleteFinished(Hook): def setup(self): + self.interval = 0 self.m = self.manager self.removeEvent = self.m.removeEvent diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/addon/DownloadScheduler.py index 4996e212d..e5e25e389 100644 --- a/module/plugins/hooks/DownloadScheduler.py +++ b/module/plugins/addon/DownloadScheduler.py @@ -4,17 +4,16 @@ import re from time import localtime -from module.plugins.Hook import Hook +from pyload.plugin.Addon import Addon -class DownloadScheduler(Hook): +class DownloadScheduler(Addon): __name__ = "DownloadScheduler" - __type__ = "hook" + __type__ = "addon" __version__ = "0.22" - __config__ = [("timetable", "str", "List time periods as hh:mm full or number(kB/s)", - "0:00 full, 7:00 250, 10:00 0, 17:00 150"), - ("abort", "bool", "Abort active downloads when start period with speed 0", False)] + __config__ = [("timetable", "str" , "List time periods as hh:mm full or number(kB/s)" , "0:00 full, 7:00 250, 10:00 0, 17:00 150"), + ("abort" , "bool", "Abort active downloads when start period with speed 0", False )] __description__ = """Download Scheduler""" __license__ = "GPLv3" @@ -22,16 +21,11 @@ class DownloadScheduler(Hook): ("stickell", "l.stickell@yahoo.it")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def setup(self): - self.cb = None # callback to scheduler job; will be by removed hookmanager when hook unloaded + self.cb = None #: callback to scheduler job; will be by removed AddonManager when addon unloaded - def coreReady(self): + def activate(self): self.updateSchedule() diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/addon/ExternalScripts.py index 8bd803308..5aebf2338 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/addon/ExternalScripts.py @@ -5,13 +5,13 @@ import subprocess from itertools import chain -from module.plugins.Hook import Hook -from module.utils import save_join +from pyload.plugin.Addon import Addon +from pyload.utils import safe_join -class ExternalScripts(Hook): +class ExternalScripts(Addon): __name__ = "ExternalScripts" - __type__ = "hook" + __type__ = "addon" __version__ = "0.29" __config__ = [("activated", "bool", "Activated" , True ), @@ -20,18 +20,17 @@ class ExternalScripts(Hook): __description__ = """Run external scripts""" __license__ = "GPLv3" __authors__ = [("mkaay", "mkaay@mkaay.de"), - ("RaNaN", "ranan@pyload.org"), - ("spoob", "spoob@pyload.org"), - ("Walter Purcaro", "vuolter@gmail.com")] + ("RaNaN", "ranan@pyload.org"), + ("spoob", "spoob@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] - event_list = ["archive_extracted", "package_extracted", "all_archives_extracted", "all_archives_processed", - "allDownloadsFinished", "allDownloadsProcessed"] - - - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass + event_map = {'archive-extracted' : "archive_extracted", + 'package-extracted' : "package_extracted", + 'all_archives-extracted' : "all_archives_extracted", + 'all_archives-processed' : "all_archives_processed", + 'all_downloads-finished' : "allDownloadsFinished", + 'all_downloads-processed': "allDownloadsProcessed"} def setup(self): @@ -96,14 +95,14 @@ class ExternalScripts(Hook): def downloadFinished(self, pyfile): download_folder = self.config['general']['download_folder'] for script in self.scripts['download_finished']: - filename = save_join(download_folder, pyfile.package().folder, pyfile.name) + filename = safe_join(download_folder, pyfile.package().folder, pyfile.name) self.callScript(script, pyfile.pluginname, pyfile.url, pyfile.name, filename, pyfile.id) def packageFinished(self, pypack): download_folder = self.config['general']['download_folder'] for script in self.scripts['package_finished']: - folder = save_join(download_folder, pypack.folder) + folder = safe_join(download_folder, pypack.folder) self.callScript(script, pypack.name, folder, pypack.password, pypack.id) @@ -127,7 +126,7 @@ class ExternalScripts(Hook): def package_extracted(self, pypack): download_folder = self.config['general']['download_folder'] for script in self.scripts['package_extracted']: - folder = save_join(download_folder, pypack.folder) + folder = safe_join(download_folder, pypack.folder) self.callScript(script, pypack.name, folder, pypack.password, pypack.id) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/addon/ExtractArchive.py index 3ea8839dc..3ea8839dc 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/addon/ExtractArchive.py diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/addon/HotFolder.py index 1ff02c319..eb607ac7e 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/addon/HotFolder.py @@ -8,19 +8,19 @@ from os import listdir, makedirs from os.path import exists, isfile, join from shutil import move -from module.plugins.Hook import Hook -from module.utils import fs_encode, save_join +from pyload.plugin.Addon import Addon +from pyload.utils import fs_encode, safe_join -class HotFolder(Hook): +class HotFolder(Addon): __name__ = "HotFolder" - __type__ = "hook" + __type__ = "addon" __version__ = "0.12" - __config__ = [("folder", "str", "Folder to observe", "container"), - ("watch_file", "bool", "Observe link file", False), - ("keep", "bool", "Keep added containers", True), - ("file", "str", "Link file", "links.txt")] + __config__ = [("folder" , "str" , "Folder to observe" , "container"), + ("watch_file", "bool", "Observe link file" , False ), + ("keep" , "bool", "Keep added containers", True ), + ("file" , "str" , "Link file" , "links.txt")] __description__ = """Observe folder and file for changes and add container and links""" __license__ = "GPLv3" @@ -31,6 +31,10 @@ class HotFolder(Hook): self.interval = 10 + def activate(self): + self.initPeriodical() + + def periodical(self): folder = fs_encode(self.getConfig("folder")) @@ -46,7 +50,7 @@ class HotFolder(Hook): if content: name = "%s_%s.txt" % (self.getConfig("file"), time.strftime("%H-%M-%S_%d%b%Y")) - with open(save_join(folder, "finished", name), "wb") as f: + with open(safe_join(folder, "finished", name), "wb") as f: f.write(content) self.core.api.addPackage(f.name, [f.name], 1) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/addon/IRCInterface.py index 623f2d1bf..86d9ea688 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/addon/IRCInterface.py @@ -11,27 +11,27 @@ from threading import Thread from time import sleep from traceback import print_exc -from module.Api import PackageDoesNotExists, FileDoesNotExists -from module.network.RequestFactory import getURL -from module.plugins.Hook import Hook -from module.utils import formatSize +from pyload.api import PackageDoesNotExists, FileDoesNotExists +from pyload.network.RequestFactory import getURL +from pyload.plugin.Addon import Addon +from pyload.utils import formatSize -class IRCInterface(Thread, Hook): +class IRCInterface(Thread, Addon): __name__ = "IRCInterface" - __type__ = "hook" + __type__ = "addon" __version__ = "0.13" - __config__ = [("host", "str", "IRC-Server Address", "Enter your server here!"), - ("port", "int", "IRC-Server Port", 6667), - ("ident", "str", "Clients ident", "pyload-irc"), - ("realname", "str", "Realname", "pyload-irc"), - ("ssl", "bool", "Use SSL", False), - ("nick", "str", "Nickname the Client will take", "pyLoad-IRC"), - ("owner", "str", "Nickname the Client will accept commands from", "Enter your nick here!"), - ("info_file", "bool", "Inform about every file finished", False), - ("info_pack", "bool", "Inform about every package finished", True), - ("captcha", "bool", "Send captcha requests", True)] + __config__ = [("host" , "str" , "IRC-Server Address" , "Enter your server here!"), + ("port" , "int" , "IRC-Server Port" , 6667 ), + ("ident" , "str" , "Clients ident" , "pyload-irc" ), + ("realname" , "str" , "Realname" , "pyload-irc" ), + ("ssl" , "bool", "Use SSL" , False ), + ("nick" , "str" , "Nickname the Client will take" , "pyLoad-IRC" ), + ("owner" , "str" , "Nickname the Client will accept commands from", "Enter your nick here!" ), + ("info_file", "bool", "Inform about every file finished" , False ), + ("info_pack", "bool", "Inform about every package finished" , True ), + ("captcha" , "bool", "Send captcha requests" , True )] __description__ = """Connect to irc and let owner perform different tasks""" __license__ = "GPLv3" @@ -40,16 +40,11 @@ class IRCInterface(Thread, Hook): def __init__(self, core, manager): Thread.__init__(self) - Hook.__init__(self, core, manager) + Addon.__init__(self, core, manager) self.setDaemon(True) - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def coreReady(self): + def activate(self): self.abort = False self.more = [] self.new_package = {} @@ -74,7 +69,7 @@ class IRCInterface(Thread, Hook): pass - def newCaptchaTask(self, task): + def captchaTask(self, task): if self.getConfig("captcha") and task.isTextual(): task.handler.append(self) task.setWaiting(60) @@ -94,7 +89,7 @@ class IRCInterface(Thread, Hook): self.sock.connect((host, self.getConfig("port"))) if self.getConfig("ssl"): - self.sock = ssl.wrap_socket(self.sock, cert_reqs=ssl.CERT_NONE) #@TODO: support certificate + self.sock = ssl.wrap_socket(self.sock, cert_reqs=ssl.CERT_NONE) #@TODO: support custom certificate nick = self.getConfig("nick") self.sock.send("NICK %s\r\n" % nick) diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/addon/MergeFiles.py index 9f1348485..42ac3ff4d 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/addon/MergeFiles.py @@ -7,13 +7,13 @@ import re from traceback import print_exc -from module.plugins.Hook import Hook, threaded -from module.utils import save_join +from pyload.plugin.Addon import Addon, threaded +from module.utils import safe_join -class MergeFiles(Hook): +class MergeFiles(Addon): __name__ = "MergeFiles" - __type__ = "hook" + __type__ = "addon" __version__ = "0.14" __config__ = [("activated", "bool", "Activated", True)] @@ -26,13 +26,7 @@ class MergeFiles(Hook): BUFFER_SIZE = 4096 - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def setup(self): - # nothing to do pass @@ -51,12 +45,12 @@ class MergeFiles(Hook): download_folder = self.config['general']['download_folder'] if self.config['general']['folder_per_package']: - download_folder = save_join(download_folder, pack.folder) + download_folder = safe_join(download_folder, pack.folder) for name, file_list in files.iteritems(): self.logInfo(_("Starting merging of"), name) - with open(save_join(download_folder, name), "wb") as final_file: + final_file = open(safe_join(download_folder, name), "wb") for splitted_file in file_list: self.logDebug("Merging part", splitted_file) @@ -68,6 +62,7 @@ class MergeFiles(Hook): with open(save_join(download_folder, splitted_file), "rb") as s_file: size_written = 0 s_file_size = int(os.path.getsize(os.path.join(download_folder, splitted_file))) + while True: f_buffer = s_file.read(self.BUFFER_SIZE) if f_buffer: @@ -76,6 +71,7 @@ class MergeFiles(Hook): pyfile.setProgress((size_written * 100) / s_file_size) else: break + self.logDebug("Finished merging part", splitted_file) except Exception, e: diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/addon/MultiHome.py index c9f6fc30c..521749fc8 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/addon/MultiHome.py @@ -2,12 +2,12 @@ from time import time -from module.plugins.Hook import Hook +from pyload.plugin.Addon import Addon -class MultiHome(Hook): +class MultiHome(Addon): __name__ = "MultiHome" - __type__ = "hook" + __type__ = "addon" __version__ = "0.12" __config__ = [("interfaces", "str", "Interfaces", "None")] @@ -17,11 +17,6 @@ class MultiHome(Hook): __authors__ = [("mkaay", "mkaay@mkaay.de")] - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - def setup(self): self.register = {} self.interfaces = [] @@ -42,11 +37,10 @@ class MultiHome(Hook): self.interfaces.append(Interface(interface)) - def coreReady(self): + def activate(self): requestFactory = self.core.requestFactory oldGetRequest = requestFactory.getRequest - def getRequest(pluginName, account=None): iface = self.bestInterface(pluginName, account) if iface: diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/addon/RestartFailed.py index 07fb80967..2fe5f13bf 100644 --- a/module/plugins/hooks/RestartFailed.py +++ b/module/plugins/addon/RestartFailed.py @@ -1,14 +1,15 @@ # -*- coding: utf-8 -*- -from module.plugins.Hook import Hook +from pyload.plugin.Addon import Addon -class RestartFailed(Hook): +class RestartFailed(Addon): __name__ = "RestartFailed" - __type__ = "hook" + __type__ = "addon" __version__ = "1.57" - __config__ = [("interval", "int", "Check interval in minutes", 90)] + __config__ = [("activated", "bool", "Activated" , True), + ("interval" , "int" , "Check interval in minutes", 90 )] __description__ = """Periodically restart all failed downloads in queue""" __license__ = "GPLv3" @@ -37,8 +38,8 @@ class RestartFailed(Hook): def setup(self): - self.interval = self.MIN_INTERVAL + self.interval = 0 - def coreReady(self): + def activate(self): self.pluginConfigChanged(self.__name__, "interval", self.getConfig("interval")) diff --git a/module/plugins/hooks/RestartSlow.py b/module/plugins/addon/RestartSlow.py index c3e1e5468..332047da7 100644 --- a/module/plugins/hooks/RestartSlow.py +++ b/module/plugins/addon/RestartSlow.py @@ -2,36 +2,32 @@ import pycurl -from module.plugins.Hook import Hook +from pyload.plugin.Addon import Addon -class RestartSlow(Hook): +class RestartSlow(Addon): __name__ = "RestartSlow" - __type__ = "hook" + __type__ = "addon" __version__ = "0.04" __config__ = [("free_limit" , "int" , "Transfer speed threshold in kilobytes" , 100 ), - ("free_time" , "int" , "Sample interval in minutes" , 5 ), - ("premium_limit", "int" , "Transfer speed threshold for premium download in kilobytes", 300 ), - ("premium_time" , "int" , "Sample interval for premium download in minutes" , 2 ), - ("safe_mode" , "bool", "Don't restart if download is not resumable" , True)] + ("free_time" , "int" , "Sample interval in minutes" , 5 ), + ("premium_limit", "int" , "Transfer speed threshold for premium download in kilobytes", 300 ), + ("premium_time" , "int" , "Sample interval for premium download in minutes" , 2 ), + ("safe_mode" , "bool", "Don't restart if download is not resumable" , True)] __description__ = """Restart slow downloads""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - event_list = ["downloadStarts"] + event_map = {'download-start': "downloadStarts"} def setup(self): self.info = {'chunk': {}} - def initPeriodical(self): - pass - - def periodical(self): if not self.pyfile.plugin.req.dl: return @@ -58,4 +54,4 @@ class RestartSlow(Hook): if self.cb or (self.getConfig("safe_mode") and not pyfile.plugin.resumeDownload): return self.pyfile = pyfile - super(RestartSlow, self).initPeriodical() + self.initPeriodical() diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/addon/SkipRev.py index 0bbdec3b2..0bbdec3b2 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/addon/SkipRev.py diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/addon/UnSkipOnFail.py index 1becb937a..1becb937a 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/addon/UnSkipOnFail.py diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/addon/UpdateManager.py index b6a8bac7c..efccc73fb 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/addon/UpdateManager.py @@ -8,24 +8,24 @@ import sys from operator import itemgetter from os import path, remove, stat -from module.network.RequestFactory import getURL -from module.plugins.Hook import Expose, Hook, threaded -from module.utils import save_join +from pyload.network.RequestFactory import getURL +from pyload.plugin.Addon import Expose, Addon, threaded +from pyload.utils import safe_join -class UpdateManager(Hook): +class UpdateManager(Addon): __name__ = "UpdateManager" - __type__ = "hook" + __type__ = "addon" __version__ = "0.43" __config__ = [("activated" , "bool" , "Activated" , True ), - ("mode" , "pyLoad + plugins;plugins only", "Check updates for" , "pyLoad + plugins"), - ("interval" , "int" , "Check interval in hours" , 8 ), - ("autorestart" , "bool" , "Automatically restart pyLoad when required" , True ), - ("reloadplugins", "bool" , "Monitor plugins for code changes in debug mode", True ), - ("nodebugupdate", "bool" , "Don't check for updates in debug mode" , False )] + ("mode" , "pyLoad + plugins;plugins only", "Check updates for" , "pyLoad + plugins"), + ("interval" , "int" , "Check interval in hours" , 8 ), + ("autorestart" , "bool" , "Automatically restart pyLoad when required" , True ), + ("reloadplugins", "bool" , "Monitor plugins for code changes in debug mode", True ), + ("nodebugupdate", "bool" , "Don't check for updates in debug mode" , False )] - __description__ = """ Check for updates """ + __description__ = """Check for updates""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] @@ -54,19 +54,19 @@ class UpdateManager(Hook): self.periodical2() - def coreReady(self): + def activate(self): self.pluginConfigChanged(self.__name__, "interval", self.getConfig("interval")) x = lambda: self.pluginConfigChanged(self.__name__, "reloadplugins", self.getConfig("reloadplugins")) self.core.scheduler.addJob(10, x, threaded=False) - def unload(self): + def deactivate(self): self.pluginConfigChanged(self.__name__, "reloadplugins", False) def setup(self): self.cb2 = None - self.interval = self.MIN_INTERVAL + self.interval = 0 self.updating = False self.info = {'pyload': False, 'version': None, 'plugins': False} self.mtimes = {} #: store modification time for each plugin @@ -83,7 +83,7 @@ class UpdateManager(Hook): def autoreloadPlugins(self): """ reload and reindex all modified plugins """ modules = filter( - lambda m: m and (m.__name__.startswith("module.plugins.") or + lambda m: m and (m.__name__.startswith("pyload.plugin.") or m.__name__.startswith("userplugins.")) and m.__name__.count(".") >= 2, sys.modules.itervalues() ) @@ -110,8 +110,10 @@ class UpdateManager(Hook): def periodical(self): - if not self.info['pyload'] and not (self.getConfig("nodebugupdate") and self.core.debug): - self.updateThread() + if self.info['pyload'] or self.getConfig("nodebugupdate") and self.core.debug: + return + + self.updateThread() def server_request(self): @@ -209,7 +211,7 @@ class UpdateManager(Hook): for plugin in sorted(upgradable, key=itemgetter("type", "name")): filename = plugin['name'] - prefix = plugin['type'] + type = plugin['type'] version = plugin['version'] if filename.endswith(".pyc"): @@ -217,15 +219,9 @@ class UpdateManager(Hook): else: name = filename.replace(".py", "") - #@TODO: obsolete after 0.4.10 - if prefix.endswith("s"): - type = prefix[:-1] - else: - type = prefix - plugins = getattr(self.core.pluginManager, "%sPlugins" % type) - oldver = float(plugins[name]['v']) if name in plugins else None + oldver = float(plugins[name]['version']) if name in plugins else None newver = float(version) if not oldver: @@ -244,7 +240,7 @@ class UpdateManager(Hook): m = self.VERSION.search(content) if m and m.group(2) == version: - with open(save_join("userplugins", prefix, filename), "wb") as f: + with open(safe_join("userplugins", prefix, filename), "wb") as f: f.write(content) updated.append((prefix, name)) @@ -284,23 +280,23 @@ class UpdateManager(Hook): err = False file = name + ".py" - for root in ("userplugins", path.join(pypath, "module", "plugins")): + for root in ("userplugins", path.join(pypath, "pyload", "plugins")): - filename = save_join(root, type, file) + filename = safe_join(root, type, file) try: remove(filename) except Exception, e: - self.logDebug("Error removing: %s" % path.basename(filename), str(e)) + self.logDebug("Error deleting: %s" % path.basename(filename), e) err = True filename += "c" if path.isfile(filename): try: - if type == "hook": - self.manager.deactivateHook(name) + if type == "addon": + self.manager.deactivateAddon(name) remove(filename) except Exception, e: - self.logDebug("Error removing: %s" % path.basename(filename), str(e)) + self.logDebug("Error deleting: %s" % path.basename(filename), e) err = True if not err: diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/addon/XMPPInterface.py index b8e9fc1ad..77a49af6f 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/addon/XMPPInterface.py @@ -6,21 +6,21 @@ from pyxmpp.interface import implements from pyxmpp.interfaces import * from pyxmpp.jabber.client import JabberClient -from module.plugins.hooks.IRCInterface import IRCInterface +from pyload.plugin.addon.IRCInterface import IRCInterface class XMPPInterface(IRCInterface, JabberClient): __name__ = "XMPPInterface" - __type__ = "hook" + __type__ = "addon" __version__ = "0.11" - __config__ = [("jid", "str", "Jabber ID", "user@exmaple-jabber-server.org"), - ("pw", "str", "Password", ""), - ("tls", "bool", "Use TLS", False), - ("owners", "str", "List of JIDs accepting commands from", "me@icq-gateway.org;some@msn-gateway.org"), - ("info_file", "bool", "Inform about every file finished", False), - ("info_pack", "bool", "Inform about every package finished", True), - ("captcha", "bool", "Send captcha requests", True)] + __config__ = [("jid" , "str" , "Jabber ID" , "user@exmaple-jabber-server.org" ), + ("pw" , "str" , "Password" , "" ), + ("tls" , "bool", "Use TLS" , False ), + ("owners" , "str" , "List of JIDs accepting commands from", "me@icq-gateway.org;some@msn-gateway.org"), + ("info_file", "bool", "Inform about every file finished" , False ), + ("info_pack", "bool", "Inform about every package finished" , True ), + ("captcha" , "bool", "Send captcha requests" , True )] __description__ = """Connect to jabber and let owner perform different tasks""" __license__ = "GPLv3" @@ -59,7 +59,7 @@ class XMPPInterface(IRCInterface, JabberClient): ] - def coreReady(self): + def activate(self): self.new_package = {} self.start() diff --git a/module/plugins/addon/__init__.py b/module/plugins/addon/__init__.py new file mode 100644 index 000000000..40a96afc6 --- /dev/null +++ b/module/plugins/addon/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/module/plugins/captcha/AdYouLike.py b/module/plugins/captcha/AdYouLike.py new file mode 100644 index 000000000..bfb8b5ccb --- /dev/null +++ b/module/plugins/captcha/AdYouLike.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Captcha import Captcha +from pyload.utils import json_loads + + +class AdYouLike(Captcha): + __name__ = "AdYouLike" + __type__ = "captcha" + __version__ = "0.02" + + __description__ = """AdYouLike captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + AYL_PATTERN = r'Adyoulike\.create\s*\((.+?)\)' + CALLBACK_PATTERN = r'(Adyoulike\.g\._jsonp_\d+)' + + + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = _("AdYouLike html not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + m = re.search(self.AYL_PATTERN, html) + n = re.search(self.CALLBACK_PATTERN, html) + if m and n: + self.key = (m.group(1).strip(), n.group(1).strip()) + self.plugin.logDebug("AdYouLike ayl|callback: %s | %s" % self.key) + return self.key #: key is the tuple(ayl, callback) + else: + self.plugin.logDebug("AdYouLike ayl or callback not found") + return None + + + def challenge(self, key=None): + if not key: + if self.detect_key(): + key = self.key + else: + errmsg = _("AdYouLike key not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + ayl, callback = key + + # {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"}, + # "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}} + ayl = json_loads(ayl) + + html = self.plugin.req.load("http://api-ayl.appspot.com/challenge", + get={'key' : ayl['adyoulike']['key'], + 'env' : ayl['all']['env'], + 'callback': callback}) + try: + challenge = json_loads(re.search(callback + r'\s*\((.+?)\)', html).group(1)) + except Exception: + errmsg = _("AdYouLike challenge pattern not found") + self.plugin.error(errmsg) + raise ValueError(errmsg) + + self.plugin.logDebug("AdYouLike challenge: %s" % challenge) + + return self.result(ayl, challenge) + + + def result(self, server, challenge): + # Adyoulike.g._jsonp_5579316662423138 + # ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}}, + # "site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[], + # "VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike", + # "iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\" + # height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256, + # "token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60}, + # "big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}}, + # "tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"}) + + if isinstance(server, basestring): + server = json_loads(server) + + if isinstance(challenge, basestring): + challenge = json_loads(challenge) + + try: + instructions_visual = challenge['translations'][server['all']['lang']]['instructions_visual'] + result = re.search(u'«(.+?)»', instructions_visual).group(1).strip() + except Exception: + errmsg = _("AdYouLike result not found") + self.plugin.error(errmsg) + raise ValueError(errmsg) + + result = {'_ayl_captcha_engine' : "adyoulike", + '_ayl_env' : server['all']['env'], + '_ayl_tid' : challenge['tid'], + '_ayl_token_challenge': challenge['token'], + '_ayl_response' : response} + + self.plugin.logDebug("AdYouLike result: %s" % result) + + return result diff --git a/module/plugins/captcha/AdsCaptcha.py b/module/plugins/captcha/AdsCaptcha.py new file mode 100644 index 000000000..5c01a422e --- /dev/null +++ b/module/plugins/captcha/AdsCaptcha.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +import re + +from random import random + +from pyload.plugin.Captcha import Captcha + + +class AdsCaptcha(Captcha): + __name__ = "AdsCaptcha" + __type__ = "captcha" + __version__ = "0.06" + + __description__ = """AdsCaptcha captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + + + CAPTCHAID_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*CaptchaId=(\d+)' + PUBLICKEY_PATTERN = r'api\.adscaptcha\.com/Get\.aspx\?[^"\']*PublicKey=([\w-]+)' + + + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = _("AdsCaptcha html not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + m = re.search(self.PUBLICKEY_PATTERN, html) + n = re.search(self.CAPTCHAID_PATTERN, html) + if m and n: + self.key = (m.group(1).strip(), n.group(1).strip()) #: key is the tuple(PublicKey, CaptchaId) + self.plugin.logDebug("AdsCaptcha key|id: %s | %s" % self.key) + return self.key + else: + self.plugin.logDebug("AdsCaptcha key or id not found") + return None + + + def challenge(self, key=None): + if not key: + if self.detect_key(): + key = self.key + else: + errmsg = _("AdsCaptcha key not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + PublicKey, CaptchaId = key + + html = self.plugin.req.load("http://api.adscaptcha.com/Get.aspx", get={'CaptchaId': CaptchaId, 'PublicKey': PublicKey}) + try: + challenge = re.search("challenge: '(.+?)',", html).group(1) + server = re.search("server: '(.+?)',", html).group(1) + except Exception: + errmsg = _("AdsCaptcha challenge pattern not found") + self.plugin.error(errmsg) + raise ValueError(errmsg) + + self.plugin.logDebug("AdsCaptcha challenge: %s" % challenge) + + return challenge, self.result(server, challenge) + + + def result(self, server, challenge): + result = self.plugin.decryptCaptcha("%sChallenge.aspx" % server, + get={'cid': challenge, 'dummy': random()}, + cookies=True, + imgtype="jpg") + + self.plugin.logDebug("AdsCaptcha result: %s" % result) + + return result diff --git a/module/plugins/captcha/ReCaptcha.py b/module/plugins/captcha/ReCaptcha.py new file mode 100644 index 000000000..4b900c57b --- /dev/null +++ b/module/plugins/captcha/ReCaptcha.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Captcha import Captcha + + +class ReCaptcha(Captcha): + __name__ = "ReCaptcha" + __type__ = "captcha" + __version__ = "0.08" + + __description__ = """ReCaptcha captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + + + KEY_PATTERN = r'recaptcha(?:/api|\.net)/(?:challenge|noscript)\?k=([\w-]+)' + KEY_AJAX_PATTERN = r'Recaptcha\.create\s*\(\s*["\']([\w-]+)' + + + def detect_key(self, html=None): + if not html: + if hasattr(self.plugin, "html") and self.plugin.html: + html = self.plugin.html + else: + errmsg = _("ReCaptcha html not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + m = re.search(self.KEY_PATTERN, html) or re.search(self.KEY_AJAX_PATTERN, html) + if m: + self.key = m.group(1).strip() + self.plugin.logDebug("ReCaptcha key: %s" % self.key) + return self.key + else: + self.plugin.logDebug("ReCaptcha key not found") + return None + + + def challenge(self, key=None): + if not key: + if self.detect_key(): + key = self.key + else: + errmsg = _("ReCaptcha key not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + html = self.plugin.req.load("http://www.google.com/recaptcha/api/challenge", get={'k': key}) + try: + challenge = re.search("challenge : '(.+?)',", html).group(1) + server = re.search("server : '(.+?)',", html).group(1) + except Exception: + errmsg = _("ReCaptcha challenge pattern not found") + self.plugin.error(errmsg) + raise ValueError(errmsg) + + self.plugin.logDebug("ReCaptcha challenge: %s" % challenge) + + return challenge, self.result(server, challenge) + + + def result(self, server, challenge): + result = self.plugin.decryptCaptcha("%simage" % server, + get={'c': challenge}, + cookies=True, + forceUser=True, + imgtype="jpg") + + self.plugin.logDebug("ReCaptcha result: %s" % result) + + return result diff --git a/module/plugins/captcha/SolveMedia.py b/module/plugins/captcha/SolveMedia.py new file mode 100644 index 000000000..6e2a6c362 --- /dev/null +++ b/module/plugins/captcha/SolveMedia.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +import re + +from pyload.plugin.Captcha import Captcha + + +class SolveMedia(Captcha): + __name__ = "SolveMedia" + __type__ = "captcha" + __version__ = "0.06" + + __description__ = """SolveMedia captcha service plugin""" + __license__ = "GPLv3" + __authors__ = [("pyLoad Team", "admin@pyload.org")] + + + KEY_PATTERN = r'api\.solvemedia\.com/papi/challenge\.(?:no)?script\?k=(.+?)["\']' + + + def challenge(self, key=None): + if not key: + if self.detect_key(): + key = self.key + else: + errmsg = _("SolveMedia key not found") + self.plugin.fail(errmsg) + raise TypeError(errmsg) + + html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.noscript", get={'k': key}) + try: + challenge = re.search(r'<input type=hidden name="adcopy_challenge" id="adcopy_challenge" value="([^"]+)">', + html).group(1) + server = "http://api.solvemedia.com/papi/media" + except Exception: + errmsg = _("SolveMedia challenge pattern not found") + self.plugin.error(errmsg) + raise ValueError(errmsg) + + self.plugin.logDebug("SolveMedia challenge: %s" % challenge) + + return challenge, self.result(server, challenge) + + + def result(self, server, challenge): + result = self.plugin.decryptCaptcha(server, get={'c': challenge}, imgtype="gif") + + self.plugin.logDebug("SolveMedia result: %s" % result) + + return result diff --git a/module/plugins/captcha/__init__.py b/module/plugins/captcha/__init__.py index e69de29bb..40a96afc6 100644 --- a/module/plugins/captcha/__init__.py +++ b/module/plugins/captcha/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/module/plugins/container/__init__.py b/module/plugins/container/__init__.py index e69de29bb..40a96afc6 100644 --- a/module/plugins/container/__init__.py +++ b/module/plugins/container/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/module/plugins/crypter/BitshareComFolder.py b/module/plugins/crypter/BitshareCom.py index c70a849b6..2960243fc 100644 --- a/module/plugins/crypter/BitshareComFolder.py +++ b/module/plugins/crypter/BitshareCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class BitshareComFolder(SimpleCrypter): - __name__ = "BitshareComFolder" +class BitshareCom(SimpleCrypter): + __name__ = "BitshareCom" __type__ = "crypter" __version__ = "0.03" diff --git a/module/plugins/crypter/C1NeonCom.py b/module/plugins/crypter/C1NeonCom.py index 926633ff7..eaccb471f 100644 --- a/module/plugins/crypter/C1NeonCom.py +++ b/module/plugins/crypter/C1NeonCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class C1NeonCom(DeadCrypter): diff --git a/module/plugins/crypter/ChipDe.py b/module/plugins/crypter/ChipDe.py index 2fc36c355..2f47236e8 100644 --- a/module/plugins/crypter/ChipDe.py +++ b/module/plugins/crypter/ChipDe.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class ChipDe(Crypter): diff --git a/module/plugins/crypter/CrockoComFolder.py b/module/plugins/crypter/CrockoCom.py index 57bb339ff..9fad661d2 100644 --- a/module/plugins/crypter/CrockoComFolder.py +++ b/module/plugins/crypter/CrockoCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class CrockoComFolder(SimpleCrypter): - __name__ = "CrockoComFolder" +class CrockoCom(SimpleCrypter): + __name__ = "CrockoCom" __type__ = "crypter" __version__ = "0.01" diff --git a/module/plugins/crypter/CryptItCom.py b/module/plugins/crypter/CryptItCom.py index 2cf4e9f62..cb3347f55 100644 --- a/module/plugins/crypter/CryptItCom.py +++ b/module/plugins/crypter/CryptItCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class CryptItCom(DeadCrypter): diff --git a/module/plugins/crypter/CzshareComFolder.py b/module/plugins/crypter/CzshareCom.py index 5623a4093..e527d683f 100644 --- a/module/plugins/crypter/CzshareComFolder.py +++ b/module/plugins/crypter/CzshareCom.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter -class CzshareComFolder(Crypter): - __name__ = "CzshareComFolder" +class CzshareCom(Crypter): + __name__ = "CzshareCom" __type__ = "crypter" __version__ = "0.20" diff --git a/module/plugins/crypter/DDLMusicOrg.py b/module/plugins/crypter/DDLMusicOrg.py index 55181e9ad..2b6738799 100644 --- a/module/plugins/crypter/DDLMusicOrg.py +++ b/module/plugins/crypter/DDLMusicOrg.py @@ -4,7 +4,7 @@ import re from time import sleep -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class DDLMusicOrg(Crypter): diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index 82b80ab2f..c66c7c829 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -4,9 +4,9 @@ import re from urlparse import urljoin -from module.common.json_layer import json_loads -from module.plugins.Crypter import Crypter -from module.utils import save_join +from pyload.utils import json_loads +from pyload.plugin.Crypter import Crypter +from pyload.utils import safe_join class DailymotionBatch(Crypter): @@ -101,6 +101,6 @@ class DailymotionBatch(Crypter): for p_id, p_name, p_owner in playlists: p_videos = self.getVideos(p_id) - p_folder = save_join(self.config['general']['download_folder'], p_owner, p_name) + p_folder = safe_join(self.config['general']['download_folder'], p_owner, p_name) self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) self.packages.append((p_name, p_videos, p_folder)) #: folder is NOT recognized by pyload 0.4.9! diff --git a/module/plugins/crypter/DataHuFolder.py b/module/plugins/crypter/DataHu.py index a5602d6c6..e8b3acbb7 100644 --- a/module/plugins/crypter/DataHuFolder.py +++ b/module/plugins/crypter/DataHu.py @@ -2,11 +2,11 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class DataHuFolder(SimpleCrypter): - __name__ = "DataHuFolder" +class DataHu(SimpleCrypter): + __name__ = "DataHu" __type__ = "crypter" __version__ = "0.06" @@ -16,7 +16,7 @@ class DataHuFolder(SimpleCrypter): __description__ = """Data.hu folder decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("crash", None), + __authors__ = [("crash", ""), ("stickell", "l.stickell@yahoo.it")] @@ -25,7 +25,7 @@ class DataHuFolder(SimpleCrypter): def prepare(self): - super(DataHuFolder, self).prepare() + super(DataHu, self).prepare() if u'K\xe9rlek add meg a jelsz\xf3t' in self.html: # Password protected password = self.getPassword() diff --git a/module/plugins/crypter/DdlstorageComFolder.py b/module/plugins/crypter/DdlstorageCom.py index e02e77fda..1d87e975b 100644 --- a/module/plugins/crypter/DdlstorageComFolder.py +++ b/module/plugins/crypter/DdlstorageCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class DdlstorageComFolder(DeadCrypter): - __name__ = "DdlstorageComFolder" +class DdlstorageCom(DeadCrypter): + __name__ = "DdlstorageCom" __type__ = "crypter" __version__ = "0.03" @@ -17,4 +17,4 @@ class DdlstorageComFolder(DeadCrypter): ("stickell", "l.stickell@yahoo.it")] -getInfo = create_getInfo(DdlstorageComFolder) +getInfo = create_getInfo(DdlstorageCom) diff --git a/module/plugins/crypter/DepositfilesComFolder.py b/module/plugins/crypter/DepositfilesCom.py index 147f093c3..ba578a4ed 100644 --- a/module/plugins/crypter/DepositfilesComFolder.py +++ b/module/plugins/crypter/DepositfilesCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class DepositfilesComFolder(SimpleCrypter): - __name__ = "DepositfilesComFolder" +class DepositfilesCom(SimpleCrypter): + __name__ = "DepositfilesCom" __type__ = "crypter" __version__ = "0.01" diff --git a/module/plugins/crypter/Dereferer.py b/module/plugins/crypter/Dereferer.py index 0729c8cb6..d52bb1094 100644 --- a/module/plugins/crypter/Dereferer.py +++ b/module/plugins/crypter/Dereferer.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleDereferer import SimpleDereferer +from module.plugins.Crypter import Crypter class Dereferer(SimpleDereferer): diff --git a/module/plugins/crypter/DevhostStFolder.py b/module/plugins/crypter/DevhostStFolder.py index 8779cae5e..2fbc90ba8 100644 --- a/module/plugins/crypter/DevhostStFolder.py +++ b/module/plugins/crypter/DevhostStFolder.py @@ -7,7 +7,7 @@ import re from urlparse import urljoin -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class DevhostStFolder(SimpleCrypter): diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py index 4a188aa83..1cfe7639a 100644 --- a/module/plugins/crypter/DlProtectCom.py +++ b/module/plugins/crypter/DlProtectCom.py @@ -5,7 +5,7 @@ import re from base64 import urlsafe_b64encode from time import time -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class DlProtectCom(SimpleCrypter): diff --git a/module/plugins/crypter/DontKnowMe.py b/module/plugins/crypter/DontKnowMe.py index d656cde4c..7a4b85b2d 100644 --- a/module/plugins/crypter/DontKnowMe.py +++ b/module/plugins/crypter/DontKnowMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleDereferer import SimpleDereferer +from module.plugins.Crypter import Crypter class DontKnowMe(SimpleDereferer): diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index 07cc5cdc4..55681fd5e 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -4,7 +4,7 @@ import re from BeautifulSoup import BeautifulSoup -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class DuckCryptInfo(Crypter): diff --git a/module/plugins/crypter/DuploadOrgFolder.py b/module/plugins/crypter/DuploadOrg.py index 066fbe3d7..70745b550 100644 --- a/module/plugins/crypter/DuploadOrgFolder.py +++ b/module/plugins/crypter/DuploadOrg.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class DuploadOrgFolder(DeadCrypter): - __name__ = "DuploadOrgFolder" +class DuploadOrg(DeadCrypter): + __name__ = "DuploadOrg" __type__ = "crypter" __version__ = "0.02" @@ -16,4 +16,4 @@ class DuploadOrgFolder(DeadCrypter): __authors__ = [("stickell", "l.stickell@yahoo.it")] -getInfo = create_getInfo(DuploadOrgFolder) +getInfo = create_getInfo(DuploadOrg) diff --git a/module/plugins/crypter/EasybytezComFolder.py b/module/plugins/crypter/EasybytezCom.py index 6c643e83f..d9685e2f1 100644 --- a/module/plugins/crypter/EasybytezComFolder.py +++ b/module/plugins/crypter/EasybytezCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo +from module.plugins.internal.XFSCrypter import XFSCrypter -class EasybytezComFolder(XFSCrypter): - __name__ = "EasybytezComFolder" +class EasybytezCom(XFSCrypter): + __name__ = "EasybytezCom" __type__ = "crypter" __version__ = "0.10" diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py index 456e48a32..c94e7e106 100644 --- a/module/plugins/crypter/EmbeduploadCom.py +++ b/module/plugins/crypter/EmbeduploadCom.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Crypter import Crypter -from module.network.HTTPRequest import BadHeader +from pyload.plugin.Crypter import Crypter +from pyload.network.HTTPRequest import BadHeader class EmbeduploadCom(Crypter): @@ -12,9 +12,9 @@ class EmbeduploadCom(Crypter): __pattern__ = r'http://(?:www\.)?embedupload\.com/\?d=.+' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True), - ("preferedHoster", "str", "Prefered hoster list (bar-separated)", "embedupload"), - ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] + ("subfolder_per_package", "bool", "Create a subfolder for each package", True), + ("preferedHoster", "str", "Prefered hoster list (bar-separated)", "embedupload"), + ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] __description__ = """EmbedUpload.com decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/crypter/FilebeerInfoFolder.py b/module/plugins/crypter/FilebeerInfo.py index a3c7ee74c..4e8ab1259 100644 --- a/module/plugins/crypter/FilebeerInfoFolder.py +++ b/module/plugins/crypter/FilebeerInfo.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class FilebeerInfoFolder(DeadCrypter): - __name__ = "FilebeerInfoFolder" +class FilebeerInfo(DeadCrypter): + __name__ = "FilebeerInfo" __type__ = "crypter" __version__ = "0.02" @@ -16,4 +16,4 @@ class FilebeerInfoFolder(DeadCrypter): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] -getInfo = create_getInfo(FilebeerInfoFolder) +getInfo = create_getInfo(FilebeerInfo) diff --git a/module/plugins/crypter/FilecloudIoFolder.py b/module/plugins/crypter/FilecloudIo.py index 83cce352d..d0ca619de 100644 --- a/module/plugins/crypter/FilecloudIoFolder.py +++ b/module/plugins/crypter/FilecloudIo.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class FilecloudIoFolder(SimpleCrypter): - __name__ = "FilecloudIoFolder" +class FilecloudIo(SimpleCrypter): + __name__ = "FilecloudIo" __type__ = "crypter" __version__ = "0.03" diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index d15d2ae4b..938ceafa9 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- -# http://filecrypt.cc/Container/64E039F859.html +# +# Test links: +# http://filecrypt.cc/Container/64E039F859.html import binascii import re @@ -7,7 +9,7 @@ import re from Crypto.Cipher import AES from urlparse import urljoin -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter from module.plugins.internal.CaptchaService import ReCaptcha @@ -20,7 +22,7 @@ class FilecryptCc(Crypter): __description__ = """Filecrypt.cc decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("zapp-brannigan", "")] + __authors__ = [("zapp-brannigan", "fuerst.reinje@web.de")] # URL_REPLACEMENTS = [(r'.html$', ""), (r'$', ".html")] #@TODO: Extend SimpleCrypter diff --git a/module/plugins/crypter/FilefactoryComFolder.py b/module/plugins/crypter/FilefactoryCom.py index 261c7e01a..c6bdb81eb 100644 --- a/module/plugins/crypter/FilefactoryComFolder.py +++ b/module/plugins/crypter/FilefactoryCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class FilefactoryComFolder(SimpleCrypter): - __name__ = "FilefactoryComFolder" +class FilefactoryCom(SimpleCrypter): + __name__ = "FilefactoryCom" __type__ = "crypter" __version__ = "0.32" diff --git a/module/plugins/crypter/FilerNetFolder.py b/module/plugins/crypter/FilerNet.py index d33e26ee8..054c8d3a7 100644 --- a/module/plugins/crypter/FilerNetFolder.py +++ b/module/plugins/crypter/FilerNet.py @@ -1,10 +1,10 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter -class FilerNetFolder(SimpleCrypter): - __name__ = "FilerNetFolder" +class FilerNet(SimpleCrypter): + __name__ = "FilerNet" __type__ = "crypter" __version__ = "0.42" diff --git a/module/plugins/crypter/FileserveComFolder.py b/module/plugins/crypter/FileserveCom.py index e6b35fd36..ab0665fbd 100644 --- a/module/plugins/crypter/FileserveComFolder.py +++ b/module/plugins/crypter/FileserveCom.py @@ -2,11 +2,11 @@ import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter -class FileserveComFolder(Crypter): - __name__ = "FileserveComFolder" +class FileserveCom(Crypter): + __name__ = "FileserveCom" __type__ = "crypter" __version__ = "0.11" diff --git a/module/plugins/crypter/FilesonicComFolder.py b/module/plugins/crypter/FilesonicCom.py index d58516986..b1722c1bb 100644 --- a/module/plugins/crypter/FilesonicComFolder.py +++ b/module/plugins/crypter/FilesonicCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class FilesonicComFolder(DeadCrypter): - __name__ = "FilesonicComFolder" +class FilesonicCom(DeadCrypter): + __name__ = "FilesonicCom" __type__ = "crypter" __version__ = "0.12" @@ -15,4 +15,4 @@ class FilesonicComFolder(DeadCrypter): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] -getInfo = create_getInfo(FilesonicComFolder) +getInfo = create_getInfo(FilesonicCom) diff --git a/module/plugins/crypter/FilestubeCom.py b/module/plugins/crypter/FilestubeCom.py index 16ebdda37..befe6f9a7 100644 --- a/module/plugins/crypter/FilestubeCom.py +++ b/module/plugins/crypter/FilestubeCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FilestubeCom(SimpleCrypter): diff --git a/module/plugins/crypter/FiletramCom.py b/module/plugins/crypter/FiletramCom.py index 76530c589..6c3c071ec 100644 --- a/module/plugins/crypter/FiletramCom.py +++ b/module/plugins/crypter/FiletramCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from module.plugins.internal.SimpleCrypter import SimpleCrypter class FiletramCom(SimpleCrypter): diff --git a/module/plugins/crypter/FiredriveComFolder.py b/module/plugins/crypter/FiredriveCom.py index 7d3a357fd..bf315ad16 100644 --- a/module/plugins/crypter/FiredriveComFolder.py +++ b/module/plugins/crypter/FiredriveCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class FiredriveComFolder(DeadCrypter): - __name__ = "FiredriveComFolder" +class FiredriveCom(DeadCrypter): + __name__ = "FiredriveCom" __type__ = "crypter" __version__ = "0.03" @@ -16,4 +16,4 @@ class FiredriveComFolder(DeadCrypter): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] -getInfo = create_getInfo(FiredriveComFolder) +getInfo = create_getInfo(FiredriveCom) diff --git a/module/plugins/crypter/FourChanOrg.py b/module/plugins/crypter/FourChanOrg.py index c3fe3db4b..62fb9d3fe 100644 --- a/module/plugins/crypter/FourChanOrg.py +++ b/module/plugins/crypter/FourChanOrg.py @@ -4,7 +4,7 @@ import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class FourChanOrg(Crypter): diff --git a/module/plugins/crypter/FreakhareComFolder.py b/module/plugins/crypter/FreakhareCom.py index 7c1b7de2b..c5fd2ee29 100644 --- a/module/plugins/crypter/FreakhareComFolder.py +++ b/module/plugins/crypter/FreakhareCom.py @@ -2,11 +2,11 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from pyload.plugin.internal.SimpleCrypter import SimpleCrypter -class FreakhareComFolder(SimpleCrypter): - __name__ = "FreakhareComFolder" +class FreakhareCom(SimpleCrypter): + __name__ = "FreakhareCom" __type__ = "crypter" __version__ = "0.03" diff --git a/module/plugins/crypter/FreetexthostCom.py b/module/plugins/crypter/FreetexthostCom.py index c33c9ff64..4634455b6 100644 --- a/module/plugins/crypter/FreetexthostCom.py +++ b/module/plugins/crypter/FreetexthostCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from pyload.plugin.internal.SimpleCrypter import SimpleCrypter class FreetexthostCom(SimpleCrypter): diff --git a/module/plugins/crypter/FshareVnFolder.py b/module/plugins/crypter/FshareVn.py index 474364e40..e85085cf1 100644 --- a/module/plugins/crypter/FshareVnFolder.py +++ b/module/plugins/crypter/FshareVn.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from pyload.plugin.internal.SimpleCrypter import SimpleCrypter -class FshareVnFolder(SimpleCrypter): - __name__ = "FshareVnFolder" +class FshareVn(SimpleCrypter): + __name__ = "FshareVn" __type__ = "crypter" __version__ = "0.01" diff --git a/module/plugins/crypter/Go4UpCom.py b/module/plugins/crypter/Go4UpCom.py index a7e16c0ab..ffd945737 100644 --- a/module/plugins/crypter/Go4UpCom.py +++ b/module/plugins/crypter/Go4UpCom.py @@ -4,7 +4,7 @@ import re from urlparse import urljoin -from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo +from pyload.plugin.internal.SimpleCrypter import SimpleCrypter, create_getInfo class Go4UpCom(SimpleCrypter): diff --git a/module/plugins/crypter/GooGl.py b/module/plugins/crypter/GooGl.py index d548a3375..13ffce505 100644 --- a/module/plugins/crypter/GooGl.py +++ b/module/plugins/crypter/GooGl.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.Crypter import Crypter -from module.common.json_layer import json_loads +from pyload.plugin.Crypter import Crypter +from pyload.utils import json_loads class GooGl(Crypter): diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index a347e4232..a12d7c02a 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -4,7 +4,7 @@ import re from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class HoerbuchIn(Crypter): diff --git a/module/plugins/crypter/HotfileComFolder.py b/module/plugins/crypter/HotfileCom.py index 4f40587ad..72eec8f93 100644 --- a/module/plugins/crypter/HotfileComFolder.py +++ b/module/plugins/crypter/HotfileCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class HotfileComFolder(DeadCrypter): - __name__ = "HotfileComFolder" +class HotfileCom(DeadCrypter): + __name__ = "HotfileCom" __type__ = "crypter" __version__ = "0.30" @@ -16,4 +16,4 @@ class HotfileComFolder(DeadCrypter): __authors__ = [("RaNaN", "RaNaN@pyload.org")] -getInfo = create_getInfo(HotfileComFolder) +getInfo = create_getInfo(HotfileCom) diff --git a/module/plugins/crypter/ILoadTo.py b/module/plugins/crypter/ILoadTo.py index f3415706d..d3e50630c 100644 --- a/module/plugins/crypter/ILoadTo.py +++ b/module/plugins/crypter/ILoadTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class ILoadTo(DeadCrypter): @@ -13,7 +13,7 @@ class ILoadTo(DeadCrypter): __description__ = """Iload.to decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("hzpz", None)] + __authors__ = [("hzpz", "")] getInfo = create_getInfo(ILoadTo) diff --git a/module/plugins/crypter/LetitbitNetFolder.py b/module/plugins/crypter/LetitbitNet.py index 56ecbc7f8..24bc196b3 100644 --- a/module/plugins/crypter/LetitbitNetFolder.py +++ b/module/plugins/crypter/LetitbitNet.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter -class LetitbitNetFolder(Crypter): - __name__ = "LetitbitNetFolder" +class LetitbitNet(Crypter): + __name__ = "LetitbitNet" __type__ = "crypter" __version__ = "0.10" diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 018ed90ba..a3eb4f179 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -7,8 +7,8 @@ import pycurl from Crypto.Cipher import AES -from module.plugins.Crypter import Crypter -from module.utils import html_unescape +from pyload.plugin.Crypter import Crypter +from pyload.utils import html_unescape class LinkCryptWs(Crypter): @@ -21,8 +21,8 @@ class LinkCryptWs(Crypter): __description__ = """LinkCrypt.ws decrypter plugin""" __license__ = "GPLv3" __authors__ = [("kagenoshin", "kagenoshin[AT]gmx[DOT]ch"), - ("glukgluk", None), - ("Gummibaer", None)] + ("glukgluk", ""), + ("Gummibaer", "")] CRYPTED_KEY = "crypted" diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index 7f24784c7..facec37d5 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class LinkdecrypterCom(Crypter): @@ -16,7 +16,7 @@ class LinkdecrypterCom(Crypter): __description__ = """Linkdecrypter.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("flowlee", None)] + ("flowlee", "")] TEXTAREA_PATTERN = r'<textarea name="links" wrap="off" readonly="1" class="caja_des">(.+)</textarea>' diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index d899d58c7..4b978723f 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -2,7 +2,7 @@ import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class LixIn(Crypter): diff --git a/module/plugins/crypter/LofCc.py b/module/plugins/crypter/LofCc.py index 3cac0fbf2..e18349877 100644 --- a/module/plugins/crypter/LofCc.py +++ b/module/plugins/crypter/LofCc.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class LofCc(DeadCrypter): diff --git a/module/plugins/crypter/MBLinkInfo.py b/module/plugins/crypter/MBLinkInfo.py index 82c2d9719..7f1561756 100644 --- a/module/plugins/crypter/MBLinkInfo.py +++ b/module/plugins/crypter/MBLinkInfo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class MBLinkInfo(DeadCrypter): diff --git a/module/plugins/crypter/MediafireComFolder.py b/module/plugins/crypter/MediafireCom.py index d1dc89518..a7360a6db 100644 --- a/module/plugins/crypter/MediafireComFolder.py +++ b/module/plugins/crypter/MediafireCom.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Crypter import Crypter -from module.plugins.hoster.MediafireCom import checkHTMLHeader -from module.common.json_layer import json_loads +from pyload.plugin.Crypter import Crypter +from pyload.plugin.hoster.MediafireCom import checkHTMLHeader +from pyload.utils import json_loads -class MediafireComFolder(Crypter): - __name__ = "MediafireComFolder" +class MediafireCom(Crypter): + __name__ = "MediafireCom" __type__ = "crypter" __version__ = "0.14" diff --git a/module/plugins/crypter/MegaRapidCzFolder.py b/module/plugins/crypter/MegaRapidCz.py index e7dff6c8a..86235444b 100644 --- a/module/plugins/crypter/MegaRapidCzFolder.py +++ b/module/plugins/crypter/MegaRapidCz.py @@ -3,8 +3,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -class MegaRapidCzFolder(SimpleCrypter): - __name__ = "MegaRapidCzFolder" +class MegaRapidCz(SimpleCrypter): + __name__ = "MegaRapidCz" __type__ = "crypter" __version__ = "0.02" diff --git a/module/plugins/crypter/MegauploadComFolder.py b/module/plugins/crypter/MegauploadCom.py index 08f96700d..6981cebc8 100644 --- a/module/plugins/crypter/MegauploadComFolder.py +++ b/module/plugins/crypter/MegauploadCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class MegauploadComFolder(DeadCrypter): - __name__ = "MegauploadComFolder" +class MegauploadCom(DeadCrypter): + __name__ = "MegauploadCom" __type__ = "crypter" __version__ = "0.02" @@ -15,4 +15,4 @@ class MegauploadComFolder(DeadCrypter): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] -getInfo = create_getInfo(MegauploadComFolder) +getInfo = create_getInfo(MegauploadCom) diff --git a/module/plugins/crypter/Movie2KTo.py b/module/plugins/crypter/Movie2KTo.py index 76bf702ac..92bc128c7 100644 --- a/module/plugins/crypter/Movie2KTo.py +++ b/module/plugins/crypter/Movie2KTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class Movie2KTo(DeadCrypter): diff --git a/module/plugins/crypter/MultiUpOrg.py b/module/plugins/crypter/MultiUpOrg.py index 5209ebf09..7955fca6c 100644 --- a/module/plugins/crypter/MultiUpOrg.py +++ b/module/plugins/crypter/MultiUpOrg.py @@ -15,7 +15,7 @@ class MultiUpOrg(SimpleCrypter): __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - __description__ = """MultiUp.org crypter plugin""" + __description__ = """MultiUp.org decrypter plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py index 55f424f36..856a94a25 100644 --- a/module/plugins/crypter/MultiloadCz.py +++ b/module/plugins/crypter/MultiloadCz.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class MultiloadCz(Crypter): @@ -11,9 +11,9 @@ class MultiloadCz(Crypter): __pattern__ = r'http://(?:[^/]*\.)?multiload\.cz/(stahnout|slozka)/.+' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True), - ("usedHoster", "str", "Prefered hoster list (bar-separated)", ""), - ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] + ("subfolder_per_package", "bool", "Create a subfolder for each package", True), + ("usedHoster", "str", "Prefered hoster list (bar-separated)", ""), + ("ignoredHoster", "str", "Ignored hoster list (bar-separated)", "")] __description__ = """Multiload.cz decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/crypter/MultiuploadCom.py b/module/plugins/crypter/MultiuploadCom.py index 347b7e5af..98708bd95 100644 --- a/module/plugins/crypter/MultiuploadCom.py +++ b/module/plugins/crypter/MultiuploadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class MultiuploadCom(DeadCrypter): @@ -9,9 +9,8 @@ class MultiuploadCom(DeadCrypter): __version__ = "0.02" __pattern__ = r'http://(?:www\.)?multiupload\.(com|nl)/\w+' - __config__ = [] - __description__ = """ MultiUpload.com decrypter plugin """ + __description__ = """MultiUpload.com decrypter plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index 20e7c72e2..29b45b11a 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -5,8 +5,8 @@ import re from Crypto.Cipher import AES -from module.plugins.Crypter import Crypter -from module.plugins.internal.CaptchaService import ReCaptcha +from pyload.plugin.Crypter import Crypter +from pyload.plugin.internal.captcha import ReCaptcha class NCryptIn(Crypter): diff --git a/module/plugins/crypter/OneKhDe.py b/module/plugins/crypter/OneKhDe.py index 3e75d97b5..323214df8 100644 --- a/module/plugins/crypter/OneKhDe.py +++ b/module/plugins/crypter/OneKhDe.py @@ -2,9 +2,9 @@ import re -from module.unescape import unescape +from pyload.utils import html_unescape -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class OneKhDe(Crypter): @@ -37,6 +37,5 @@ class OneKhDe(Crypter): self.html = self.load(url) link_ids = re.findall(r"<a id=\"DownloadLink_(\d*)\" href=\"http://1kh.de/", self.html) for id in link_ids: - new_link = unescape( - re.search("width=\"100%\" src=\"(.*)\"></iframe>", self.load("http://1kh.de/l/" + id)).group(1)) + new_link = html_unescape(re.search("width=\"100%\" src=\"(.*)\"></iframe>", self.load("http://1kh.de/l/" + id)).group(1)) self.urls.append(new_link) diff --git a/module/plugins/crypter/OronComFolder.py b/module/plugins/crypter/OronCom.py index 9e06bdf32..42483c497 100644 --- a/module/plugins/crypter/OronComFolder.py +++ b/module/plugins/crypter/OronCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class OronComFolder(DeadCrypter): - __name__ = "OronComFolder" +class OronCom(DeadCrypter): + __name__ = "OronCom" __type__ = "crypter" __version__ = "0.11" @@ -16,4 +16,4 @@ class OronComFolder(DeadCrypter): __authors__ = [("DHMH", "webmaster@pcProfil.de")] -getInfo = create_getInfo(OronComFolder) +getInfo = create_getInfo(OronCom) diff --git a/module/plugins/crypter/QuickshareCzFolder.py b/module/plugins/crypter/QuickshareCz.py index 70666b55a..8cd4b9c02 100644 --- a/module/plugins/crypter/QuickshareCzFolder.py +++ b/module/plugins/crypter/QuickshareCz.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter -class QuickshareCzFolder(Crypter): - __name__ = "QuickshareCzFolder" +class QuickshareCz(Crypter): + __name__ = "QuickshareCz" __type__ = "crypter" __version__ = "0.10" diff --git a/module/plugins/crypter/RSLayerCom.py b/module/plugins/crypter/RSLayerCom.py index cc3b23bbc..ebd3c509c 100644 --- a/module/plugins/crypter/RSLayerCom.py +++ b/module/plugins/crypter/RSLayerCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class RSLayerCom(DeadCrypter): @@ -13,7 +13,7 @@ class RSLayerCom(DeadCrypter): __description__ = """RS-Layer.com decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("hzpz", None)] + __authors__ = [("hzpz", "")] getInfo = create_getInfo(RSLayerCom) diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index c50481af0..b361f87d8 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -7,8 +7,8 @@ import re import os from Crypto.Cipher import AES -from module.plugins.Crypter import Crypter -from module.utils import save_join +from pyload.plugin.Crypter import Crypter +from module.utils import safe_join class RelinkUs(Crypter): diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index 8e46e1e41..2d5d273ed 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -2,13 +2,11 @@ import re -from pycurl import FOLLOWLOCATION - from BeautifulSoup import BeautifulSoup -from module.common.json_layer import json_loads -from module.plugins.Crypter import Crypter -from module.plugins.internal.CaptchaService import SolveMedia +from pyload.utils import json_loads +from pyload.plugin.Crypter import Crypter +from pyload.plugin.internal.captcha import SolveMedia class SafelinkingNet(Crypter): diff --git a/module/plugins/crypter/SecuredIn.py b/module/plugins/crypter/SecuredIn.py index cbfa919ac..9aee9e52e 100644 --- a/module/plugins/crypter/SecuredIn.py +++ b/module/plugins/crypter/SecuredIn.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class SecuredIn(DeadCrypter): diff --git a/module/plugins/crypter/SexuriaCom.py b/module/plugins/crypter/SexuriaCom.py index 3c952fd6b..10101cd7a 100644 --- a/module/plugins/crypter/SexuriaCom.py +++ b/module/plugins/crypter/SexuriaCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class SexuriaCom(Crypter): diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 00a037b2e..1328e86aa 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -4,7 +4,7 @@ import binascii import re from Crypto.Cipher import AES -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class ShareLinksBiz(Crypter): diff --git a/module/plugins/crypter/SharingmatrixComFolder.py b/module/plugins/crypter/SharingmatrixCom.py index e16bdf814..be23ada49 100644 --- a/module/plugins/crypter/SharingmatrixComFolder.py +++ b/module/plugins/crypter/SharingmatrixCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class SharingmatrixComFolder(DeadCrypter): - __name__ = "SharingmatrixComFolder" +class SharingmatrixCom(DeadCrypter): + __name__ = "SharingmatrixCom" __type__ = "crypter" __version__ = "0.01" @@ -15,4 +15,4 @@ class SharingmatrixComFolder(DeadCrypter): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] -getInfo = create_getInfo(SharingmatrixComFolder) +getInfo = create_getInfo(SharingmatrixCom) diff --git a/module/plugins/crypter/SpeedLoadOrgFolder.py b/module/plugins/crypter/SpeedLoadOrg.py index ddde7dec2..190ec66eb 100644 --- a/module/plugins/crypter/SpeedLoadOrgFolder.py +++ b/module/plugins/crypter/SpeedLoadOrg.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class SpeedLoadOrgFolder(DeadCrypter): - __name__ = "SpeedLoadOrgFolder" +class SpeedLoadOrg(DeadCrypter): + __name__ = "SpeedLoadOrg" __type__ = "crypter" __version__ = "0.30" @@ -16,4 +16,4 @@ class SpeedLoadOrgFolder(DeadCrypter): __authors__ = [("stickell", "l.stickell@yahoo.it")] -getInfo = create_getInfo(SpeedLoadOrgFolder) +getInfo = create_getInfo(SpeedLoadOrg) diff --git a/module/plugins/crypter/StealthTo.py b/module/plugins/crypter/StealthTo.py index 5173421f1..8513fb3f8 100644 --- a/module/plugins/crypter/StealthTo.py +++ b/module/plugins/crypter/StealthTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class StealthTo(DeadCrypter): diff --git a/module/plugins/crypter/TrailerzoneInfo.py b/module/plugins/crypter/TrailerzoneInfo.py index 10780dd45..ca14e6df5 100644 --- a/module/plugins/crypter/TrailerzoneInfo.py +++ b/module/plugins/crypter/TrailerzoneInfo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class TrailerzoneInfo(DeadCrypter): diff --git a/module/plugins/crypter/TurbobitNetFolder.py b/module/plugins/crypter/TurbobitNet.py index c6734c997..67f7c74d4 100644 --- a/module/plugins/crypter/TurbobitNetFolder.py +++ b/module/plugins/crypter/TurbobitNet.py @@ -3,11 +3,11 @@ import re from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -from module.common.json_layer import json_loads +from pyload.utils import json_loads -class TurbobitNetFolder(SimpleCrypter): - __name__ = "TurbobitNetFolder" +class TurbobitNet(SimpleCrypter): + __name__ = "TurbobitNet" __type__ = "crypter" __version__ = "0.05" diff --git a/module/plugins/crypter/TusfilesNetFolder.py b/module/plugins/crypter/TusfilesNet.py index cb8efc9a8..94b6bbb5d 100644 --- a/module/plugins/crypter/TusfilesNetFolder.py +++ b/module/plugins/crypter/TusfilesNet.py @@ -7,8 +7,8 @@ from urlparse import urljoin from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo -class TusfilesNetFolder(XFSCrypter): - __name__ = "TusfilesNetFolder" +class TusfilesNet(XFSCrypter): + __name__ = "TusfilesNet" __type__ = "crypter" __version__ = "0.08" diff --git a/module/plugins/crypter/UlozToFolder.py b/module/plugins/crypter/UlozTo.py index a1f3ed5ea..81fbee172 100644 --- a/module/plugins/crypter/UlozToFolder.py +++ b/module/plugins/crypter/UlozTo.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- import re -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter -class UlozToFolder(Crypter): - __name__ = "UlozToFolder" +class UlozTo(Crypter): + __name__ = "UlozTo" __type__ = "crypter" __version__ = "0.20" diff --git a/module/plugins/crypter/UploadableChFolder.py b/module/plugins/crypter/UploadableCh.py index 22f9ca2ed..8e4ff71c0 100644 --- a/module/plugins/crypter/UploadableChFolder.py +++ b/module/plugins/crypter/UploadableCh.py @@ -3,8 +3,8 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -class UploadableChFolder(SimpleCrypter): - __name__ = "UploadableChFolder" +class UploadableCh(SimpleCrypter): + __name__ = "UploadableCh" __type__ = "crypter" __version__ = "0.03" @@ -12,7 +12,7 @@ class UploadableChFolder(SimpleCrypter): __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] - __description__ = """ Uploadable.ch folder decrypter plugin """ + __description__ = """Uploadable.ch folder decrypter plugin""" __license__ = "GPLv3" __authors__ = [("guidobelix", "guidobelix@hotmail.it"), ("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedTo.py index 0a71add70..f6bc861de 100644 --- a/module/plugins/crypter/UploadedToFolder.py +++ b/module/plugins/crypter/UploadedTo.py @@ -7,8 +7,8 @@ from urlparse import urljoin from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo -class UploadedToFolder(SimpleCrypter): - __name__ = "UploadedToFolder" +class UploadedTo(SimpleCrypter): + __name__ = "UploadedTo" __type__ = "crypter" __version__ = "0.42" diff --git a/module/plugins/crypter/WiiReloadedOrg.py b/module/plugins/crypter/WiiReloadedOrg.py index c3c5b8222..7b4270e65 100644 --- a/module/plugins/crypter/WiiReloadedOrg.py +++ b/module/plugins/crypter/WiiReloadedOrg.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo class WiiReloadedOrg(DeadCrypter): @@ -13,7 +13,7 @@ class WiiReloadedOrg(DeadCrypter): __description__ = """Wii-Reloaded.org decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("hzpz", None)] + __authors__ = [("hzpz", "")] getInfo = create_getInfo(WiiReloadedOrg) diff --git a/module/plugins/crypter/WuploadComFolder.py b/module/plugins/crypter/WuploadCom.py index 873c71fad..0a098a40c 100644 --- a/module/plugins/crypter/WuploadComFolder.py +++ b/module/plugins/crypter/WuploadCom.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo +from pyload.plugin.internal.DeadCrypter import DeadCrypter, create_getInfo -class WuploadComFolder(DeadCrypter): - __name__ = "WuploadComFolder" +class WuploadCom(DeadCrypter): + __name__ = "WuploadCom" __type__ = "crypter" __version__ = "0.01" @@ -15,4 +15,4 @@ class WuploadComFolder(DeadCrypter): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] -getInfo = create_getInfo(WuploadComFolder) +getInfo = create_getInfo(WuploadCom) diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingPro.py index 1d001772d..a965f0c48 100644 --- a/module/plugins/crypter/XFileSharingProFolder.py +++ b/module/plugins/crypter/XFileSharingPro.py @@ -5,8 +5,8 @@ import re from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo -class XFileSharingProFolder(XFSCrypter): - __name__ = "XFileSharingProFolder" +class XFileSharingPro(XFSCrypter): + __name__ = "XFileSharingPro" __type__ = "crypter" __version__ = "0.04" @@ -26,7 +26,7 @@ class XFileSharingProFolder(XFSCrypter): def init(self): - super(XFileSharingProFolder, self).init() + super(XFileSharingPro, self).init() self.__pattern__ = self.core.pluginManager.crypterPlugins[self.__name__]['pattern'] diff --git a/module/plugins/crypter/XupPl.py b/module/plugins/crypter/XupPl.py index f2ecbee5a..9d4d27b61 100644 --- a/module/plugins/crypter/XupPl.py +++ b/module/plugins/crypter/XupPl.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.Crypter import Crypter +from pyload.plugin.Crypter import Crypter class XupPl(Crypter): diff --git a/module/plugins/crypter/YoutubeBatch.py b/module/plugins/crypter/YoutubeBatch.py index 40b4eedd2..5e4269fd2 100644 --- a/module/plugins/crypter/YoutubeBatch.py +++ b/module/plugins/crypter/YoutubeBatch.py @@ -4,9 +4,9 @@ import re from urlparse import urljoin -from module.common.json_layer import json_loads -from module.plugins.Crypter import Crypter -from module.utils import save_join +from pyload.utils import json_loads +from pyload.plugin.Crypter import Crypter +from pyload.utils import safe_join class YoutubeBatch(Crypter): @@ -16,10 +16,10 @@ class YoutubeBatch(Crypter): __pattern__ = r'https?://(?:www\.|m\.)?youtube\.com/(?P<TYPE>user|playlist|view_play_list)(/|.*?[?&](?:list|p)=)(?P<ID>[\w-]+)' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True), - ("likes", "bool", "Grab user (channel) liked videos", False), - ("favorites", "bool", "Grab user (channel) favorite videos", False), - ("uploads", "bool", "Grab channel unplaylisted videos", True)] + ("subfolder_per_package", "bool", "Create a subfolder for each package", True), + ("likes", "bool", "Grab user (channel) liked videos", False), + ("favorites", "bool", "Grab user (channel) favorite videos", False), + ("uploads", "bool", "Grab channel unplaylisted videos", True)] __description__ = """Youtube.com channel & playlist decrypter plugin""" __license__ = "GPLv3" @@ -132,7 +132,7 @@ class YoutubeBatch(Crypter): for p in playlists: p_name = p['title'] p_videos = self.getVideosId(p['id']) - p_folder = save_join(self.config['general']['download_folder'], p['channelTitle'], p_name) + p_folder = safe_join(self.config['general']['download_folder'], p['channelTitle'], p_name) self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) if not p_videos: diff --git a/module/plugins/crypter/__init__.py b/module/plugins/crypter/__init__.py index e69de29bb..40a96afc6 100644 --- a/module/plugins/crypter/__init__.py +++ b/module/plugins/crypter/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index cf8754dae..bd19fe953 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -4,7 +4,7 @@ from pycurl import FORM_FILE, LOW_SPEED_TIME from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook, threaded +from module.plugins.Addon import Addon, threaded class BypassCaptchaException(Exception): @@ -25,13 +25,13 @@ class BypassCaptchaException(Exception): return "<BypassCaptchaException %s>" % self.err -class BypassCaptcha(Hook): +class BypassCaptcha(Addon): __name__ = "BypassCaptcha" __type__ = "hook" __version__ = "0.06" __config__ = [("force", "bool", "Force BC even if client is connected", False), - ("passkey", "password", "Passkey", "")] + ("passkey", "password", "Passkey", "")] __description__ = """Send captchas to BypassCaptcha.com""" __license__ = "GPLv3" @@ -47,15 +47,6 @@ class BypassCaptcha(Hook): GETCREDITS_URL = "http://bypasscaptcha.com/ex_left.php" - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - def getCredits(self): res = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) @@ -98,7 +89,7 @@ class BypassCaptcha(Hook): self.logError(_("Could not send response"), e) - def newCaptchaTask(self, task): + def captchaTask(self, task): if "service" in task.data: return False diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index 544965b0f..04caff345 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -7,28 +7,28 @@ import re from base64 import b64encode from time import sleep -from module.network.HTTPRequest import BadHeader -from module.network.RequestFactory import getURL +from pyload.network.HTTPRequest import BadHeader +from pyload.network.RequestFactory import getURL from module.plugins.Hook import Hook, threaded -class Captcha9Kw(Hook): +class Captcha9kw(Hook): __name__ = "Captcha9Kw" __type__ = "hook" __version__ = "0.28" __config__ = [("ssl" , "bool" , "Use HTTPS" , True ), - ("force" , "bool" , "Force captcha resolving even if client is connected" , True ), - ("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False ), - ("captchaperhour", "int" , "Captcha per hour" , "9999" ), - ("captchapermin" , "int" , "Captcha per minute" , "9999" ), - ("prio" , "int" , "Priority (max 10)(cost +0 -> +10 credits)" , "0" ), - ("queue" , "int" , "Max. Queue (max 999)" , "50" ), - ("hoster_options", "string" , "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"), - ("selfsolve" , "bool" , "Selfsolve (manually solve your captcha in your 9kw client if active)" , "0" ), - ("passkey" , "password", "API key" , "" ), - ("timeout" , "int" , "Timeout in seconds (min 60, max 3999)" , "900" )] + ("force" , "bool" , "Force captcha resolving even if client is connected" , True ), + ("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False ), + ("captchaperhour", "int" , "Captcha per hour" , "9999" ), + ("captchapermin" , "int" , "Captcha per minute" , "9999" ), + ("prio" , "int" , "Priority (max 10)(cost +0 -> +10 credits)" , "0" ), + ("queue" , "int" , "Max. Queue (max 999)" , "50" ), + ("hoster_options", "string" , "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"), + ("selfsolve" , "bool" , "Selfsolve (manually solve your captcha in your 9kw client if active)" , "0" ), + ("passkey" , "password", "API key" , "" ), + ("timeout" , "int" , "Timeout in seconds (min 60, max 3999)" , "900" )] __description__ = """Send captchas to 9kw.eu""" __license__ = "GPLv3" @@ -39,13 +39,7 @@ class Captcha9Kw(Hook): API_URL = "http://www.9kw.eu/index.cgi" - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 + def activate(self): if self.getConfig("ssl"): self.API_URL = self.API_URL.replace("http://", "https://") @@ -168,7 +162,7 @@ class Captcha9Kw(Hook): task.setResult(result) - def newCaptchaTask(self, task): + def captchaTask(self, task): if not task.isTextual() and not task.isPositional(): return diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 3c08f5e36..ba9d3eb8e 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -13,7 +13,7 @@ except ImportError: from time import sleep from urllib import urlencode -from module.network.RequestFactory import getURL, getRequest +from pyload.network.RequestFactory import getURL, getRequest from module.plugins.Hook import Hook, threaded @@ -35,14 +35,14 @@ class CaptchaBrotherhoodException(Exception): return "<CaptchaBrotherhoodException %s>" % self.err -class CaptchaBrotherhood(Hook): +class CaptchaBrotherhood(Addon): __name__ = "CaptchaBrotherhood" __type__ = "hook" __version__ = "0.08" __config__ = [("username", "str", "Username", ""), - ("force", "bool", "Force CT even if client is connected", False), - ("passkey", "password", "Password", "")] + ("force", "bool", "Force CT even if client is connected", False), + ("passkey", "password", "Password", "")] __description__ = """Send captchas to CaptchaBrotherhood.com""" __license__ = "GPLv3" @@ -53,15 +53,6 @@ class CaptchaBrotherhood(Hook): API_URL = "http://www.captchabrotherhood.com/" - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - def getCredits(self): res = getURL(self.API_URL + "askCredits.aspx", get={"username": self.getConfig("username"), "password": self.getConfig("passkey")}) @@ -136,7 +127,7 @@ class CaptchaBrotherhood(Hook): return res - def newCaptchaTask(self, task): + def captchaTask(self, task): if "service" in task.data: return False diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index d513c446d..8786df12f 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -8,9 +8,9 @@ from base64 import b64encode from pycurl import FORM_FILE, HTTPHEADER from time import sleep -from module.common.json_layer import json_loads -from module.network.HTTPRequest import BadHeader -from module.network.RequestFactory import getRequest +from pyload.utils import json_loads +from pyload.network.HTTPRequest import BadHeader +from pyload.network.RequestFactory import getRequest from module.plugins.Hook import Hook, threaded @@ -48,14 +48,14 @@ class DeathByCaptchaException(Exception): return "<DeathByCaptchaException %s>" % self.err -class DeathByCaptcha(Hook): +class DeathByCaptcha(Addon): __name__ = "DeathByCaptcha" __type__ = "hook" __version__ = "0.06" __config__ = [("username", "str", "Username", ""), - ("passkey", "password", "Password", ""), - ("force", "bool", "Force DBC even if client is connected", False)] + ("passkey", "password", "Password", ""), + ("force", "bool", "Force DBC even if client is connected", False)] __description__ = """Send captchas to DeathByCaptcha.com""" __license__ = "GPLv3" @@ -66,15 +66,6 @@ class DeathByCaptcha(Hook): API_URL = "http://api.dbcapi.me/api/" - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - def api_response(self, api="captcha", post=False, multipart=False): req = getRequest() req.c.setopt(HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version]) @@ -165,7 +156,7 @@ class DeathByCaptcha(Hook): return ticket, result - def newCaptchaTask(self, task): + def captchaTask(self, task): if "service" in task.data: return False diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index c9f8204c4..04f6d0795 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -11,13 +11,13 @@ from module.network.RequestFactory import getURL, getRequest from module.plugins.Hook import Hook, threaded -class ExpertDecoders(Hook): +class ExpertDecoders(Addon): __name__ = "ExpertDecoders" __type__ = "hook" __version__ = "0.04" __config__ = [("force", "bool", "Force CT even if client is connected", False), - ("passkey", "password", "Access key", "")] + ("passkey", "password", "Access key", "")] __description__ = """Send captchas to expertdecoders.com""" __license__ = "GPLv3" @@ -28,15 +28,6 @@ class ExpertDecoders(Hook): API_URL = "http://www.fasttypers.org/imagepost.ashx" - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - def getCredits(self): res = getURL(self.API_URL, post={"key": self.getConfig("passkey"), "action": "balance"}) @@ -74,7 +65,7 @@ class ExpertDecoders(Hook): task.setResult(result) - def newCaptchaTask(self, task): + def captchaTask(self, task): if not task.isTextual(): return False diff --git a/module/plugins/hooks/FastixRu.py b/module/plugins/hooks/FastixRu.py index 6373da8d9..5f339c4c0 100644 --- a/module/plugins/hooks/FastixRu.py +++ b/module/plugins/hooks/FastixRu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads +from pyload.utils import json_loads from module.plugins.internal.MultiHook import MultiHook diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index d62fed385..8bf326f4d 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -29,14 +29,14 @@ class ImageTyperzException(Exception): return "<ImageTyperzException %s>" % self.err -class ImageTyperz(Hook): +class ImageTyperz(Addon): __name__ = "ImageTyperz" __type__ = "hook" __version__ = "0.06" __config__ = [("username", "str", "Username", ""), - ("passkey", "password", "Password", ""), - ("force", "bool", "Force IT even if client is connected", False)] + ("passkey", "password", "Password", ""), + ("force", "bool", "Force IT even if client is connected", False)] __description__ = """Send captchas to ImageTyperz.com""" __license__ = "GPLv3" @@ -49,15 +49,6 @@ class ImageTyperz(Hook): GETCREDITS_URL = "http://captchatypers.com/Forms/RequestBalance.ashx" - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - def getCredits(self): res = getURL(self.GETCREDITS_URL, post={'action': "REQUESTBALANCE", @@ -112,7 +103,7 @@ class ImageTyperz(Hook): return ticket, result - def newCaptchaTask(self, task): + def captchaTask(self, task): if "service" in task.data: return False diff --git a/module/plugins/hooks/LinksnappyCom.py b/module/plugins/hooks/LinksnappyCom.py index 5eb0c7f6d..7e607a3d3 100644 --- a/module/plugins/hooks/LinksnappyCom.py +++ b/module/plugins/hooks/LinksnappyCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads +from pyload.utils import json_loads from module.plugins.internal.MultiHook import MultiHook diff --git a/module/plugins/hooks/MegaDebridEu.py b/module/plugins/hooks/MegaDebridEu.py index f67fa7ac0..0711b3546 100644 --- a/module/plugins/hooks/MegaDebridEu.py +++ b/module/plugins/hooks/MegaDebridEu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads +from pyload.utils import json_loads from module.plugins.internal.MultiHook import MultiHook diff --git a/module/plugins/hooks/MyfastfileCom.py b/module/plugins/hooks/MyfastfileCom.py index 86408cb6d..a1b5aaba0 100644 --- a/module/plugins/hooks/MyfastfileCom.py +++ b/module/plugins/hooks/MyfastfileCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads from module.plugins.internal.MultiHook import MultiHook +from pyload.utils import json_loads class MyfastfileCom(MultiHook): diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index 293fcf339..18b6187c4 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads +from pyload.utils import json_loads from module.plugins.internal.MultiHook import MultiHook diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index 0768bd6cd..2277b10ab 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads +from pyload.utils import json_loads from module.plugins.internal.MultiHook import MultiHook diff --git a/module/plugins/hooks/SimplyPremiumCom.py b/module/plugins/hooks/SimplyPremiumCom.py index 843a3aa82..e51cbd1bc 100644 --- a/module/plugins/hooks/SimplyPremiumCom.py +++ b/module/plugins/hooks/SimplyPremiumCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads +from pyload.utils import json_loads from module.plugins.internal.MultiHook import MultiHook diff --git a/module/plugins/hooks/UnrestrictLi.py b/module/plugins/hooks/UnrestrictLi.py index cb5abb26e..b4c547883 100644 --- a/module/plugins/hooks/UnrestrictLi.py +++ b/module/plugins/hooks/UnrestrictLi.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads +from pyload.utils import json_loads from module.plugins.internal.MultiHook import MultiHook diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index a1ee7f5ef..78e14c179 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -2,10 +2,10 @@ import re -from module.plugins.Hook import Hook +from pyload.plugin.Addon import Addon -class XFileSharingPro(Hook): +class XFileSharingPro(Addon): __name__ = "XFileSharingPro" __type__ = "hook" __version__ = "0.31" @@ -45,20 +45,14 @@ class XFileSharingPro(Hook): # self.loadPattern() - #@TODO: Remove in 0.4.10 - def initPeriodical(self): - pass - - - def coreReady(self): + def activate(self): self.loadPattern() def loadPattern(self): use_builtin_list = self.getConfig('use_builtin_list') - for type, plugin in (("hoster", "XFileSharingPro"), - ("crypter", "XFileSharingProFolder")): + for type in ("hoster", "crypter"): every_plugin = not self.getConfig("use_%s_list" % type) if every_plugin: @@ -75,7 +69,7 @@ class XFileSharingPro(Hook): if not plugin_set: self.logInfo(_("No %s to handle") % type) - self._unload(type, plugin) + self._unload(type) return match_list = '|'.join(sorted(plugin_set)) @@ -88,39 +82,23 @@ class XFileSharingPro(Hook): pattern = self.regexp[type][1] % match_list.replace('.', '\.') - dict = self.core.pluginManager.plugins[type][plugin] + dict = self.core.pluginManager.plugins[type]["XFileSharingPro"] dict['pattern'] = pattern dict['re'] = re.compile(pattern) self.logDebug("Loaded %s pattern: %s" % (type, pattern)) - def _unload(self, type, plugin): - dict = self.core.pluginManager.plugins[type][plugin] + def _unload(self, type): + dict = self.core.pluginManager.plugins[type]["XFileSharingPro"] dict['pattern'] = r'^unmatchable$' dict['re'] = re.compile(dict['pattern']) - def unload(self): + def deactivate(self): # self.unloadHoster("BasePlugin") - for type, plugin in (("hoster", "XFileSharingPro"), - ("crypter", "XFileSharingProFolder")): - self._unload(type, plugin) - - - def unloadHoster(self, hoster): - hdict = self.core.pluginManager.hosterPlugins[hoster] - if "new_name" in hdict and hdict['new_name'] == "XFileSharingPro": - if "module" in hdict: - hdict.pop('module', None) - - if "new_module" in hdict: - hdict.pop('new_module', None) - hdict.pop('new_name', None) - - return True - else: - return False + for type in ("hoster", "crypter"): + self._unload(type, "XFileSharingPro") # def downloadFailed(self, pyfile): diff --git a/module/plugins/hooks/__init__.py b/module/plugins/hooks/__init__.py index e69de29bb..40a96afc6 100644 --- a/module/plugins/hooks/__init__.py +++ b/module/plugins/hooks/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index aece7813d..86ef46cc3 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class BezvadataCz(SimpleHoster): diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py index 7d7e2624a..fb79fe29a 100644 --- a/module/plugins/hoster/BillionuploadsCom.py +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class BillionuploadsCom(XFSHoster): diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 657e70e56..feb2b682c 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -4,8 +4,8 @@ from __future__ import with_statement import re -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): @@ -17,7 +17,7 @@ class BitshareCom(SimpleHoster): __description__ = """Bitshare.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("Paul King", None), + __authors__ = [("Paul King", ""), ("fragonib", "fragonib[AT]yahoo[DOT]es")] diff --git a/module/plugins/hoster/BoltsharingCom.py b/module/plugins/hoster/BoltsharingCom.py index 924545a29..93f6d619a 100644 --- a/module/plugins/hoster/BoltsharingCom.py +++ b/module/plugins/hoster/BoltsharingCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class BoltsharingCom(DeadHoster): diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 125e63481..d61856b7c 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -2,8 +2,8 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.plugins.internal.CaptchaService import ReCaptcha +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class CatShareNet(SimpleHoster): @@ -16,7 +16,7 @@ class CatShareNet(SimpleHoster): __description__ = """CatShare.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("z00nx", "z00nx0@gmail.com"), - ("prOq", None), + ("prOq", ""), ("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hoster/CloudzerNet.py b/module/plugins/hoster/CloudzerNet.py index c5440391f..cb764e335 100644 --- a/module/plugins/hoster/CloudzerNet.py +++ b/module/plugins/hoster/CloudzerNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class CloudzerNet(DeadHoster): diff --git a/module/plugins/hoster/CramitIn.py b/module/plugins/hoster/CramitIn.py index 44dac958d..8e239cdc5 100644 --- a/module/plugins/hoster/CramitIn.py +++ b/module/plugins/hoster/CramitIn.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class CramitIn(XFSHoster): diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 474042a5a..a2abc2b7b 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -2,8 +2,8 @@ import re -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): diff --git a/module/plugins/hoster/CyberlockerCh.py b/module/plugins/hoster/CyberlockerCh.py index b26909096..1c6a04caf 100644 --- a/module/plugins/hoster/CyberlockerCh.py +++ b/module/plugins/hoster/CyberlockerCh.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class CyberlockerCh(DeadHoster): diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 49c7a6648..419e43a7a 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -5,8 +5,8 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.utils import parseFileSize +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.utils import parseFileSize class CzshareCom(SimpleHoster): diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index 02df9dde7..c212fa872 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -2,10 +2,10 @@ import re -from module.PyFile import statusMap -from module.common.json_layer import json_loads -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster +from pyload.datatype.File import statusMap +from pyload.utils import json_loads +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster def getInfo(urls): diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index f4b0692a8..f24b5cdba 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -5,7 +5,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DataHu(SimpleHoster): @@ -17,7 +17,7 @@ class DataHu(SimpleHoster): __description__ = """Data.hu hoster plugin""" __license__ = "GPLv3" - __authors__ = [("crash", None), + __authors__ = [("crash", ""), ("stickell", "l.stickell@yahoo.it")] diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 266199616..592bece93 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index e5061e026..66102939a 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -2,8 +2,8 @@ import re -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): diff --git a/module/plugins/hoster/DdlstorageCom.py b/module/plugins/hoster/DdlstorageCom.py index a45ef27e9..32a5a8bb7 100644 --- a/module/plugins/hoster/DdlstorageCom.py +++ b/module/plugins/hoster/DdlstorageCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class DdlstorageCom(DeadHoster): diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 6de05af9a..c9e2040f8 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -4,8 +4,8 @@ import re from urllib import unquote -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index d786ba135..2365baa5f 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -5,7 +5,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class DevhostSt(SimpleHoster): diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 5d4e9e7b8..541989120 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -3,10 +3,11 @@ import pycurl import re -from module.network.Browser import Browser -from module.network.CookieJar import CookieJar -from module.plugins.internal.CaptchaService import AdYouLike -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns +from pyload.network.Browser import Browser +from pyload.network.CookieJar import CookieJar +from pyload.plugin.internal.captcha import AdYouLike +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns +from pyload.utils import json_loads class CustomBrowser(Browser): diff --git a/module/plugins/hoster/DuploadOrg.py b/module/plugins/hoster/DuploadOrg.py index 73702eb67..6dd25407e 100644 --- a/module/plugins/hoster/DuploadOrg.py +++ b/module/plugins/hoster/DuploadOrg.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class DuploadOrg(DeadHoster): diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py index 693910c1b..6ca45f545 100644 --- a/module/plugins/hoster/EasybytezCom.py +++ b/module/plugins/hoster/EasybytezCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class EasybytezCom(XFSHoster): diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index f8ccc972e..76e55ae3c 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class EdiskCz(SimpleHoster): diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py index 9a2f50ed4..ad5ad0796 100644 --- a/module/plugins/hoster/EgoFilesCom.py +++ b/module/plugins/hoster/EgoFilesCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class EgoFilesCom(DeadHoster): diff --git a/module/plugins/hoster/EnteruploadCom.py b/module/plugins/hoster/EnteruploadCom.py index bbd613f57..0be9b8d76 100644 --- a/module/plugins/hoster/EnteruploadCom.py +++ b/module/plugins/hoster/EnteruploadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class EnteruploadCom(DeadHoster): diff --git a/module/plugins/hoster/EpicShareNet.py b/module/plugins/hoster/EpicShareNet.py index 8ac8cdaf2..061782468 100644 --- a/module/plugins/hoster/EpicShareNet.py +++ b/module/plugins/hoster/EpicShareNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class EpicShareNet(DeadHoster): diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index b4c9ace6a..41cc37087 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 68695faad..f9f76b28b 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -2,7 +2,7 @@ import re -from module.common.json_layer import json_loads +from pyload.utils import json_loads from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index d534101d8..8f1b9e694 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -5,7 +5,7 @@ import re from random import randrange from urllib import unquote -from module.common.json_layer import json_loads +from pyload.utils import json_loads from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo diff --git a/module/plugins/hoster/FileApeCom.py b/module/plugins/hoster/FileApeCom.py index db843586b..212e3ba9c 100644 --- a/module/plugins/hoster/FileApeCom.py +++ b/module/plugins/hoster/FileApeCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class FileApeCom(DeadHoster): @@ -12,7 +12,7 @@ class FileApeCom(DeadHoster): __description__ = """FileApe.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("espes", None)] + __authors__ = [("espes", "")] getInfo = create_getInfo(FileApeCom) diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index e4ce711bd..29c95ee8f 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -4,7 +4,7 @@ import re from urlparse import urljoin -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): @@ -16,7 +16,7 @@ class FileSharkPl(SimpleHoster): __description__ = """FileShark.pl hoster plugin""" __license__ = "GPLv3" - __authors__ = [("prOq", None), + __authors__ = [("prOq", ""), ("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hoster/FileStoreTo.py b/module/plugins/hoster/FileStoreTo.py index ad3feba1b..8a5171219 100644 --- a/module/plugins/hoster/FileStoreTo.py +++ b/module/plugins/hoster/FileStoreTo.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FileStoreTo(SimpleHoster): diff --git a/module/plugins/hoster/FilebeerInfo.py b/module/plugins/hoster/FilebeerInfo.py index 885010a2c..51a0137a0 100644 --- a/module/plugins/hoster/FilebeerInfo.py +++ b/module/plugins/hoster/FilebeerInfo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class FilebeerInfo(DeadHoster): diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index bb91da7d5..6fb153658 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -2,9 +2,9 @@ import re -from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.utils import json_loads +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index 4980ebe39..95d61cd6a 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -4,8 +4,8 @@ import re from urlparse import urljoin -from module.network.RequestFactory import getURL -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo +from pyload.network.RequestFactory import getURL +from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py index 8a8aee9e2..cd890778b 100644 --- a/module/plugins/hoster/FilejungleCom.py +++ b/module/plugins/hoster/FilejungleCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.hoster.FileserveCom import FileserveCom, checkFile -from module.plugins.Plugin import chunks +from pyload.plugin.hoster.FileserveCom import FileserveCom, checkFile +from pyload.plugin.Plugin import chunks class FilejungleCom(FileserveCom): diff --git a/module/plugins/hoster/FileomCom.py b/module/plugins/hoster/FileomCom.py index 306953b84..23f059546 100644 --- a/module/plugins/hoster/FileomCom.py +++ b/module/plugins/hoster/FileomCom.py @@ -3,7 +3,7 @@ # Test links: # http://fileom.com/gycaytyzdw3g/random.bin.html -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class FileomCom(XFSHoster): diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 21ebbc55e..89f7fe9a4 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -4,9 +4,9 @@ import re from time import time -from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.utils import json_loads +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py index a53773f81..6ac9994cc 100644 --- a/module/plugins/hoster/FilepupNet.py +++ b/module/plugins/hoster/FilepupNet.py @@ -6,7 +6,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepupNet(SimpleHoster): diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index c5007e945..85ff7da33 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -9,8 +9,8 @@ import re from urlparse import urljoin -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FilerNet(SimpleHoster): diff --git a/module/plugins/hoster/FilerioCom.py b/module/plugins/hoster/FilerioCom.py index c6ebbd444..12b7e7705 100644 --- a/module/plugins/hoster/FilerioCom.py +++ b/module/plugins/hoster/FilerioCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class FilerioCom(XFSHoster): diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 7bd099282..09da46b01 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -2,9 +2,9 @@ import re -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.plugins.Plugin import chunks +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster +from pyload.plugin.Plugin import chunks def getInfo(urls): diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 6f316cea3..cc977ac25 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -41,7 +41,7 @@ class FileserveCom(Hoster): __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de"), ("mkaay", "mkaay@mkaay.de"), - ("Paul King", None), + ("Paul King", ""), ("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/hoster/FileshareInUa.py b/module/plugins/hoster/FileshareInUa.py index 08e10dccb..5f5089e54 100644 --- a/module/plugins/hoster/FileshareInUa.py +++ b/module/plugins/hoster/FileshareInUa.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class FileshareInUa(DeadHoster): diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py index 8bfa0fa2e..c2b87d4d7 100644 --- a/module/plugins/hoster/FilesonicCom.py +++ b/module/plugins/hoster/FilesonicCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class FilesonicCom(DeadHoster): @@ -13,7 +13,7 @@ class FilesonicCom(DeadHoster): __description__ = """Filesonic.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de"), - ("paulking", None)] + ("paulking", "")] getInfo = create_getInfo(FilesonicCom) diff --git a/module/plugins/hoster/FilezyNet.py b/module/plugins/hoster/FilezyNet.py index 4197a2858..1fcc9363d 100644 --- a/module/plugins/hoster/FilezyNet.py +++ b/module/plugins/hoster/FilezyNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class FilezyNet(DeadHoster): diff --git a/module/plugins/hoster/FiredriveCom.py b/module/plugins/hoster/FiredriveCom.py index 0e3a4e847..3395fc261 100644 --- a/module/plugins/hoster/FiredriveCom.py +++ b/module/plugins/hoster/FiredriveCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class FiredriveCom(DeadHoster): diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index 49705958d..5aff3e811 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -4,8 +4,8 @@ import re from urllib import unquote -from module.network.RequestFactory import getURL -from module.plugins.internal.SimpleHoster import SimpleHoster +from pyload.network.RequestFactory import getURL +from pyload.plugin.internal.SimpleHoster import SimpleHoster class FlyFilesNet(SimpleHoster): diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index a3f53ac5e..8d13ea0b7 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class FourSharedCom(SimpleHoster): diff --git a/module/plugins/hoster/FreevideoCz.py b/module/plugins/hoster/FreevideoCz.py index e56d1a299..86c30e64c 100644 --- a/module/plugins/hoster/FreevideoCz.py +++ b/module/plugins/hoster/FreevideoCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class FreevideoCz(DeadHoster): diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index 9a2b0c323..186cb2f87 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -5,8 +5,8 @@ import re from time import strptime, mktime, gmtime from urlparse import urljoin -from module.network.RequestFactory import getURL -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo +from pyload.network.RequestFactory import getURL +from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo def getInfo(urls): diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 22fc5f67a..6924c5910 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -6,7 +6,7 @@ import re from urllib import quote, unquote from urlparse import urlparse -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster class Ftp(Hoster): diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index c68866f87..89e188010 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -2,9 +2,9 @@ import re -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.utils import parseFileSize +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster +from pyload.utils import parseFileSize class GamefrontCom(Hoster): diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 9d3ace3b2..d12084d42 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -2,10 +2,9 @@ import re -from pycurl import FOLLOWLOCATION from random import randint -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class GigapetaCom(SimpleHoster): @@ -31,27 +30,25 @@ class GigapetaCom(SimpleHoster): captcha_key = str(randint(1, 100000000)) captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key - self.req.http.c.setopt(FOLLOWLOCATION, 0) - for _i in xrange(5): self.checkErrors() captcha = self.decryptCaptcha(captcha_url) - self.html = self.load(pyfile.url, post={ - "captcha_key": captcha_key, - "captcha": captcha, - "download": "Download"}) + self.html = self.load(pyfile.url, + post={'captcha_key': captcha_key, + 'captcha' : captcha, + 'download' : "Download"}, + follow_location=False) m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m: - download_url = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + download_url = m.group(1) break elif "Entered figures don`t coincide with the picture" in self.html: self.invalidCaptcha() else: self.fail(_("No valid captcha code entered")) - self.req.http.c.setopt(FOLLOWLOCATION, 1) self.download(download_url) diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index 2cb012e50..331d63a99 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -5,7 +5,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class GooIm(SimpleHoster): diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 05caf052d..8a00e01b0 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -2,7 +2,7 @@ from urlparse import urljoin -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class HellshareCz(SimpleHoster): diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index 2b9b76b8a..0d33b35b9 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class HellspyCz(DeadHoster): diff --git a/module/plugins/hoster/HotfileCom.py b/module/plugins/hoster/HotfileCom.py index f7724faf2..b64bb5fd7 100644 --- a/module/plugins/hoster/HotfileCom.py +++ b/module/plugins/hoster/HotfileCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class HotfileCom(DeadHoster): diff --git a/module/plugins/hoster/HugefilesNet.py b/module/plugins/hoster/HugefilesNet.py index b7e599a50..f5085c8c3 100644 --- a/module/plugins/hoster/HugefilesNet.py +++ b/module/plugins/hoster/HugefilesNet.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class HugefilesNet(XFSHoster): diff --git a/module/plugins/hoster/HundredEightyUploadCom.py b/module/plugins/hoster/HundredEightyUploadCom.py index 32d36ddb9..2edb6310d 100644 --- a/module/plugins/hoster/HundredEightyUploadCom.py +++ b/module/plugins/hoster/HundredEightyUploadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class HundredEightyUploadCom(XFSHoster): diff --git a/module/plugins/hoster/IFileWs.py b/module/plugins/hoster/IFileWs.py index b4f225c4b..59d9c7f40 100644 --- a/module/plugins/hoster/IFileWs.py +++ b/module/plugins/hoster/IFileWs.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class IFileWs(DeadHoster): diff --git a/module/plugins/hoster/IcyFilesCom.py b/module/plugins/hoster/IcyFilesCom.py index 921b64207..201626fa5 100644 --- a/module/plugins/hoster/IcyFilesCom.py +++ b/module/plugins/hoster/IcyFilesCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class IcyFilesCom(DeadHoster): diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 249c2feb1..33da64ba2 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class IfolderRu(SimpleHoster): diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index 7adc1a029..2331179bc 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class JumbofilesCom(SimpleHoster): diff --git a/module/plugins/hoster/JunocloudMe.py b/module/plugins/hoster/JunocloudMe.py index 415d5e2d0..ad37b01e4 100644 --- a/module/plugins/hoster/JunocloudMe.py +++ b/module/plugins/hoster/JunocloudMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class JunocloudMe(XFSHoster): diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py index 6b7b422c5..3ed11aa13 100644 --- a/module/plugins/hoster/Keep2ShareCc.py +++ b/module/plugins/hoster/Keep2ShareCc.py @@ -85,8 +85,6 @@ class Keep2ShareCc(SimpleHoster): self.error(_("Free download link not found")) self.link = m.group(1) - - def handleCaptcha(self): recaptcha = ReCaptcha(self) post_data = {'free' : 1, diff --git a/module/plugins/hoster/KickloadCom.py b/module/plugins/hoster/KickloadCom.py index 1c39db46c..1f0c41f3d 100644 --- a/module/plugins/hoster/KickloadCom.py +++ b/module/plugins/hoster/KickloadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class KickloadCom(DeadHoster): diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index 2d1c3b096..73fa494b0 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -2,8 +2,8 @@ import re -from module.plugins.internal.CaptchaService import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.captcha import SolveMedia +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class KingfilesNet(SimpleHoster): diff --git a/module/plugins/hoster/LemUploadsCom.py b/module/plugins/hoster/LemUploadsCom.py index 22fbd60dd..822670348 100644 --- a/module/plugins/hoster/LemUploadsCom.py +++ b/module/plugins/hoster/LemUploadsCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class LemUploadsCom(DeadHoster): diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index be330e246..0f344a88b 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -6,8 +6,8 @@ import re -from module.plugins.internal.CaptchaService import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.captcha import SolveMedia +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class LoadTo(SimpleHoster): @@ -17,7 +17,7 @@ class LoadTo(SimpleHoster): __pattern__ = r'http://(?:www\.)?load\.to/\w+' - __description__ = """ Load.to hoster plugin """ + __description__ = """Load.to hoster plugin""" __license__ = "GPLv3" __authors__ = [("halfman", "Pulpan3@gmail.com"), ("stickell", "l.stickell@yahoo.it")] diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 74bf877f1..33f8ab393 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -4,8 +4,8 @@ import re from bottle import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index bc81c8202..5adf004d0 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -2,9 +2,9 @@ import re -from module.plugins.internal.CaptchaService import SolveMedia -from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo -from module.network.RequestFactory import getURL +from pyload.plugin.internal.captcha import SolveMedia +from pyload.plugin.internal.SimpleHoster import SimpleHoster, parseFileInfo +from pyload.network.RequestFactory import getURL def replace_eval(js_expr): diff --git a/module/plugins/hoster/MegaFilesSe.py b/module/plugins/hoster/MegaFilesSe.py index c3de57914..4120e17d6 100644 --- a/module/plugins/hoster/MegaFilesSe.py +++ b/module/plugins/hoster/MegaFilesSe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class MegaFilesSe(DeadHoster): diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 10a2eb025..f8fcb97fe 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -2,9 +2,9 @@ import re -from module.common.json_layer import json_loads, json_dumps +from pyload.utils import json_loads, json_dumps -from module.plugins.hoster.MegaCoNz import MegaCoNz +from pyload.plugin.hoster.MegaCoNz import MegaCoNz class MegacrypterCom(MegaCoNz): diff --git a/module/plugins/hoster/MegareleaseOrg.py b/module/plugins/hoster/MegareleaseOrg.py index 60796c1ee..6eacbd6e0 100644 --- a/module/plugins/hoster/MegareleaseOrg.py +++ b/module/plugins/hoster/MegareleaseOrg.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class MegareleaseOrg(DeadHoster): diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index bdb428143..84777adeb 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -4,7 +4,7 @@ import re from time import time -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 7f51a8a46..7896dabfb 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class MegauploadCom(DeadHoster): diff --git a/module/plugins/hoster/MegavideoCom.py b/module/plugins/hoster/MegavideoCom.py index 24905ce62..02054fecb 100644 --- a/module/plugins/hoster/MegavideoCom.py +++ b/module/plugins/hoster/MegavideoCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class MegavideoCom(DeadHoster): diff --git a/module/plugins/hoster/MovReelCom.py b/module/plugins/hoster/MovReelCom.py index 9b8679c10..3e18a8960 100644 --- a/module/plugins/hoster/MovReelCom.py +++ b/module/plugins/hoster/MovReelCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class MovReelCom(XFSHoster): diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 7a6e73252..ca626a833 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -4,7 +4,7 @@ import re from random import random -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index dd6294ff1..3862bfe32 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -18,6 +18,7 @@ class MyfastfileCom(MultiHoster): __authors__ = [("stickell", "l.stickell@yahoo.it")] + def setup(self): self.chunkLimit = -1 diff --git a/module/plugins/hoster/MyvideoDe.py b/module/plugins/hoster/MyvideoDe.py index 8af4a9a61..4b5fa99ca 100644 --- a/module/plugins/hoster/MyvideoDe.py +++ b/module/plugins/hoster/MyvideoDe.py @@ -2,8 +2,8 @@ import re -from module.plugins.Hoster import Hoster -from module.unescape import unescape +from pyload.plugin.Hoster import Hoster +from pyload.utils import html_unescape class MyvideoDe(Hoster): @@ -37,8 +37,8 @@ class MyvideoDe(Hoster): def get_file_name(self): - file_name_pattern = r'<h1 class=\'globalHd\'>(.*)</h1>' - return unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') + file_name_pattern = r"<h1 class='globalHd'>(.*)</h1>" + return html_unescape(re.search(file_name_pattern, self.html).group(1).replace("/", "") + '.flv') def file_exists(self): diff --git a/module/plugins/hoster/NahrajCz.py b/module/plugins/hoster/NahrajCz.py index 6b5699408..5c5c71ae6 100644 --- a/module/plugins/hoster/NahrajCz.py +++ b/module/plugins/hoster/NahrajCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class NahrajCz(DeadHoster): diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 8b56c0908..1738d9724 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -4,7 +4,7 @@ import re from random import random -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class NarodRu(SimpleHoster): diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 3efbdce23..2ed298ffa 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -5,14 +5,14 @@ import re from urlparse import urljoin from time import time -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster -from module.plugins.Plugin import chunks -from module.plugins.internal.CaptchaService import ReCaptcha +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster +from pyload.plugin.Plugin import chunks +from pyload.plugin.captcha import ReCaptcha def getInfo(urls): - ## returns list of tupels (name, size (in bytes), status (see FileDatabase), url) + ## returns list of tupels (name, size (in bytes), status (see database.File), url) apiurl = "http://api.netload.in/info.php" id_regex = re.compile(NetloadIn.__pattern__) diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py index aeedd54f6..842481a60 100644 --- a/module/plugins/hoster/NosuploadCom.py +++ b/module/plugins/hoster/NosuploadCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class NosuploadCom(XFSHoster): diff --git a/module/plugins/hoster/NovafileCom.py b/module/plugins/hoster/NovafileCom.py index bdd66473b..f73570ec2 100644 --- a/module/plugins/hoster/NovafileCom.py +++ b/module/plugins/hoster/NovafileCom.py @@ -4,7 +4,7 @@ # http://novafile.com/vfun4z6o2cit # http://novafile.com/s6zrr5wemuz4 -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class NovafileCom(XFSHoster): diff --git a/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py index b69242a86..44a24471b 100644 --- a/module/plugins/hoster/NowDownloadSx.py +++ b/module/plugins/hoster/NowDownloadSx.py @@ -2,8 +2,8 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.utils import fixup +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.utils import fixup class NowDownloadSx(SimpleHoster): diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index 3f75a33f7..fc1d06d19 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class NowVideoSx(SimpleHoster): diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 725763345..43d41c538 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -5,9 +5,9 @@ import re -from module.common.json_layer import json_loads -from module.plugins.Hoster import Hoster -from module.plugins.internal.CaptchaService import ReCaptcha +from pyload.utils import json_loads +from pyload.plugin.Hoster import Hoster +from pyload.plugin.internal.captcha import ReCaptcha class OboomCom(Hoster): diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index a6e3b034c..5be05ea17 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): @@ -17,7 +17,7 @@ class OneFichierCom(SimpleHoster): __authors__ = [("fragonib", "fragonib[AT]yahoo[DOT]es"), ("the-razer", "daniel_ AT gmx DOT net"), ("zoidberg", "zoidberg@mujmail.cz"), - ("imclem", None), + ("imclem", ""), ("stickell", "l.stickell@yahoo.it"), ("Elrick69", "elrick69[AT]rocketmail[DOT]com"), ("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hoster/OronCom.py b/module/plugins/hoster/OronCom.py index 7e8423ec9..cbbaedae0 100644 --- a/module/plugins/hoster/OronCom.py +++ b/module/plugins/hoster/OronCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class OronCom(DeadHoster): diff --git a/module/plugins/hoster/PandaplaNet.py b/module/plugins/hoster/PandaplaNet.py index 78a1ed177..a078ca3c9 100644 --- a/module/plugins/hoster/PandaplaNet.py +++ b/module/plugins/hoster/PandaplaNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class PandaplaNet(DeadHoster): diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py index 0c3b84a9d..70ce4f32e 100644 --- a/module/plugins/hoster/PornhostCom.py +++ b/module/plugins/hoster/PornhostCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster class PornhostCom(Hoster): diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py index 1bb787f09..9f8a5eec2 100644 --- a/module/plugins/hoster/PornhubCom.py +++ b/module/plugins/hoster/PornhubCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster class PornhubCom(Hoster): diff --git a/module/plugins/hoster/PotloadCom.py b/module/plugins/hoster/PotloadCom.py index d6261af3a..bcbcb57d0 100644 --- a/module/plugins/hoster/PotloadCom.py +++ b/module/plugins/hoster/PotloadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class PotloadCom(DeadHoster): diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index 412a7bf2d..2aaf14736 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class PromptfileCom(SimpleHoster): diff --git a/module/plugins/hoster/PrzeklejPl.py b/module/plugins/hoster/PrzeklejPl.py index 3a59a2c9e..ff19c770e 100644 --- a/module/plugins/hoster/PrzeklejPl.py +++ b/module/plugins/hoster/PrzeklejPl.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class PrzeklejPl(DeadHoster): diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 210bf4cb2..5a3fd871b 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -2,9 +2,7 @@ import re -from pycurl import FOLLOWLOCATION - -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class QuickshareCz(SimpleHoster): @@ -59,15 +57,13 @@ class QuickshareCz(SimpleHoster): data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4")) self.logDebug("FREE URL1:" + download_url, data) - self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.load(download_url, post=data) + self.load(download_url, post=data, follow_location=False) self.header = self.req.http.header - self.req.http.c.setopt(FOLLOWLOCATION, 1) m = re.search(r'Location\s*:\s*(.+)', self.header, re.I) if m is None: self.fail(_("File not found")) - download_url = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 + download_url = m.group(1) self.logDebug("FREE URL2:" + download_url) # check errors diff --git a/module/plugins/hoster/RapidfileshareNet.py b/module/plugins/hoster/RapidfileshareNet.py index 0bbaed57f..6d54f72f2 100644 --- a/module/plugins/hoster/RapidfileshareNet.py +++ b/module/plugins/hoster/RapidfileshareNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class RapidfileshareNet(XFSHoster): diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 7ec843646..2dfd8f59c 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -20,7 +20,7 @@ class RapidgatorNet(SimpleHoster): __description__ = """Rapidgator.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("chrox", None), + ("chrox", ""), ("stickell", "l.stickell@yahoo.it"), ("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 350572eef..5c12bf924 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -5,9 +5,9 @@ import re from pycurl import HTTPHEADER from time import time, altzone -from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.utils import json_loads +from pyload.plugin.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class RapiduNet(SimpleHoster): diff --git a/module/plugins/hoster/RarefileNet.py b/module/plugins/hoster/RarefileNet.py index a45e4ed4d..8f0bf8834 100644 --- a/module/plugins/hoster/RarefileNet.py +++ b/module/plugins/hoster/RarefileNet.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class RarefileNet(XFSHoster): diff --git a/module/plugins/hoster/RedtubeCom.py b/module/plugins/hoster/RedtubeCom.py index d68fbe262..1f18d09c7 100644 --- a/module/plugins/hoster/RedtubeCom.py +++ b/module/plugins/hoster/RedtubeCom.py @@ -2,8 +2,8 @@ import re -from module.plugins.Hoster import Hoster -from module.unescape import unescape +from pyload.plugin.Hoster import Hoster +from pyload.utils import html_unescape class RedtubeCom(Hoster): @@ -38,7 +38,7 @@ class RedtubeCom(Hoster): if not self.html: self.download_html() - file_url = unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) + file_url = html_unescape(re.search(r'hashlink=(http.*?)"', self.html).group(1)) return file_url diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index ed64b6a89..b1587ad6d 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -6,11 +6,11 @@ # Note: # The remixshare.com website is very very slow, so # if your download not starts because of pycurl timeouts: -# Adjust timeouts in /usr/share/pyload/module/network/HTTPRequest.py +# Adjust timeouts in /usr/share/pyload/pyload/network/HTTPRequest.py import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class RemixshareCom(SimpleHoster): diff --git a/module/plugins/hoster/RgHostNet.py b/module/plugins/hoster/RgHostNet.py index aa4830563..7a16598b2 100644 --- a/module/plugins/hoster/RgHostNet.py +++ b/module/plugins/hoster/RgHostNet.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class RgHostNet(SimpleHoster): diff --git a/module/plugins/hoster/SafesharingEu.py b/module/plugins/hoster/SafesharingEu.py index 08612e413..c1fc9c68d 100644 --- a/module/plugins/hoster/SafesharingEu.py +++ b/module/plugins/hoster/SafesharingEu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class SafesharingEu(XFSHoster): diff --git a/module/plugins/hoster/SecureUploadEu.py b/module/plugins/hoster/SecureUploadEu.py index 6bfbce328..0b2b603bf 100644 --- a/module/plugins/hoster/SecureUploadEu.py +++ b/module/plugins/hoster/SecureUploadEu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class SecureUploadEu(XFSHoster): diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index ffd2995b8..5310051d1 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class SendspaceCom(SimpleHoster): diff --git a/module/plugins/hoster/Share4WebCom.py b/module/plugins/hoster/Share4WebCom.py index 7a276c1fe..0c2ee358e 100644 --- a/module/plugins/hoster/Share4WebCom.py +++ b/module/plugins/hoster/Share4WebCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.hoster.UnibytesCom import UnibytesCom -from module.plugins.internal.SimpleHoster import create_getInfo +from pyload.plugin.hoster.UnibytesCom import UnibytesCom +from pyload.plugin.internal.SimpleHoster import create_getInfo class Share4WebCom(UnibytesCom): diff --git a/module/plugins/hoster/Share76Com.py b/module/plugins/hoster/Share76Com.py index 1ac8a64e7..7f2cea757 100644 --- a/module/plugins/hoster/Share76Com.py +++ b/module/plugins/hoster/Share76Com.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class Share76Com(DeadHoster): diff --git a/module/plugins/hoster/ShareFilesCo.py b/module/plugins/hoster/ShareFilesCo.py index 4996014d8..dd5c9b85d 100644 --- a/module/plugins/hoster/ShareFilesCo.py +++ b/module/plugins/hoster/ShareFilesCo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class ShareFilesCo(DeadHoster): diff --git a/module/plugins/hoster/SharebeesCom.py b/module/plugins/hoster/SharebeesCom.py index c0fd22c91..3843a352b 100644 --- a/module/plugins/hoster/SharebeesCom.py +++ b/module/plugins/hoster/SharebeesCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class SharebeesCom(DeadHoster): diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index e00bf5ada..b37b4b0bc 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -6,9 +6,9 @@ from time import time from urllib import unquote from urlparse import urlparse -from module.network.RequestFactory import getURL -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.network.RequestFactory import getURL +from pyload.plugin.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index 07724a9d1..61e0f8723 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -4,7 +4,7 @@ import re from urllib import unquote -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster class ShareplaceCom(Hoster): @@ -16,7 +16,7 @@ class ShareplaceCom(Hoster): __description__ = """Shareplace.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("ACCakut", None)] + __authors__ = [("ACCakut", "")] def process(self, pyfile): diff --git a/module/plugins/hoster/SharingmatrixCom.py b/module/plugins/hoster/SharingmatrixCom.py index fa08a4a8f..a20a36543 100644 --- a/module/plugins/hoster/SharingmatrixCom.py +++ b/module/plugins/hoster/SharingmatrixCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class SharingmatrixCom(DeadHoster): @@ -13,7 +13,7 @@ class SharingmatrixCom(DeadHoster): __description__ = """Sharingmatrix.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de"), - ("paulking", None)] + ("paulking", "")] getInfo = create_getInfo(SharingmatrixCom) diff --git a/module/plugins/hoster/ShragleCom.py b/module/plugins/hoster/ShragleCom.py index bec30f6f2..cf975b2f5 100644 --- a/module/plugins/hoster/ShragleCom.py +++ b/module/plugins/hoster/ShragleCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class ShragleCom(DeadHoster): diff --git a/module/plugins/hoster/SockshareCom.py b/module/plugins/hoster/SockshareCom.py index aabb8dcd1..e85a74e49 100644 --- a/module/plugins/hoster/SockshareCom.py +++ b/module/plugins/hoster/SockshareCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class SockshareCom(DeadHoster): diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py index c7c9c3880..fd5d1ea6c 100644 --- a/module/plugins/hoster/SoundcloudCom.py +++ b/module/plugins/hoster/SoundcloudCom.py @@ -3,7 +3,7 @@ import pycurl import re -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster class SoundcloudCom(Hoster): diff --git a/module/plugins/hoster/SpeedLoadOrg.py b/module/plugins/hoster/SpeedLoadOrg.py index a13220eab..588eb26a3 100644 --- a/module/plugins/hoster/SpeedLoadOrg.py +++ b/module/plugins/hoster/SpeedLoadOrg.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class SpeedLoadOrg(DeadHoster): diff --git a/module/plugins/hoster/SpeedfileCz.py b/module/plugins/hoster/SpeedfileCz.py index f23c8d4c7..3f17bbbe6 100644 --- a/module/plugins/hoster/SpeedfileCz.py +++ b/module/plugins/hoster/SpeedfileCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class SpeedfileCz(DeadHoster): diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py index f21b0a3a7..078cbf6c8 100644 --- a/module/plugins/hoster/SpeedyshareCom.py +++ b/module/plugins/hoster/SpeedyshareCom.py @@ -7,7 +7,7 @@ import re from urlparse import urljoin -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class SpeedyshareCom(SimpleHoster): diff --git a/module/plugins/hoster/StorageTo.py b/module/plugins/hoster/StorageTo.py index bedc2934f..4b18c69da 100644 --- a/module/plugins/hoster/StorageTo.py +++ b/module/plugins/hoster/StorageTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class StorageTo(DeadHoster): diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 11d4efcdb..95e69abf4 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -2,8 +2,8 @@ import re -from module.network.RequestFactory import getURL -from module.plugins.Hoster import Hoster +from pyload.network.RequestFactory import getURL +from pyload.plugin.Hoster import Hoster def getInfo(urls): diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index 54f430508..c47c2c6a1 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class StreamcloudEu(XFSHoster): diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index fbd054713..811136405 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -9,9 +9,9 @@ from binascii import hexlify, unhexlify from pycurl import HTTPHEADER from urllib import quote -from module.network.RequestFactory import getURL -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp +from pyload.network.RequestFactory import getURL +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp class TurbobitNet(SimpleHoster): @@ -21,10 +21,10 @@ class TurbobitNet(SimpleHoster): __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' - __description__ = """ Turbobit.net hoster plugin """ + __description__ = """Turbobit.net hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("prOq", None)] + ("prOq", "")] URL_REPLACEMENTS = [(__pattern__ + ".*", "http://turbobit.net/\g<ID>.html")] diff --git a/module/plugins/hoster/TurbouploadCom.py b/module/plugins/hoster/TurbouploadCom.py index f0893cef6..f821438dd 100644 --- a/module/plugins/hoster/TurbouploadCom.py +++ b/module/plugins/hoster/TurbouploadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class TurbouploadCom(DeadHoster): diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py index c6ca2ab29..53911762d 100644 --- a/module/plugins/hoster/TwoSharedCom.py +++ b/module/plugins/hoster/TwoSharedCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class TwoSharedCom(SimpleHoster): diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 3552942ff..104209a66 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -3,8 +3,8 @@ import re import time -from module.common.json_layer import json_loads -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.utils import json_loads +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo def convertDecimalPrefix(m): diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index 0267d4b61..862429af5 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UloziskoSk(SimpleHoster): diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 16b1f82ab..dadbe2fec 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -4,9 +4,7 @@ import re from urlparse import urljoin -from pycurl import FOLLOWLOCATION - -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): @@ -33,11 +31,10 @@ class UnibytesCom(SimpleHoster): domain = "http://www.%s/" % self.HOSTER_DOMAIN action, post_data = self.parseHtmlForm('id="startForm"') - self.req.http.c.setopt(FOLLOWLOCATION, 0) for _i in xrange(8): self.logDebug(action, post_data) - self.html = self.load(urljoin(domain, action), post=post_data) + self.html = self.load(urljoin(domain, action), post=post_data, follow_location=False) m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I) if m: @@ -70,8 +67,6 @@ class UnibytesCom(SimpleHoster): else: self.fail(_("No valid captcha code entered")) - self.req.http.c.setopt(FOLLOWLOCATION, 1) - self.download(url) diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 59c593c93..d14f2fdc5 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -4,7 +4,7 @@ import re from urlparse import urljoin -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): @@ -16,7 +16,7 @@ class UpleaCom(XFSHoster): __description__ = """Uplea.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("Redleon", None)] + __authors__ = [("Redleon", "")] NAME_PATTERN = r'class="agmd size18">(?P<N>.+?)<' diff --git a/module/plugins/hoster/UploadStationCom.py b/module/plugins/hoster/UploadStationCom.py index d987770fe..daa7a9e81 100644 --- a/module/plugins/hoster/UploadStationCom.py +++ b/module/plugins/hoster/UploadStationCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class UploadStationCom(DeadHoster): diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 11cf3d321..bddd26f57 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -4,8 +4,8 @@ import re from time import sleep -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadableCh(SimpleHoster): diff --git a/module/plugins/hoster/UploadboxCom.py b/module/plugins/hoster/UploadboxCom.py index 031c5f761..6285b56c5 100644 --- a/module/plugins/hoster/UploadboxCom.py +++ b/module/plugins/hoster/UploadboxCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class UploadboxCom(DeadHoster): diff --git a/module/plugins/hoster/UploadhereCom.py b/module/plugins/hoster/UploadhereCom.py index 8da30be46..64b235eda 100644 --- a/module/plugins/hoster/UploadhereCom.py +++ b/module/plugins/hoster/UploadhereCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class UploadhereCom(DeadHoster): diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index ac0b4b562..a0a9cffcb 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -5,7 +5,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadheroCom(SimpleHoster): diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 164b7b243..a315d3466 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -4,8 +4,8 @@ import re from pycurl import HTTPHEADER -from module.common.json_layer import json_loads -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp +from pyload.utils import json_loads +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo, timestamp class UploadingCom(SimpleHoster): diff --git a/module/plugins/hoster/UploadkingCom.py b/module/plugins/hoster/UploadkingCom.py index 743e700eb..a490d0d48 100644 --- a/module/plugins/hoster/UploadkingCom.py +++ b/module/plugins/hoster/UploadkingCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class UploadkingCom(DeadHoster): diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index 13119eefd..b1ceb7df1 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -2,8 +2,8 @@ import re -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.captcha import ReCaptcha +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class UpstoreNet(SimpleHoster): diff --git a/module/plugins/hoster/UptoboxCom.py b/module/plugins/hoster/UptoboxCom.py index 3f79e509e..3d3505f90 100644 --- a/module/plugins/hoster/UptoboxCom.py +++ b/module/plugins/hoster/UptoboxCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class UptoboxCom(XFSHoster): diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py index d894dab24..91d7cc443 100644 --- a/module/plugins/hoster/VeehdCom.py +++ b/module/plugins/hoster/VeehdCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster class VeehdCom(Hoster): @@ -12,7 +12,7 @@ class VeehdCom(Hoster): __pattern__ = r'http://veehd\.com/video/\d+_\S+' __config__ = [("filename_spaces", "bool", "Allow spaces in filename", False), - ("replacement_char", "str", "Filename replacement character", "_")] + ("replacement_char", "str", "Filename replacement character", "_")] __description__ = """Veehd.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index 219efa8e1..cb3e896d6 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class VeohCom(SimpleHoster): diff --git a/module/plugins/hoster/VidPlayNet.py b/module/plugins/hoster/VidPlayNet.py index f1a32a897..5f979e856 100644 --- a/module/plugins/hoster/VidPlayNet.py +++ b/module/plugins/hoster/VidPlayNet.py @@ -3,7 +3,7 @@ # Test links: # BigBuckBunny_320x180.mp4 - 61.7 Mb - http://vidplay.net/38lkev0h3jv0 -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class VidPlayNet(XFSHoster): diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py index d427c1511..7ca6c962b 100644 --- a/module/plugins/hoster/VimeoCom.py +++ b/module/plugins/hoster/VimeoCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class VimeoCom(SimpleHoster): @@ -12,7 +12,7 @@ class VimeoCom(SimpleHoster): __pattern__ = r'https?://(?:www\.)?(player\.)?vimeo\.com/(video/)?(?P<ID>\d+)' __config__ = [("quality", "Lowest;Mobile;SD;HD;Highest", "Quality", "Highest"), - ("original", "bool", "Try to download the original file first", True)] + ("original", "bool", "Try to download the original file first", True)] __description__ = """Vimeo.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/Vipleech4UCom.py b/module/plugins/hoster/Vipleech4UCom.py index 2ae41b942..dec67e7a4 100644 --- a/module/plugins/hoster/Vipleech4UCom.py +++ b/module/plugins/hoster/Vipleech4UCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class Vipleech4UCom(DeadHoster): diff --git a/module/plugins/hoster/WarserverCz.py b/module/plugins/hoster/WarserverCz.py index c83d5c03e..1631a021d 100644 --- a/module/plugins/hoster/WarserverCz.py +++ b/module/plugins/hoster/WarserverCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class WarserverCz(DeadHoster): diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 457e72865..631f9d3c6 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -4,7 +4,7 @@ import re from pycurl import HTTPHEADER -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class WrzucTo(SimpleHoster): diff --git a/module/plugins/hoster/WuploadCom.py b/module/plugins/hoster/WuploadCom.py index 75ce59353..a73ac92e0 100644 --- a/module/plugins/hoster/WuploadCom.py +++ b/module/plugins/hoster/WuploadCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class WuploadCom(DeadHoster): @@ -13,7 +13,7 @@ class WuploadCom(DeadHoster): __description__ = """Wupload.com hoster plugin""" __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de"), - ("Paul King", None)] + ("Paul King", "")] getInfo = create_getInfo(WuploadCom) diff --git a/module/plugins/hoster/X7To.py b/module/plugins/hoster/X7To.py index a4e4b04bd..6ccc6d637 100644 --- a/module/plugins/hoster/X7To.py +++ b/module/plugins/hoster/X7To.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class X7To(DeadHoster): diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index c66f25ad4..23af6e7fc 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -2,7 +2,7 @@ import re -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo +from pyload.plugin.internal.XFSHoster import XFSHoster, create_getInfo class XFileSharingPro(XFSHoster): diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index c6e789fa8..92340152f 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -4,8 +4,8 @@ import re from urllib import unquote -from module.common.json_layer import json_loads -from module.plugins.Hoster import Hoster +from pyload.utils import json_loads +from pyload.plugin.Hoster import Hoster def clean_json(json_expr): diff --git a/module/plugins/hoster/XVideosCom.py b/module/plugins/hoster/XVideosCom.py index 9bb2da424..c5e2921cb 100644 --- a/module/plugins/hoster/XVideosCom.py +++ b/module/plugins/hoster/XVideosCom.py @@ -4,7 +4,7 @@ import re from urllib import unquote -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster class XVideosCom(Hoster): diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index bfa62b8db..277b7ad0c 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -10,8 +10,8 @@ from os.path import exists, join from select import select from time import time -from module.plugins.Hoster import Hoster -from module.utils import save_join +from pyload.plugin.Hoster import Hoster +from pyload.utils import safe_join class Xdcc(Hoster): @@ -20,8 +20,8 @@ class Xdcc(Hoster): __version__ = "0.32" __config__ = [("nick", "str", "Nickname", "pyload"), - ("ident", "str", "Ident", "pyloadident"), - ("realname", "str", "Realname", "pyloadreal")] + ("ident", "str", "Ident", "pyloadident"), + ("realname", "str", "Realname", "pyloadreal")] __description__ = """Download from IRC XDCC bot""" __license__ = "GPLv3" @@ -192,7 +192,7 @@ class Xdcc(Hoster): self.pyfile.name = packname download_folder = self.config['general']['download_folder'] - filename = save_join(download_folder, packname) + filename = safe_join(download_folder, packname) self.logInfo(_("Downloading %s from %s:%d") % (packname, ip, port)) diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index cf1550ebc..6da5cff33 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -2,8 +2,8 @@ import re -from module.common.json_layer import json_loads -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.utils import json_loads +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class YibaishiwuCom(SimpleHoster): diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 4bb2520e6..75606935d 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -2,7 +2,7 @@ import re -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster class YoupornCom(Hoster): diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index e0def108e..a600d822f 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -4,7 +4,7 @@ import re from urllib import unquote -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster class YourfilesTo(Hoster): diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index d00bf2a0e..bf8785022 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -6,9 +6,9 @@ import subprocess from urllib import unquote -from module.plugins.Hoster import Hoster -from module.plugins.internal.SimpleHoster import replace_patterns -from module.utils import html_unescape +from pyload.plugin.Hoster import Hoster +from pyload.plugin.internal.SimpleHoster import replace_patterns +from pyload.utils import html_unescape def which(program): diff --git a/module/plugins/hoster/ZDF.py b/module/plugins/hoster/ZDF.py index 8d3de5b26..da6d6448e 100644 --- a/module/plugins/hoster/ZDF.py +++ b/module/plugins/hoster/ZDF.py @@ -4,7 +4,7 @@ import re from xml.etree.ElementTree import fromstring -from module.plugins.Hoster import Hoster +from pyload.plugin.Hoster import Hoster # Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/) diff --git a/module/plugins/hoster/ZShareNet.py b/module/plugins/hoster/ZShareNet.py index dc96facbe..a6a34143f 100644 --- a/module/plugins/hoster/ZShareNet.py +++ b/module/plugins/hoster/ZShareNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo +from pyload.plugin.internal.DeadHoster import DeadHoster, create_getInfo class ZShareNet(DeadHoster): @@ -12,8 +12,8 @@ class ZShareNet(DeadHoster): __description__ = """ZShare.net hoster plugin""" __license__ = "GPLv3" - __authors__ = [("espes", None), - ("Cptn Sandwich", None)] + __authors__ = [("espes", ""), + ("Cptn Sandwich", "")] getInfo = create_getInfo(ZShareNet) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index a43f70cbd..f08fb7dae 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -3,7 +3,7 @@ import re from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): diff --git a/module/plugins/hoster/__init__.py b/module/plugins/hoster/__init__.py index e69de29bb..40a96afc6 100644 --- a/module/plugins/hoster/__init__.py +++ b/module/plugins/hoster/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/internal/BasePlugin.py index f9eb695ca..792497449 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/internal/BasePlugin.py @@ -17,7 +17,7 @@ class BasePlugin(Hoster): __pattern__ = r'^unmatchable$' - __description__ = """Base Plugin when any other didnt fit""" + __description__ = """Base plugin when any other didnt fit""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org"), ("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/internal/DeadCrypter.py b/module/plugins/internal/DeadCrypter.py index 866d177cf..ce56947fc 100644 --- a/module/plugins/internal/DeadCrypter.py +++ b/module/plugins/internal/DeadCrypter.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleCrypter import create_getInfo -from module.plugins.Crypter import Crypter as _Crypter +from pyload.plugin.Crypter import Crypter as _Crypter +from pyload.plugin.internal.SimpleCrypter import create_getInfo class DeadCrypter(_Crypter): @@ -11,7 +11,7 @@ class DeadCrypter(_Crypter): __pattern__ = r'^unmatchable$' - __description__ = """ Crypter is no longer available """ + __description__ = """Crypter is no longer available""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py index a6ad92607..132e4741a 100644 --- a/module/plugins/internal/DeadHoster.py +++ b/module/plugins/internal/DeadHoster.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleHoster import create_getInfo -from module.plugins.Hoster import Hoster as _Hoster +from pyload.plugin.Hoster import Hoster as _Hoster +from pyload.plugin.internal.SimpleHoster import create_getInfo class DeadHoster(_Hoster): @@ -11,7 +11,7 @@ class DeadHoster(_Hoster): __pattern__ = r'^unmatchable$' - __description__ = """ Hoster is no longer available """ + __description__ = """Hoster is no longer available""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 856b548f0..dc34f864f 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -4,9 +4,9 @@ import re from urlparse import urljoin, urlparse -from module.plugins.Crypter import Crypter -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies -from module.utils import fixup +from pyload.plugin.Crypter import Crypter +from pyload.plugin.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies +from pyload.utils import fixup class SimpleCrypter(Crypter, SimpleHoster): @@ -68,19 +68,6 @@ class SimpleCrypter(Crypter, SimpleHoster): LOGIN_PREMIUM = False - #@TODO: Remove in 0.4.10 - def init(self): - account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "") - account = self.pyfile.m.core.accountManager.getAccountPlugin(account_name) - - if account and account.canUse(): - self.user, data = account.selectAccount() - self.req = account.getAccountRequest(self.user) - self.premium = account.isPremium(self.user) - - self.account = account - - def prepare(self): self.pyfile.error = "" #@TODO: Remove in 0.4.10 diff --git a/module/plugins/internal/UpdateManager.py b/module/plugins/internal/UpdateManager.py new file mode 100644 index 000000000..7bbfc0c79 --- /dev/null +++ b/module/plugins/internal/UpdateManager.py @@ -0,0 +1,300 @@ +# -*- coding: utf-8 -*- + +import re +import sys + +from operator import itemgetter +from os import path, remove, stat + +from pyload.network.RequestFactory import getURL +from pyload.plugin.Addon import Expose, Addon, threaded +from pyload.utils import safe_join + + +class UpdateManager(Addon): + __name__ = "UpdateManager" + __type__ = "addon" + __version__ = "0.40" + + __config__ = [("activated" , "bool" , "Activated" , True ), + ("mode" , "pyLoad + plugins;plugins only", "Check updates for" , "pyLoad + plugins"), + ("interval" , "int" , "Check interval in hours" , 8 ), + ("reloadplugins", "bool" , "Monitor plugins for code changes (debug mode only)", True ), + ("nodebugupdate", "bool" , "Don't check for updates in debug mode" , True )] + + __description__ = """Check for updates""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + # event_list = ["pluginConfigChanged"] + + SERVER_URL = "http://updatemanager.pyload.org" + MIN_INTERVAL = 6 * 60 * 60 #: 6h minimum check interval (value is in seconds) + + + def pluginConfigChanged(self, plugin, name, value): + if name == "interval": + interval = value * 60 * 60 + if self.MIN_INTERVAL <= interval != self.interval: + self.core.scheduler.removeJob(self.cb) + self.interval = interval + self.initPeriodical() + else: + self.logDebug("Invalid interval value, kept current") + + elif name == "reloadplugins": + if self.cb2: + self.core.scheduler.removeJob(self.cb2) + if value is True and self.core.debug: + self.periodical2() + + + def activate(self): + self.pluginConfigChanged(self.__name__, "interval", self.getConfig("interval")) + x = lambda: self.pluginConfigChanged(self.__name__, "reloadplugins", self.getConfig("reloadplugins")) + self.core.scheduler.addJob(10, x, threaded=False) + + + def deactivate(self): + self.pluginConfigChanged(self.__name__, "reloadplugins", False) + + + def setup(self): + self.cb2 = None + self.interval = self.MIN_INTERVAL + self.updating = False + self.info = {'pyload': False, 'version': None, 'plugins': False} + self.mtimes = {} #: store modification time for each plugin + + + def periodical2(self): + if not self.updating: + self.autoreloadPlugins() + + self.cb2 = self.core.scheduler.addJob(4, self.periodical2, threaded=False) + + + @Expose + def autoreloadPlugins(self): + """ reload and reindex all modified plugins """ + modules = filter( + lambda m: m and (m.__name__.startswith("pyload.plugin.") or + m.__name__.startswith("userplugins.")) and + m.__name__.count(".") >= 2, sys.modules.itervalues() + ) + + reloads = [] + + for m in modules: + root, type, name = m.__name__.rsplit(".", 2) + id = (type, name) + if type in self.core.pluginManager.plugins: + f = m.__file__.replace(".pyc", ".py") + if not path.isfile(f): + continue + + mtime = stat(f).st_mtime + + if id not in self.mtimes: + self.mtimes[id] = mtime + elif self.mtimes[id] < mtime: + reloads.append(id) + self.mtimes[id] = mtime + + return True if self.core.pluginManager.reloadPlugins(reloads) else False + + + def periodical(self): + if self.info['pyload'] or self.getConfig("nodebugupdate") and self.core.debug: + return + + self.updateThread() + + + def server_request(self): + try: + return getURL(self.SERVER_URL, get={'v': self.core.api.getServerVersion()}).splitlines() + except Exception: + self.logWarning(_("Unable to contact server to get updates")) + + + @threaded + def updateThread(self): + self.updating = True + + status = self.update(onlyplugin=self.getConfig("mode") == "plugins only") + + if status == 2: + self.core.api.restart() + else: + self.updating = False + + + @Expose + def updatePlugins(self): + """ simple wrapper for calling plugin update quickly """ + return self.update(onlyplugin=True) + + + @Expose + def update(self, onlyplugin=False): + """ check for updates """ + data = self.server_request() + + if not data: + exitcode = 0 + + elif data[0] == "None": + self.logInfo(_("No new pyLoad version available")) + updates = data[1:] + exitcode = self._updatePlugins(updates) + + elif onlyplugin: + exitcode = 0 + + else: + newversion = data[0] + self.logInfo(_("*** New pyLoad Version %s available ***") % newversion) + self.logInfo(_("*** Get it here: https://github.com/pyload/pyload/releases ***")) + exitcode = 3 + self.info['pyload'] = True + self.info['version'] = newversion + + return exitcode #: 0 = No plugins updated; 1 = Plugins updated; 2 = Plugins updated, but restart required; 3 = No plugins updated, new pyLoad version available + + + def _updatePlugins(self, updates): + """ check for plugin updates """ + + if self.info['plugins']: + return False #: plugins were already updated + + exitcode = 0 + updated = [] + + vre = re.compile(r'__version__.*=.*("|\')([\d.]+)') + url = updates[0] + schema = updates[1].split('|') + + if "BLACKLIST" in updates: + blacklist = updates[updates.index('BLACKLIST') + 1:] + updates = updates[2:updates.index('BLACKLIST')] + else: + blacklist = None + updates = updates[2:] + + upgradable = sorted(map(lambda x: dict(zip(schema, x.split('|'))), updates), + key=itemgetter("type", "name")) + + for plugin in upgradable: + filename = plugin['name'] + type = plugin['type'] + version = plugin['version'] + + if filename.endswith(".pyc"): + name = filename[:filename.find("_")] + else: + name = filename.replace(".py", "") + + plugins = getattr(self.core.pluginManager, "%sPlugins" % type) + + oldver = float(plugins[name]['version']) if name in plugins else None + newver = float(version) + + if not oldver: + msg = "New plugin: [%(type)s] %(name)s (v%(newver).2f)" + elif newver > oldver: + msg = "New version of plugin: [%(type)s] %(name)s (v%(oldver).2f -> v%(newver).2f)" + else: + continue + + self.logInfo(_(msg) % {'type' : type, + 'name' : name, + 'oldver': oldver, + 'newver': newver}) + try: + content = getURL(url % plugin) + m = vre.search(content) + + if m and m.group(2) == version: + f = open(safe_join("userplugins", prefix, filename), "wb") + f.write(content) + f.close() + updated.append((prefix, name)) + else: + raise Exception, _("Version mismatch") + + except Exception, e: + self.logError(_("Error updating plugin %s") % filename, e) + + if blacklist: + blacklisted = map(lambda x: (x.split('|')[0], x.split('|')[1].rsplit('.', 1)[0]), blacklist) + + # Always protect internal plugins from removing + for i, n, t in blacklisted.enumerate(): + if t == "internal": + del blacklisted[i] + + blacklisted = sorted(blacklisted) + removed = self.removePlugins(blacklisted) + for t, n in removed: + self.logInfo(_("Removed blacklisted plugin [%(type)s] %(name)s") % { + 'type': t, + 'name': n, + }) + + if updated: + reloaded = self.core.pluginManager.reloadPlugins(updated) + if reloaded: + self.logInfo(_("Plugins updated and reloaded")) + exitcode = 1 + else: + self.logInfo(_("*** Plugins have been updated, but need a pyLoad restart to be reloaded ***")) + self.info['plugins'] = True + exitcode = 2 + else: + self.logInfo(_("No plugin updates available")) + + return exitcode #: 0 = No plugins updated; 1 = Plugins updated; 2 = Plugins updated, but restart required + + + @Expose + def removePlugins(self, type_plugins): + """ delete plugins from disk """ + + if not type_plugins: + return + + self.logDebug("Requested deletion of plugins: %s" % type_plugins) + + removed = [] + + for type, name in type_plugins: + err = False + file = name + ".py" + + for root in ("userplugins", path.join(pypath, "pyload", "plugins")): + + filename = safe_join(root, type, file) + try: + remove(filename) + except Exception, e: + self.logDebug("Error deleting: %s" % path.basename(filename), e) + err = True + + filename += "c" + if path.isfile(filename): + try: + if type == "addon": + self.manager.deactivateAddon(name) + remove(filename) + except Exception, e: + self.logDebug("Error deleting: %s" % path.basename(filename), e) + err = True + + if not err: + id = (type, name) + removed.append(id) + + return removed #: return a list of the plugins successfully removed diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 845ea3230..2e6b7dc50 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -5,8 +5,8 @@ import re from time import gmtime, mktime, strptime from urlparse import urljoin -from module.plugins.Account import Account -from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies +from pyload.plugin.Account import Account +from pyload.plugin.internal.SimpleHoster import parseHtmlForm, set_cookies class XFSAccount(Account): @@ -39,11 +39,6 @@ class XFSAccount(Account): LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|account was banned|Error<' - def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 - self.init() - return super(XFSAccount, self).__init__(manager, accounts) - - def init(self): if not self.HOSTER_DOMAIN: self.logError(_("Missing HOSTER_DOMAIN")) diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index c4fc969ba..ecdd2f125 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -6,11 +6,9 @@ from random import random from time import sleep from urlparse import urljoin, urlparse -from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME - -from module.plugins.internal.CaptchaService import ReCaptcha, SolveMedia +from pyload.plugin.internal.captcha import ReCaptcha, SolveMedia from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, secondsToMidnight -from module.utils import html_unescape +from pyload.utils import html_unescape class XFSHoster(SimpleHoster): @@ -101,11 +99,7 @@ class XFSHoster(SimpleHoster): data = self.getPostParameters() - self.req.http.c.setopt(FOLLOWLOCATION, 0) - - self.html = self.load(pyfile.url, post=data, ref=True, decode=True) - - self.req.http.c.setopt(FOLLOWLOCATION, 1) + self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True, follow_location=False) m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m and not "op=" in m.group(1): diff --git a/module/plugins/internal/__init__.py b/module/plugins/internal/__init__.py index e69de29bb..40a96afc6 100644 --- a/module/plugins/internal/__init__.py +++ b/module/plugins/internal/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/module/plugins/captcha/GigasizeCom.py b/module/plugins/ocr/GigasizeCom.py index 244cf6a2a..6982e6ca9 100644 --- a/module/plugins/captcha/GigasizeCom.py +++ b/module/plugins/ocr/GigasizeCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.captcha.captcha import OCR +from pyload.plugin.OCR import OCR class GigasizeCom(OCR): diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/ocr/LinksaveIn.py index de6b0e7ff..7ced74f4b 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/ocr/LinksaveIn.py @@ -9,7 +9,7 @@ from glob import glob from os import sep from os.path import abspath, dirname -from module.plugins.captcha.captcha import OCR +from pyload.plugin.OCR import OCR class LinksaveIn(OCR): diff --git a/module/plugins/captcha/NetloadIn.py b/module/plugins/ocr/NetloadIn.py index 28eb18fb5..8939b5318 100644 --- a/module/plugins/captcha/NetloadIn.py +++ b/module/plugins/ocr/NetloadIn.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.captcha.captcha import OCR +from pyload.plugin.OCR import OCR class NetloadIn(OCR): diff --git a/module/plugins/captcha/ShareonlineBiz.py b/module/plugins/ocr/ShareonlineBiz.py index 8210e8859..bbc3d1762 100644 --- a/module/plugins/captcha/ShareonlineBiz.py +++ b/module/plugins/ocr/ShareonlineBiz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from module.plugins.captcha.captcha import OCR +from pyload.plugin.OCR import OCR class ShareonlineBiz(OCR): diff --git a/module/plugins/ocr/__init__.py b/module/plugins/ocr/__init__.py new file mode 100644 index 000000000..40a96afc6 --- /dev/null +++ b/module/plugins/ocr/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- |