From cc105b7dbc363d9786594c1e884f1836eb22e999 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 3 Oct 2014 19:56:27 +0200 Subject: New base plugins --- pyload/plugins/Account.py | 281 ---------------------- pyload/plugins/Container.py | 61 ----- pyload/plugins/Crypter.py | 61 ----- pyload/plugins/Hook.py | 149 ------------ pyload/plugins/Hoster.py | 20 -- pyload/plugins/OCR.py | 299 ------------------------ pyload/plugins/accounts/AlldebridCom.py | 2 +- pyload/plugins/accounts/BayfilesCom.py | 2 +- pyload/plugins/accounts/BitshareCom.py | 2 +- pyload/plugins/accounts/CzshareCom.py | 2 +- pyload/plugins/accounts/DebridItaliaCom.py | 2 +- pyload/plugins/accounts/DepositfilesCom.py | 2 +- pyload/plugins/accounts/EasybytezCom.py | 2 +- pyload/plugins/accounts/EgoFilesCom.py | 2 +- pyload/plugins/accounts/EuroshareEu.py | 2 +- pyload/plugins/accounts/FastixRu.py | 2 +- pyload/plugins/accounts/FastshareCz.py | 2 +- pyload/plugins/accounts/FilecloudIo.py | 2 +- pyload/plugins/accounts/FilefactoryCom.py | 2 +- pyload/plugins/accounts/FilejungleCom.py | 2 +- pyload/plugins/accounts/FilerNet.py | 2 +- pyload/plugins/accounts/FilesMailRu.py | 2 +- pyload/plugins/accounts/FileserveCom.py | 2 +- pyload/plugins/accounts/FourSharedCom.py | 2 +- pyload/plugins/accounts/FreakshareCom.py | 2 +- pyload/plugins/accounts/FreeWayMe.py | 2 +- pyload/plugins/accounts/FshareVn.py | 2 +- pyload/plugins/accounts/Ftp.py | 2 +- pyload/plugins/accounts/HellshareCz.py | 2 +- pyload/plugins/accounts/HotfileCom.py | 2 +- pyload/plugins/accounts/Http.py | 2 +- pyload/plugins/accounts/LetitbitNet.py | 2 +- pyload/plugins/accounts/LinksnappyCom.py | 2 +- pyload/plugins/accounts/MegaDebridEu.py | 2 +- pyload/plugins/accounts/MegasharesCom.py | 2 +- pyload/plugins/accounts/MultishareCz.py | 2 +- pyload/plugins/accounts/MyfastfileCom.py | 2 +- pyload/plugins/accounts/NetloadIn.py | 2 +- pyload/plugins/accounts/OboomCom.py | 2 +- pyload/plugins/accounts/OneFichierCom.py | 2 +- pyload/plugins/accounts/OverLoadMe.py | 2 +- pyload/plugins/accounts/PremiumTo.py | 2 +- pyload/plugins/accounts/PremiumizeMe.py | 2 +- pyload/plugins/accounts/QuickshareCz.py | 2 +- pyload/plugins/accounts/RPNetBiz.py | 2 +- pyload/plugins/accounts/RapidgatorNet.py | 2 +- pyload/plugins/accounts/RapidshareCom.py | 2 +- pyload/plugins/accounts/RealdebridCom.py | 2 +- pyload/plugins/accounts/RehostTo.py | 2 +- pyload/plugins/accounts/ShareRapidCom.py | 2 +- pyload/plugins/accounts/ShareonlineBiz.py | 2 +- pyload/plugins/accounts/SimplyPremiumCom.py | 2 +- pyload/plugins/accounts/SimplydebridCom.py | 2 +- pyload/plugins/accounts/StahnuTo.py | 2 +- pyload/plugins/accounts/TurbobitNet.py | 2 +- pyload/plugins/accounts/TusfilesNet.py | 2 +- pyload/plugins/accounts/UlozTo.py | 2 +- pyload/plugins/accounts/UnrestrictLi.py | 2 +- pyload/plugins/accounts/UploadedTo.py | 2 +- pyload/plugins/accounts/UploadheroCom.py | 2 +- pyload/plugins/accounts/UploadingCom.py | 2 +- pyload/plugins/accounts/YibaishiwuCom.py | 2 +- pyload/plugins/accounts/ZeveraCom.py | 2 +- pyload/plugins/base/Account.py | 281 ++++++++++++++++++++++ pyload/plugins/base/Container.py | 61 +++++ pyload/plugins/base/Crypter.py | 61 +++++ pyload/plugins/base/Hook.py | 149 ++++++++++++ pyload/plugins/base/Hoster.py | 20 ++ pyload/plugins/base/OCR.py | 299 ++++++++++++++++++++++++ pyload/plugins/base/__init__.py | 0 pyload/plugins/container/CCF.py | 2 +- pyload/plugins/container/LinkList.py | 2 +- pyload/plugins/container/RSDF.py | 2 +- pyload/plugins/crypter/ChipDe.py | 2 +- pyload/plugins/crypter/CzshareComFolder.py | 2 +- pyload/plugins/crypter/DDLMusicOrg.py | 2 +- pyload/plugins/crypter/DailymotionBatch.py | 2 +- pyload/plugins/crypter/Dereferer.py | 2 +- pyload/plugins/crypter/DontKnowMe.py | 2 +- pyload/plugins/crypter/DuckCryptInfo.py | 2 +- pyload/plugins/crypter/EmbeduploadCom.py | 2 +- pyload/plugins/crypter/FileserveComFolder.py | 2 +- pyload/plugins/crypter/FourChanOrg.py | 2 +- pyload/plugins/crypter/GooGl.py | 2 +- pyload/plugins/crypter/HoerbuchIn.py | 2 +- pyload/plugins/crypter/HotfileFolderCom.py | 2 +- pyload/plugins/crypter/LetitbitNetFolder.py | 2 +- pyload/plugins/crypter/LinkSaveIn.py | 2 +- pyload/plugins/crypter/LinkdecrypterCom.py | 2 +- pyload/plugins/crypter/LixIn.py | 2 +- pyload/plugins/crypter/MediafireComFolder.py | 2 +- pyload/plugins/crypter/MultiloadCz.py | 2 +- pyload/plugins/crypter/NCryptIn.py | 2 +- pyload/plugins/crypter/OneKhDe.py | 2 +- pyload/plugins/crypter/QuickshareCzFolder.py | 2 +- pyload/plugins/crypter/RelinkUs.py | 2 +- pyload/plugins/crypter/SafelinkingNet.py | 2 +- pyload/plugins/crypter/ShareLinksBiz.py | 2 +- pyload/plugins/crypter/UlozToFolder.py | 2 +- pyload/plugins/crypter/XupPl.py | 2 +- pyload/plugins/crypter/YoutubeBatch.py | 2 +- pyload/plugins/hooks/BypassCaptcha.py | 2 +- pyload/plugins/hooks/Captcha9kw.py | 2 +- pyload/plugins/hooks/CaptchaBrotherhood.py | 2 +- pyload/plugins/hooks/Checksum.py | 2 +- pyload/plugins/hooks/ClickAndLoad.py | 2 +- pyload/plugins/hooks/DeathByCaptcha.py | 2 +- pyload/plugins/hooks/DeleteFinished.py | 2 +- pyload/plugins/hooks/DownloadScheduler.py | 2 +- pyload/plugins/hooks/Ev0InFetcher.py | 2 +- pyload/plugins/hooks/ExpertDecoders.py | 2 +- pyload/plugins/hooks/ExternalScripts.py | 2 +- pyload/plugins/hooks/ExtractArchive.py | 2 +- pyload/plugins/hooks/HotFolder.py | 2 +- pyload/plugins/hooks/IRCInterface.py | 2 +- pyload/plugins/hooks/ImageTyperz.py | 2 +- pyload/plugins/hooks/LinkdecrypterCom.py | 2 +- pyload/plugins/hooks/MergeFiles.py | 2 +- pyload/plugins/hooks/MultiHome.py | 2 +- pyload/plugins/hooks/RestartFailed.py | 2 +- pyload/plugins/hooks/UnSkipOnFail.py | 2 +- pyload/plugins/hooks/WindowsPhoneToastNotify.py | 2 +- pyload/plugins/hooks/XFileSharingPro.py | 2 +- pyload/plugins/hoster/AlldebridCom.py | 2 +- pyload/plugins/hoster/BasePlugin.py | 2 +- pyload/plugins/hoster/DailymotionCom.py | 2 +- pyload/plugins/hoster/DebridItaliaCom.py | 2 +- pyload/plugins/hoster/FastixRu.py | 2 +- pyload/plugins/hoster/FilesMailRu.py | 2 +- pyload/plugins/hoster/FileserveCom.py | 2 +- pyload/plugins/hoster/FileshareInUa.py | 2 +- pyload/plugins/hoster/FreakshareCom.py | 2 +- pyload/plugins/hoster/FreeWayMe.py | 2 +- pyload/plugins/hoster/Ftp.py | 2 +- pyload/plugins/hoster/GamefrontCom.py | 2 +- pyload/plugins/hoster/LinksnappyCom.py | 2 +- pyload/plugins/hoster/MegaDebridEu.py | 2 +- pyload/plugins/hoster/MegaNz.py | 2 +- pyload/plugins/hoster/MyfastfileCom.py | 2 +- pyload/plugins/hoster/MyvideoDe.py | 2 +- pyload/plugins/hoster/NetloadIn.py | 2 +- pyload/plugins/hoster/OboomCom.py | 2 +- pyload/plugins/hoster/OverLoadMe.py | 2 +- pyload/plugins/hoster/PornhostCom.py | 2 +- pyload/plugins/hoster/PornhubCom.py | 2 +- pyload/plugins/hoster/PremiumTo.py | 2 +- pyload/plugins/hoster/PremiumizeMe.py | 2 +- pyload/plugins/hoster/RPNetBiz.py | 2 +- pyload/plugins/hoster/RapidshareCom.py | 2 +- pyload/plugins/hoster/RealdebridCom.py | 2 +- pyload/plugins/hoster/RedtubeCom.py | 2 +- pyload/plugins/hoster/RehostTo.py | 2 +- pyload/plugins/hoster/ShareonlineBiz.py | 2 +- pyload/plugins/hoster/ShareplaceCom.py | 2 +- pyload/plugins/hoster/SimplyPremiumCom.py | 2 +- pyload/plugins/hoster/SimplydebridCom.py | 2 +- pyload/plugins/hoster/SoundcloudCom.py | 2 +- pyload/plugins/hoster/StreamCz.py | 2 +- pyload/plugins/hoster/UnrestrictLi.py | 2 +- pyload/plugins/hoster/UploadedTo.py | 2 +- pyload/plugins/hoster/VeehdCom.py | 2 +- pyload/plugins/hoster/XHamsterCom.py | 2 +- pyload/plugins/hoster/XVideosCom.py | 2 +- pyload/plugins/hoster/Xdcc.py | 2 +- pyload/plugins/hoster/YoupornCom.py | 2 +- pyload/plugins/hoster/YourfilesTo.py | 2 +- pyload/plugins/hoster/YoutubeCom.py | 2 +- pyload/plugins/hoster/ZDF.py | 2 +- pyload/plugins/hoster/ZeveraCom.py | 2 +- pyload/plugins/internal/DeadCrypter.py | 2 +- pyload/plugins/internal/DeadHoster.py | 2 +- pyload/plugins/internal/MultiHoster.py | 2 +- pyload/plugins/internal/SimpleCrypter.py | 2 +- pyload/plugins/internal/SimpleHoster.py | 2 +- pyload/plugins/internal/UpdateManager.py | 2 +- pyload/plugins/internal/XFSPAccount.py | 2 +- pyload/plugins/ocr/GigasizeCom.py | 2 +- pyload/plugins/ocr/LinksaveIn.py | 2 +- pyload/plugins/ocr/NetloadIn.py | 2 +- pyload/plugins/ocr/ShareonlineBiz.py | 2 +- 180 files changed, 1038 insertions(+), 1038 deletions(-) delete mode 100644 pyload/plugins/Account.py delete mode 100644 pyload/plugins/Container.py delete mode 100644 pyload/plugins/Crypter.py delete mode 100644 pyload/plugins/Hook.py delete mode 100644 pyload/plugins/Hoster.py delete mode 100644 pyload/plugins/OCR.py create mode 100644 pyload/plugins/base/Account.py create mode 100644 pyload/plugins/base/Container.py create mode 100644 pyload/plugins/base/Crypter.py create mode 100644 pyload/plugins/base/Hook.py create mode 100644 pyload/plugins/base/Hoster.py create mode 100644 pyload/plugins/base/OCR.py create mode 100644 pyload/plugins/base/__init__.py (limited to 'pyload/plugins') diff --git a/pyload/plugins/Account.py b/pyload/plugins/Account.py deleted file mode 100644 index e338f6b26..000000000 --- a/pyload/plugins/Account.py +++ /dev/null @@ -1,281 +0,0 @@ -# -*- coding: utf-8 -*- - -from random import choice -from time import time -from traceback import print_exc -from threading import RLock - -from pyload.plugins.Plugin import Base -from pyload.utils import compare_time, parseFileSize, lock - - -class WrongPassword(Exception): - pass - - -class Account(Base): - """ - Base class for every Account plugin. - Just overwrite `login` and cookies will be stored and account becomes accessible in\ - associated hoster plugin. Plugin should also provide `loadAccountInfo` - """ - __name__ = "Account" - __type__ = "account" - __version__ = "0.3" - - __description__ = """Base account plugin""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" - - #: 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): - Base.__init__(self, manager.core) - - self.manager = manager - self.accounts = {} - self.infos = {} # cache for account information - self.lock = RLock() - - self.timestamps = {} - self.setAccounts(accounts) - self.init() - - def init(self): - pass - - def login(self, user, data, req): - """login into account, the cookies will be saved so user can be recognized - - :param user: loginname - :param data: data dictionary - :param req: `Request` instance - """ - 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")}) - success = data['valid'] = False - except Exception, e: - self.logWarning( - _("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() - return success - - def relogin(self, user): - req = self.getAccountRequest(user) - if req: - req.cj.clear() - req.close() - if user in self.infos: - del self.infos[user] #delete old information - - return self._login(user, self.accounts[user]) - - def setAccounts(self, accounts): - self.accounts = accounts - for user, data in self.accounts.iteritems(): - 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 - if 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 - 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] - if user in self.infos: - del self.infos[user] - 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!\\ - just use it to retrieve infos in hoster plugins. see `loadAccountInfo` - - :param name: username - :param force: reloads cached account information - :return: dictionary with information - """ - data = Account.loadAccountInfo(self, name) - - if force or name not in self.infos: - self.logDebug("Get Account Info for %s" % name) - req = self.getAccountRequest(name) - - try: - infos = self.loadAccountInfo(name, req) - if not type(infos) == dict: - raise Exception("Wrong return format") - except Exception, e: - infos = {"error": str(e)} - - if req: req.close() - - self.logDebug("Account Info: %s" % infos) - - infos['timestamp'] = time() - self.infos[name] = infos - elif "timestamp" in self.infos[name] and self.infos[name][ - "timestamp"] + self.info_threshold * 60 < time(): - self.logDebug("Reached timeout for account data") - self.scheduleRefresh(name) - - data.update(self.infos[name]) - return data - - def isPremium(self, user): - info = self.getAccountInfo(user) - return info['premium'] - - def loadAccountInfo(self, name, req=None): - """this should be overwritten in account plugin,\ - and retrieving account information for user - - :param name: - :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__, - } - - 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() - if not user: - return None - - req = self.core.requestFactory.getRequest(self.__name__, user) - return req - - def getAccountCookies(self, user=None): - if not user: - user, data = self.selectAccount() - if not user: - return None - - 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 "time" in data['options'] and data['options']['time']: - time_data = "" - try: - time_data = data['options']['time'][0] - start, end = time_data.split("-") - if not compare_time(start.split(":"), end.split(":")): - continue - except: - 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']: - continue - if "trafficleft" in self.infos[user]: - if self.infos[user]['trafficleft'] == 0: - continue - - usable.append((user, data)) - - 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 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) - - 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) - - 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.login_timeout > 0 and self.timestamps[user] + self.login_timeout * 60 < time(): - self.logDebug("Reached login timeout for %s" % user) - return self.relogin(user) - else: - return True - else: - return False diff --git a/pyload/plugins/Container.py b/pyload/plugins/Container.py deleted file mode 100644 index 747232c18..000000000 --- a/pyload/plugins/Container.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from os import remove -from os.path import basename, exists - -from pyload.plugins.Crypter import Crypter -from pyload.utils import safe_join - - -class Container(Crypter): - __name__ = "Container" - __type__ = "container" - __version__ = "0.1" - - __pattern__ = None - - __description__ = """Base container decrypter plugin""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" - - - def preprocessing(self, thread): - """prepare""" - - 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, - 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 = safe_join(self.config['general']['download_folder'], self.pyfile.name) - f = open(self.pyfile.url, "wb" ) - f.write(content) - f.close() - - else: - self.pyfile.name = basename(self.pyfile.url) - if not exists(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.")) - - - def deleteTmp(self): - if self.pyfile.name.startswith("tmp_"): - remove(self.pyfile.url) diff --git a/pyload/plugins/Crypter.py b/pyload/plugins/Crypter.py deleted file mode 100644 index 7bb48d607..000000000 --- a/pyload/plugins/Crypter.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugins.Plugin import Plugin - - -class Crypter(Plugin): - __name__ = "Crypter" - __type__ = "crypter" - __version__ = "0.1" - - __pattern__ = None - - __description__ = """Base decrypter plugin""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" - - - 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 process(self, pyfile): - """ main method """ - self.decrypt(pyfile) - self.createPackages() - - - def decrypt(self, pyfile): - raise NotImplementedError - - - def createPackages(self): - """ create new packages from self.packages """ - for pack in self.packages: - - name, links, folder = pack - - self.logDebug("Parsed package %(name)s with %(len)d links" % {"name": name, "len": len(links)}) - - links = [x.decode("utf-8") for x in links] - - pid = self.api.addPackage(name, links, self.pyfile.package().queue) - - if name != folder is not None: - self.api.setPackageData(pid, {"folder": folder}) #: Due to not break API addPackage method right now - self.logDebug("Set package %(name)s folder to %(folder)s" % {"name": name, "folder": folder}) - - if self.pyfile.package().password: - self.api.setPackageData(pid, {"password": self.pyfile.package().password}) - - if self.urls: - self.api.generateAndAddPackages(self.urls) diff --git a/pyload/plugins/Hook.py b/pyload/plugins/Hook.py deleted file mode 100644 index b9ffbc647..000000000 --- a/pyload/plugins/Hook.py +++ /dev/null @@ -1,149 +0,0 @@ -# -*- coding: utf-8 -*- - -from traceback import print_exc - -from pyload.plugins.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" - __type__ = "hook" - __version__ = "0.2" - - __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.setup() - self.initPeriodical() - - - 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.logError(_("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 "" % 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 diff --git a/pyload/plugins/Hoster.py b/pyload/plugins/Hoster.py deleted file mode 100644 index 23369deec..000000000 --- a/pyload/plugins/Hoster.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -from pyload.plugins.Plugin import Plugin - - -def getInfo(self): - #result = [ .. (name, size, status, url) .. ] - return - - -class Hoster(Plugin): - __name__ = "Hoster" - __type__ = "hoster" - __version__ = "0.1" - - __pattern__ = None - - __description__ = """Base hoster plugin""" - __author_name__ = "mkaay" - __author_mail__ = "mkaay@mkaay.de" diff --git a/pyload/plugins/OCR.py b/pyload/plugins/OCR.py deleted file mode 100644 index 0991184f3..000000000 --- a/pyload/plugins/OCR.py +++ /dev/null @@ -1,299 +0,0 @@ -# -*- coding: utf-8 -*- - -from __future__ import with_statement -import os -import logging -import subprocess - -from os.path import abspath, join -from PIL import Image -from PIL import TiffImagePlugin -from PIL import PngImagePlugin -from PIL import GifImagePlugin -from PIL import JpegImagePlugin - - -class OCR(object): - __name__ = "OCR" - __type__ = "ocr" - __version__ = "0.1" - - __description__ = """OCR base plugin""" - __author_name__ = "pyLoad Team" - __author_mail__ = "admin@pyload.org" - - - def __init__(self): - self.logger = logging.getLogger("log") - - def load_image(self, image): - self.image = Image.open(image) - self.pixels = self.image.load() - self.result_captcha = '' - - def unload(self): - """delete all tmp images""" - pass - - def threshold(self, value): - self.image = self.image.point(lambda a: a * value + 10) - - def run(self, command): - """Run a command""" - - popen = subprocess.Popen(command, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - popen.wait() - output = popen.stdout.read() + " | " + popen.stderr.read() - popen.stdout.close() - popen.stderr.close() - self.logger.debug("Tesseract ReturnCode %s Output: %s" % (popen.returncode, output)) - - def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): - #self.logger.debug("create tmp tif") - #tmp = tempfile.NamedTemporaryFile(suffix=".tif") - tmp = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") - tmp.close() - #self.logger.debug("create tmp txt") - #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") - tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") - tmpTxt.close() - - self.logger.debug("save tiff") - self.image.save(tmp.name, 'TIFF') - - if os.name == "nt": - tessparams = [join(pypath, "tesseract", "tesseract.exe")] - else: - tessparams = ['tesseract'] - - tessparams.extend([abspath(tmp.name), abspath(tmpTxt.name).replace(".txt", "")]) - - if subset and (digits or lowercase or uppercase): - #self.logger.debug("create temp subset config") - #tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") - tmpSub = open(join("tmp", "tmpSub_%s.subset" % self.__name__), "wb") - tmpSub.write("tessedit_char_whitelist ") - if digits: - tmpSub.write("0123456789") - if lowercase: - tmpSub.write("abcdefghijklmnopqrstuvwxyz") - if uppercase: - tmpSub.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ") - tmpSub.write("\n") - tessparams.append("nobatch") - tessparams.append(abspath(tmpSub.name)) - tmpSub.close() - - self.logger.debug("run tesseract") - self.run(tessparams) - self.logger.debug("read txt") - - try: - with open(tmpTxt.name, 'r') as f: - self.result_captcha = f.read().replace("\n", "") - except: - self.result_captcha = "" - - self.logger.debug(self.result_captcha) - try: - os.remove(tmp.name) - os.remove(tmpTxt.name) - if subset and (digits or lowercase or uppercase): - os.remove(tmpSub.name) - except: - pass - - def get_captcha(self, name): - raise NotImplementedError - - def to_greyscale(self): - if self.image.mode != 'L': - self.image = self.image.convert('L') - - self.pixels = self.image.load() - - def eval_black_white(self, limit): - self.pixels = self.image.load() - w, h = self.image.size - for x in xrange(w): - for y in xrange(h): - if self.pixels[x, y] > limit: - self.pixels[x, y] = 255 - else: - self.pixels[x, y] = 0 - - def clean(self, allowed): - pixels = self.pixels - - w, h = self.image.size - - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 255: - continue - # No point in processing white pixels since we only want to remove black pixel - count = 0 - - try: - if pixels[x - 1, y - 1] != 255: - count += 1 - if pixels[x - 1, y] != 255: - count += 1 - if pixels[x - 1, y + 1] != 255: - count += 1 - if pixels[x, y + 1] != 255: - count += 1 - if pixels[x + 1, y + 1] != 255: - count += 1 - if pixels[x + 1, y] != 255: - count += 1 - if pixels[x + 1, y - 1] != 255: - count += 1 - if pixels[x, y - 1] != 255: - count += 1 - except: - pass - - # 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) - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 1: - pixels[x, y] = 255 - - self.pixels = pixels - - def derotate_by_average(self): - """rotate by checking each angle and guess most suitable""" - - w, h = self.image.size - pixels = self.pixels - - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 0: - pixels[x, y] = 155 - - highest = {} - counts = {} - - for angle in xrange(-45, 45): - - tmpimage = self.image.rotate(angle) - - pixels = tmpimage.load() - - w, h = self.image.size - - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 0: - pixels[x, y] = 255 - - count = {} - - for x in xrange(w): - count[x] = 0 - for y in xrange(h): - if pixels[x, y] == 155: - count[x] += 1 - - sum = 0 - cnt = 0 - - for x in count.values(): - if x != 0: - sum += x - cnt += 1 - - avg = sum / cnt - counts[angle] = cnt - highest[angle] = 0 - for x in count.values(): - if x > highest[angle]: - highest[angle] = x - - highest[angle] = highest[angle] - avg - - hkey = 0 - hvalue = 0 - - for key, value in highest.iteritems(): - if value > hvalue: - hkey = key - hvalue = value - - self.image = self.image.rotate(hkey) - pixels = self.image.load() - - for x in xrange(w): - for y in xrange(h): - if pixels[x, y] == 0: - pixels[x, y] = 255 - - if pixels[x, y] == 155: - pixels[x, y] = 0 - - self.pixels = pixels - - def split_captcha_letters(self): - captcha = self.image - started = False - letters = [] - width, height = captcha.size - bottomY, topY = 0, height - pixels = captcha.load() - - for x in xrange(width): - black_pixel_in_col = False - for y in xrange(height): - if pixels[x, y] != 255: - if not started: - started = True - firstX = x - lastX = x - - if y > bottomY: - bottomY = y - if y < topY: - topY = y - if x > lastX: - lastX = x - - black_pixel_in_col = True - - if black_pixel_in_col is False and started is True: - rect = (firstX, topY, lastX, bottomY) - new_captcha = captcha.crop(rect) - - w, h = new_captcha.size - if w > 5 and h > 5: - letters.append(new_captcha) - - started = False - bottomY, topY = 0, height - - return letters - - def correct(self, values, var=None): - if var: - result = var - else: - result = self.result_captcha - - for key, item in values.iteritems(): - - if key.__class__ == str: - result = result.replace(key, item) - else: - for expr in key: - result = result.replace(expr, item) - - if var: - return result - else: - self.result_captcha = result diff --git a/pyload/plugins/accounts/AlldebridCom.py b/pyload/plugins/accounts/AlldebridCom.py index 928e81fe5..71905d8ef 100644 --- a/pyload/plugins/accounts/AlldebridCom.py +++ b/pyload/plugins/accounts/AlldebridCom.py @@ -8,7 +8,7 @@ from urllib import urlencode from BeautifulSoup import BeautifulSoup -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class AlldebridCom(Account): diff --git a/pyload/plugins/accounts/BayfilesCom.py b/pyload/plugins/accounts/BayfilesCom.py index 38537da0e..221d1615d 100644 --- a/pyload/plugins/accounts/BayfilesCom.py +++ b/pyload/plugins/accounts/BayfilesCom.py @@ -2,7 +2,7 @@ from time import time -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/BitshareCom.py b/pyload/plugins/accounts/BitshareCom.py index 7a982aea5..ad44424b3 100644 --- a/pyload/plugins/accounts/BitshareCom.py +++ b/pyload/plugins/accounts/BitshareCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class BitshareCom(Account): diff --git a/pyload/plugins/accounts/CzshareCom.py b/pyload/plugins/accounts/CzshareCom.py index 584b9a3a2..d22def156 100644 --- a/pyload/plugins/accounts/CzshareCom.py +++ b/pyload/plugins/accounts/CzshareCom.py @@ -3,7 +3,7 @@ from time import mktime, strptime import re -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class CzshareCom(Account): diff --git a/pyload/plugins/accounts/DebridItaliaCom.py b/pyload/plugins/accounts/DebridItaliaCom.py index 34eb51ea6..79a98599e 100644 --- a/pyload/plugins/accounts/DebridItaliaCom.py +++ b/pyload/plugins/accounts/DebridItaliaCom.py @@ -3,7 +3,7 @@ import re import time -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class DebridItaliaCom(Account): diff --git a/pyload/plugins/accounts/DepositfilesCom.py b/pyload/plugins/accounts/DepositfilesCom.py index a17493cc1..9fc0772c4 100644 --- a/pyload/plugins/accounts/DepositfilesCom.py +++ b/pyload/plugins/accounts/DepositfilesCom.py @@ -4,7 +4,7 @@ import re from time import strptime, mktime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class DepositfilesCom(Account): diff --git a/pyload/plugins/accounts/EasybytezCom.py b/pyload/plugins/accounts/EasybytezCom.py index ef5b44e46..7634594e4 100644 --- a/pyload/plugins/accounts/EasybytezCom.py +++ b/pyload/plugins/accounts/EasybytezCom.py @@ -3,7 +3,7 @@ import re from time import mktime, strptime, gmtime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.plugins.internal.SimpleHoster import parseHtmlForm from pyload.utils import parseFileSize diff --git a/pyload/plugins/accounts/EgoFilesCom.py b/pyload/plugins/accounts/EgoFilesCom.py index 620817a45..8947d24c7 100644 --- a/pyload/plugins/accounts/EgoFilesCom.py +++ b/pyload/plugins/accounts/EgoFilesCom.py @@ -3,7 +3,7 @@ import re import time -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import parseFileSize diff --git a/pyload/plugins/accounts/EuroshareEu.py b/pyload/plugins/accounts/EuroshareEu.py index d74d4526b..7481bceac 100644 --- a/pyload/plugins/accounts/EuroshareEu.py +++ b/pyload/plugins/accounts/EuroshareEu.py @@ -3,7 +3,7 @@ from time import mktime, strptime import re -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class EuroshareEu(Account): diff --git a/pyload/plugins/accounts/FastixRu.py b/pyload/plugins/accounts/FastixRu.py index 69840fa2c..953ba0c1e 100644 --- a/pyload/plugins/accounts/FastixRu.py +++ b/pyload/plugins/accounts/FastixRu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/FastshareCz.py b/pyload/plugins/accounts/FastshareCz.py index 6e86f60fa..0feca4198 100644 --- a/pyload/plugins/accounts/FastshareCz.py +++ b/pyload/plugins/accounts/FastshareCz.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import parseFileSize diff --git a/pyload/plugins/accounts/FilecloudIo.py b/pyload/plugins/accounts/FilecloudIo.py index dc764d218..504c10be2 100644 --- a/pyload/plugins/accounts/FilecloudIo.py +++ b/pyload/plugins/accounts/FilecloudIo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/FilefactoryCom.py b/pyload/plugins/accounts/FilefactoryCom.py index 1e2115ac3..047e7bb36 100644 --- a/pyload/plugins/accounts/FilefactoryCom.py +++ b/pyload/plugins/accounts/FilefactoryCom.py @@ -5,7 +5,7 @@ from time import mktime, strptime from pycurl import REFERER -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class FilefactoryCom(Account): diff --git a/pyload/plugins/accounts/FilejungleCom.py b/pyload/plugins/accounts/FilejungleCom.py index ab52ffc04..596e928ed 100644 --- a/pyload/plugins/accounts/FilejungleCom.py +++ b/pyload/plugins/accounts/FilejungleCom.py @@ -3,7 +3,7 @@ import re from time import mktime, strptime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class FilejungleCom(Account): diff --git a/pyload/plugins/accounts/FilerNet.py b/pyload/plugins/accounts/FilerNet.py index cc2e3fd6d..67bab6ba8 100644 --- a/pyload/plugins/accounts/FilerNet.py +++ b/pyload/plugins/accounts/FilerNet.py @@ -3,7 +3,7 @@ import re import time -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import parseFileSize diff --git a/pyload/plugins/accounts/FilesMailRu.py b/pyload/plugins/accounts/FilesMailRu.py index a3ef4b348..b0375f6d2 100644 --- a/pyload/plugins/accounts/FilesMailRu.py +++ b/pyload/plugins/accounts/FilesMailRu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class FilesMailRu(Account): diff --git a/pyload/plugins/accounts/FileserveCom.py b/pyload/plugins/accounts/FileserveCom.py index 99f4430c2..ea678f87b 100644 --- a/pyload/plugins/accounts/FileserveCom.py +++ b/pyload/plugins/accounts/FileserveCom.py @@ -2,7 +2,7 @@ from time import mktime, strptime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/FourSharedCom.py b/pyload/plugins/accounts/FourSharedCom.py index 0f94c98fa..c973f4d65 100644 --- a/pyload/plugins/accounts/FourSharedCom.py +++ b/pyload/plugins/accounts/FourSharedCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/FreakshareCom.py b/pyload/plugins/accounts/FreakshareCom.py index 2484a2da1..9bc68e6b4 100644 --- a/pyload/plugins/accounts/FreakshareCom.py +++ b/pyload/plugins/accounts/FreakshareCom.py @@ -3,7 +3,7 @@ import re from time import strptime, mktime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class FreakshareCom(Account): diff --git a/pyload/plugins/accounts/FreeWayMe.py b/pyload/plugins/accounts/FreeWayMe.py index 92f99972a..c40d4486d 100644 --- a/pyload/plugins/accounts/FreeWayMe.py +++ b/pyload/plugins/accounts/FreeWayMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/FshareVn.py b/pyload/plugins/accounts/FshareVn.py index 3d664629b..6a357f4bc 100644 --- a/pyload/plugins/accounts/FshareVn.py +++ b/pyload/plugins/accounts/FshareVn.py @@ -4,7 +4,7 @@ from time import mktime, strptime from pycurl import REFERER import re -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class FshareVn(Account): diff --git a/pyload/plugins/accounts/Ftp.py b/pyload/plugins/accounts/Ftp.py index 23b637050..e331e4389 100644 --- a/pyload/plugins/accounts/Ftp.py +++ b/pyload/plugins/accounts/Ftp.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class Ftp(Account): diff --git a/pyload/plugins/accounts/HellshareCz.py b/pyload/plugins/accounts/HellshareCz.py index 34e4234f7..6b5d0a87b 100644 --- a/pyload/plugins/accounts/HellshareCz.py +++ b/pyload/plugins/accounts/HellshareCz.py @@ -3,7 +3,7 @@ import re import time -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class HellshareCz(Account): diff --git a/pyload/plugins/accounts/HotfileCom.py b/pyload/plugins/accounts/HotfileCom.py index ec164d14f..3dde85b49 100644 --- a/pyload/plugins/accounts/HotfileCom.py +++ b/pyload/plugins/accounts/HotfileCom.py @@ -3,7 +3,7 @@ from time import strptime, mktime import hashlib -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class HotfileCom(Account): diff --git a/pyload/plugins/accounts/Http.py b/pyload/plugins/accounts/Http.py index eda087c91..647af44fe 100644 --- a/pyload/plugins/accounts/Http.py +++ b/pyload/plugins/accounts/Http.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class Http(Account): diff --git a/pyload/plugins/accounts/LetitbitNet.py b/pyload/plugins/accounts/LetitbitNet.py index 93d12a975..7c43fff94 100644 --- a/pyload/plugins/accounts/LetitbitNet.py +++ b/pyload/plugins/accounts/LetitbitNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account # from pyload.utils import json_loads, json_dumps diff --git a/pyload/plugins/accounts/LinksnappyCom.py b/pyload/plugins/accounts/LinksnappyCom.py index 35fc881b0..9dc1a8b36 100644 --- a/pyload/plugins/accounts/LinksnappyCom.py +++ b/pyload/plugins/accounts/LinksnappyCom.py @@ -2,7 +2,7 @@ from hashlib import md5 -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/MegaDebridEu.py b/pyload/plugins/accounts/MegaDebridEu.py index 5ba8d3577..5c58505f3 100644 --- a/pyload/plugins/accounts/MegaDebridEu.py +++ b/pyload/plugins/accounts/MegaDebridEu.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/MegasharesCom.py b/pyload/plugins/accounts/MegasharesCom.py index 2032d0578..da0dd7ae7 100644 --- a/pyload/plugins/accounts/MegasharesCom.py +++ b/pyload/plugins/accounts/MegasharesCom.py @@ -3,7 +3,7 @@ import re from time import mktime, strptime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class MegasharesCom(Account): diff --git a/pyload/plugins/accounts/MultishareCz.py b/pyload/plugins/accounts/MultishareCz.py index 7e72ff513..fb6677a51 100644 --- a/pyload/plugins/accounts/MultishareCz.py +++ b/pyload/plugins/accounts/MultishareCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account #from time import mktime, strptime #from pycurl import REFERER import re diff --git a/pyload/plugins/accounts/MyfastfileCom.py b/pyload/plugins/accounts/MyfastfileCom.py index 2ec0ebb6d..6c90793d0 100644 --- a/pyload/plugins/accounts/MyfastfileCom.py +++ b/pyload/plugins/accounts/MyfastfileCom.py @@ -2,7 +2,7 @@ from time import time -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/NetloadIn.py b/pyload/plugins/accounts/NetloadIn.py index 988affb51..01b09c5d8 100644 --- a/pyload/plugins/accounts/NetloadIn.py +++ b/pyload/plugins/accounts/NetloadIn.py @@ -3,7 +3,7 @@ import re from time import time -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class NetloadIn(Account): diff --git a/pyload/plugins/accounts/OboomCom.py b/pyload/plugins/accounts/OboomCom.py index b281a289a..14bdd1510 100644 --- a/pyload/plugins/accounts/OboomCom.py +++ b/pyload/plugins/accounts/OboomCom.py @@ -5,7 +5,7 @@ import time from beaker.crypto.pbkdf2 import PBKDF2 from pyload.utils import json_loads -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class OboomCom(Account): diff --git a/pyload/plugins/accounts/OneFichierCom.py b/pyload/plugins/accounts/OneFichierCom.py index 36899e2a5..efb563a60 100644 --- a/pyload/plugins/accounts/OneFichierCom.py +++ b/pyload/plugins/accounts/OneFichierCom.py @@ -4,7 +4,7 @@ import re from time import strptime, mktime from pycurl import REFERER -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class OneFichierCom(Account): diff --git a/pyload/plugins/accounts/OverLoadMe.py b/pyload/plugins/accounts/OverLoadMe.py index 18a3db645..4fe59706c 100644 --- a/pyload/plugins/accounts/OverLoadMe.py +++ b/pyload/plugins/accounts/OverLoadMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/PremiumTo.py b/pyload/plugins/accounts/PremiumTo.py index 3b757bdf2..75c950263 100644 --- a/pyload/plugins/accounts/PremiumTo.py +++ b/pyload/plugins/accounts/PremiumTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class PremiumTo(Account): diff --git a/pyload/plugins/accounts/PremiumizeMe.py b/pyload/plugins/accounts/PremiumizeMe.py index ecb03afda..1beb950ae 100644 --- a/pyload/plugins/accounts/PremiumizeMe.py +++ b/pyload/plugins/accounts/PremiumizeMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/QuickshareCz.py b/pyload/plugins/accounts/QuickshareCz.py index 6abc02b1c..0d677eecb 100644 --- a/pyload/plugins/accounts/QuickshareCz.py +++ b/pyload/plugins/accounts/QuickshareCz.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import parseFileSize diff --git a/pyload/plugins/accounts/RPNetBiz.py b/pyload/plugins/accounts/RPNetBiz.py index c2b7cad21..c10122053 100644 --- a/pyload/plugins/accounts/RPNetBiz.py +++ b/pyload/plugins/accounts/RPNetBiz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/RapidgatorNet.py b/pyload/plugins/accounts/RapidgatorNet.py index c8f129c5b..2c2fd493e 100644 --- a/pyload/plugins/accounts/RapidgatorNet.py +++ b/pyload/plugins/accounts/RapidgatorNet.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/RapidshareCom.py b/pyload/plugins/accounts/RapidshareCom.py index 38db62200..9f1670cb8 100644 --- a/pyload/plugins/accounts/RapidshareCom.py +++ b/pyload/plugins/accounts/RapidshareCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class RapidshareCom(Account): diff --git a/pyload/plugins/accounts/RealdebridCom.py b/pyload/plugins/accounts/RealdebridCom.py index 1d76bb130..737f22acf 100644 --- a/pyload/plugins/accounts/RealdebridCom.py +++ b/pyload/plugins/accounts/RealdebridCom.py @@ -2,7 +2,7 @@ import xml.dom.minidom as dom -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class RealdebridCom(Account): diff --git a/pyload/plugins/accounts/RehostTo.py b/pyload/plugins/accounts/RehostTo.py index 3bda118f4..0414ad581 100644 --- a/pyload/plugins/accounts/RehostTo.py +++ b/pyload/plugins/accounts/RehostTo.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class RehostTo(Account): diff --git a/pyload/plugins/accounts/ShareRapidCom.py b/pyload/plugins/accounts/ShareRapidCom.py index 92e6c7988..2cd955bbe 100644 --- a/pyload/plugins/accounts/ShareRapidCom.py +++ b/pyload/plugins/accounts/ShareRapidCom.py @@ -3,7 +3,7 @@ import re from time import mktime, strptime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class ShareRapidCom(Account): diff --git a/pyload/plugins/accounts/ShareonlineBiz.py b/pyload/plugins/accounts/ShareonlineBiz.py index 0f6e61fab..ff0cb1c58 100644 --- a/pyload/plugins/accounts/ShareonlineBiz.py +++ b/pyload/plugins/accounts/ShareonlineBiz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class ShareonlineBiz(Account): diff --git a/pyload/plugins/accounts/SimplyPremiumCom.py b/pyload/plugins/accounts/SimplyPremiumCom.py index 3a385c477..e9126a5cb 100644 --- a/pyload/plugins/accounts/SimplyPremiumCom.py +++ b/pyload/plugins/accounts/SimplyPremiumCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.utils import json_loads -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class SimplyPremiumCom(Account): diff --git a/pyload/plugins/accounts/SimplydebridCom.py b/pyload/plugins/accounts/SimplydebridCom.py index 169b27e0b..4af8eaa31 100644 --- a/pyload/plugins/accounts/SimplydebridCom.py +++ b/pyload/plugins/accounts/SimplydebridCom.py @@ -2,7 +2,7 @@ from time import mktime, strptime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class SimplydebridCom(Account): diff --git a/pyload/plugins/accounts/StahnuTo.py b/pyload/plugins/accounts/StahnuTo.py index 9d4cc6994..ba4a3fcdd 100644 --- a/pyload/plugins/accounts/StahnuTo.py +++ b/pyload/plugins/accounts/StahnuTo.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import parseFileSize diff --git a/pyload/plugins/accounts/TurbobitNet.py b/pyload/plugins/accounts/TurbobitNet.py index d4221a97a..ba172d67e 100644 --- a/pyload/plugins/accounts/TurbobitNet.py +++ b/pyload/plugins/accounts/TurbobitNet.py @@ -3,7 +3,7 @@ import re from time import mktime, strptime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class TurbobitNet(Account): diff --git a/pyload/plugins/accounts/TusfilesNet.py b/pyload/plugins/accounts/TusfilesNet.py index 870abea08..c4d912022 100644 --- a/pyload/plugins/accounts/TusfilesNet.py +++ b/pyload/plugins/accounts/TusfilesNet.py @@ -4,7 +4,7 @@ import re from time import mktime, strptime, gmtime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.plugins.internal.SimpleHoster import parseHtmlForm from pyload.utils import parseFileSize diff --git a/pyload/plugins/accounts/UlozTo.py b/pyload/plugins/accounts/UlozTo.py index 01fb134e8..214607998 100644 --- a/pyload/plugins/accounts/UlozTo.py +++ b/pyload/plugins/accounts/UlozTo.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class UlozTo(Account): diff --git a/pyload/plugins/accounts/UnrestrictLi.py b/pyload/plugins/accounts/UnrestrictLi.py index 6e878b556..a93e88e2d 100644 --- a/pyload/plugins/accounts/UnrestrictLi.py +++ b/pyload/plugins/accounts/UnrestrictLi.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.utils import json_loads diff --git a/pyload/plugins/accounts/UploadedTo.py b/pyload/plugins/accounts/UploadedTo.py index 64bbeac6e..2ef0117f7 100644 --- a/pyload/plugins/accounts/UploadedTo.py +++ b/pyload/plugins/accounts/UploadedTo.py @@ -3,7 +3,7 @@ import re from time import time -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class UploadedTo(Account): diff --git a/pyload/plugins/accounts/UploadheroCom.py b/pyload/plugins/accounts/UploadheroCom.py index 1cb0ab698..4cea86e35 100644 --- a/pyload/plugins/accounts/UploadheroCom.py +++ b/pyload/plugins/accounts/UploadheroCom.py @@ -4,7 +4,7 @@ import re import datetime import time -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class UploadheroCom(Account): diff --git a/pyload/plugins/accounts/UploadingCom.py b/pyload/plugins/accounts/UploadingCom.py index 9ac674b71..0f7d33ec8 100644 --- a/pyload/plugins/accounts/UploadingCom.py +++ b/pyload/plugins/accounts/UploadingCom.py @@ -3,7 +3,7 @@ from time import time, strptime, mktime import re -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class UploadingCom(Account): diff --git a/pyload/plugins/accounts/YibaishiwuCom.py b/pyload/plugins/accounts/YibaishiwuCom.py index 3898c3cef..6cb595d06 100644 --- a/pyload/plugins/accounts/YibaishiwuCom.py +++ b/pyload/plugins/accounts/YibaishiwuCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class YibaishiwuCom(Account): diff --git a/pyload/plugins/accounts/ZeveraCom.py b/pyload/plugins/accounts/ZeveraCom.py index d84000359..6d70a2e6b 100644 --- a/pyload/plugins/accounts/ZeveraCom.py +++ b/pyload/plugins/accounts/ZeveraCom.py @@ -2,7 +2,7 @@ from time import mktime, strptime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account class ZeveraCom(Account): diff --git a/pyload/plugins/base/Account.py b/pyload/plugins/base/Account.py new file mode 100644 index 000000000..e338f6b26 --- /dev/null +++ b/pyload/plugins/base/Account.py @@ -0,0 +1,281 @@ +# -*- coding: utf-8 -*- + +from random import choice +from time import time +from traceback import print_exc +from threading import RLock + +from pyload.plugins.Plugin import Base +from pyload.utils import compare_time, parseFileSize, lock + + +class WrongPassword(Exception): + pass + + +class Account(Base): + """ + Base class for every Account plugin. + Just overwrite `login` and cookies will be stored and account becomes accessible in\ + associated hoster plugin. Plugin should also provide `loadAccountInfo` + """ + __name__ = "Account" + __type__ = "account" + __version__ = "0.3" + + __description__ = """Base account plugin""" + __author_name__ = "mkaay" + __author_mail__ = "mkaay@mkaay.de" + + #: 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): + Base.__init__(self, manager.core) + + self.manager = manager + self.accounts = {} + self.infos = {} # cache for account information + self.lock = RLock() + + self.timestamps = {} + self.setAccounts(accounts) + self.init() + + def init(self): + pass + + def login(self, user, data, req): + """login into account, the cookies will be saved so user can be recognized + + :param user: loginname + :param data: data dictionary + :param req: `Request` instance + """ + 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")}) + success = data['valid'] = False + except Exception, e: + self.logWarning( + _("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() + return success + + def relogin(self, user): + req = self.getAccountRequest(user) + if req: + req.cj.clear() + req.close() + if user in self.infos: + del self.infos[user] #delete old information + + return self._login(user, self.accounts[user]) + + def setAccounts(self, accounts): + self.accounts = accounts + for user, data in self.accounts.iteritems(): + 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 + if 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 + 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] + if user in self.infos: + del self.infos[user] + 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!\\ + just use it to retrieve infos in hoster plugins. see `loadAccountInfo` + + :param name: username + :param force: reloads cached account information + :return: dictionary with information + """ + data = Account.loadAccountInfo(self, name) + + if force or name not in self.infos: + self.logDebug("Get Account Info for %s" % name) + req = self.getAccountRequest(name) + + try: + infos = self.loadAccountInfo(name, req) + if not type(infos) == dict: + raise Exception("Wrong return format") + except Exception, e: + infos = {"error": str(e)} + + if req: req.close() + + self.logDebug("Account Info: %s" % infos) + + infos['timestamp'] = time() + self.infos[name] = infos + elif "timestamp" in self.infos[name] and self.infos[name][ + "timestamp"] + self.info_threshold * 60 < time(): + self.logDebug("Reached timeout for account data") + self.scheduleRefresh(name) + + data.update(self.infos[name]) + return data + + def isPremium(self, user): + info = self.getAccountInfo(user) + return info['premium'] + + def loadAccountInfo(self, name, req=None): + """this should be overwritten in account plugin,\ + and retrieving account information for user + + :param name: + :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__, + } + + 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() + if not user: + return None + + req = self.core.requestFactory.getRequest(self.__name__, user) + return req + + def getAccountCookies(self, user=None): + if not user: + user, data = self.selectAccount() + if not user: + return None + + 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 "time" in data['options'] and data['options']['time']: + time_data = "" + try: + time_data = data['options']['time'][0] + start, end = time_data.split("-") + if not compare_time(start.split(":"), end.split(":")): + continue + except: + 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']: + continue + if "trafficleft" in self.infos[user]: + if self.infos[user]['trafficleft'] == 0: + continue + + usable.append((user, data)) + + 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 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) + + 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) + + 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.login_timeout > 0 and self.timestamps[user] + self.login_timeout * 60 < time(): + self.logDebug("Reached login timeout for %s" % user) + return self.relogin(user) + else: + return True + else: + return False diff --git a/pyload/plugins/base/Container.py b/pyload/plugins/base/Container.py new file mode 100644 index 000000000..2059ae9b2 --- /dev/null +++ b/pyload/plugins/base/Container.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +import re + +from os import remove +from os.path import basename, exists + +from pyload.plugins.base.Crypter import Crypter +from pyload.utils import safe_join + + +class Container(Crypter): + __name__ = "Container" + __type__ = "container" + __version__ = "0.1" + + __pattern__ = None + + __description__ = """Base container decrypter plugin""" + __author_name__ = "mkaay" + __author_mail__ = "mkaay@mkaay.de" + + + def preprocessing(self, thread): + """prepare""" + + 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, + 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 = safe_join(self.config['general']['download_folder'], self.pyfile.name) + f = open(self.pyfile.url, "wb" ) + f.write(content) + f.close() + + else: + self.pyfile.name = basename(self.pyfile.url) + if not exists(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.")) + + + def deleteTmp(self): + if self.pyfile.name.startswith("tmp_"): + remove(self.pyfile.url) diff --git a/pyload/plugins/base/Crypter.py b/pyload/plugins/base/Crypter.py new file mode 100644 index 000000000..7bb48d607 --- /dev/null +++ b/pyload/plugins/base/Crypter.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- + +from pyload.plugins.Plugin import Plugin + + +class Crypter(Plugin): + __name__ = "Crypter" + __type__ = "crypter" + __version__ = "0.1" + + __pattern__ = None + + __description__ = """Base decrypter plugin""" + __author_name__ = "mkaay" + __author_mail__ = "mkaay@mkaay.de" + + + 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 process(self, pyfile): + """ main method """ + self.decrypt(pyfile) + self.createPackages() + + + def decrypt(self, pyfile): + raise NotImplementedError + + + def createPackages(self): + """ create new packages from self.packages """ + for pack in self.packages: + + name, links, folder = pack + + self.logDebug("Parsed package %(name)s with %(len)d links" % {"name": name, "len": len(links)}) + + links = [x.decode("utf-8") for x in links] + + pid = self.api.addPackage(name, links, self.pyfile.package().queue) + + if name != folder is not None: + self.api.setPackageData(pid, {"folder": folder}) #: Due to not break API addPackage method right now + self.logDebug("Set package %(name)s folder to %(folder)s" % {"name": name, "folder": folder}) + + if self.pyfile.package().password: + self.api.setPackageData(pid, {"password": self.pyfile.package().password}) + + if self.urls: + self.api.generateAndAddPackages(self.urls) diff --git a/pyload/plugins/base/Hook.py b/pyload/plugins/base/Hook.py new file mode 100644 index 000000000..b9ffbc647 --- /dev/null +++ b/pyload/plugins/base/Hook.py @@ -0,0 +1,149 @@ +# -*- coding: utf-8 -*- + +from traceback import print_exc + +from pyload.plugins.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" + __type__ = "hook" + __version__ = "0.2" + + __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.setup() + self.initPeriodical() + + + 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.logError(_("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 "" % 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 diff --git a/pyload/plugins/base/Hoster.py b/pyload/plugins/base/Hoster.py new file mode 100644 index 000000000..23369deec --- /dev/null +++ b/pyload/plugins/base/Hoster.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + +from pyload.plugins.Plugin import Plugin + + +def getInfo(self): + #result = [ .. (name, size, status, url) .. ] + return + + +class Hoster(Plugin): + __name__ = "Hoster" + __type__ = "hoster" + __version__ = "0.1" + + __pattern__ = None + + __description__ = """Base hoster plugin""" + __author_name__ = "mkaay" + __author_mail__ = "mkaay@mkaay.de" diff --git a/pyload/plugins/base/OCR.py b/pyload/plugins/base/OCR.py new file mode 100644 index 000000000..0991184f3 --- /dev/null +++ b/pyload/plugins/base/OCR.py @@ -0,0 +1,299 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement +import os +import logging +import subprocess + +from os.path import abspath, join +from PIL import Image +from PIL import TiffImagePlugin +from PIL import PngImagePlugin +from PIL import GifImagePlugin +from PIL import JpegImagePlugin + + +class OCR(object): + __name__ = "OCR" + __type__ = "ocr" + __version__ = "0.1" + + __description__ = """OCR base plugin""" + __author_name__ = "pyLoad Team" + __author_mail__ = "admin@pyload.org" + + + def __init__(self): + self.logger = logging.getLogger("log") + + def load_image(self, image): + self.image = Image.open(image) + self.pixels = self.image.load() + self.result_captcha = '' + + def unload(self): + """delete all tmp images""" + pass + + def threshold(self, value): + self.image = self.image.point(lambda a: a * value + 10) + + def run(self, command): + """Run a command""" + + popen = subprocess.Popen(command, bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + popen.wait() + output = popen.stdout.read() + " | " + popen.stderr.read() + popen.stdout.close() + popen.stderr.close() + self.logger.debug("Tesseract ReturnCode %s Output: %s" % (popen.returncode, output)) + + def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): + #self.logger.debug("create tmp tif") + #tmp = tempfile.NamedTemporaryFile(suffix=".tif") + tmp = open(join("tmp", "tmpTif_%s.tif" % self.__name__), "wb") + tmp.close() + #self.logger.debug("create tmp txt") + #tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt") + tmpTxt = open(join("tmp", "tmpTxt_%s.txt" % self.__name__), "wb") + tmpTxt.close() + + self.logger.debug("save tiff") + self.image.save(tmp.name, 'TIFF') + + if os.name == "nt": + tessparams = [join(pypath, "tesseract", "tesseract.exe")] + else: + tessparams = ['tesseract'] + + tessparams.extend([abspath(tmp.name), abspath(tmpTxt.name).replace(".txt", "")]) + + if subset and (digits or lowercase or uppercase): + #self.logger.debug("create temp subset config") + #tmpSub = tempfile.NamedTemporaryFile(suffix=".subset") + tmpSub = open(join("tmp", "tmpSub_%s.subset" % self.__name__), "wb") + tmpSub.write("tessedit_char_whitelist ") + if digits: + tmpSub.write("0123456789") + if lowercase: + tmpSub.write("abcdefghijklmnopqrstuvwxyz") + if uppercase: + tmpSub.write("ABCDEFGHIJKLMNOPQRSTUVWXYZ") + tmpSub.write("\n") + tessparams.append("nobatch") + tessparams.append(abspath(tmpSub.name)) + tmpSub.close() + + self.logger.debug("run tesseract") + self.run(tessparams) + self.logger.debug("read txt") + + try: + with open(tmpTxt.name, 'r') as f: + self.result_captcha = f.read().replace("\n", "") + except: + self.result_captcha = "" + + self.logger.debug(self.result_captcha) + try: + os.remove(tmp.name) + os.remove(tmpTxt.name) + if subset and (digits or lowercase or uppercase): + os.remove(tmpSub.name) + except: + pass + + def get_captcha(self, name): + raise NotImplementedError + + def to_greyscale(self): + if self.image.mode != 'L': + self.image = self.image.convert('L') + + self.pixels = self.image.load() + + def eval_black_white(self, limit): + self.pixels = self.image.load() + w, h = self.image.size + for x in xrange(w): + for y in xrange(h): + if self.pixels[x, y] > limit: + self.pixels[x, y] = 255 + else: + self.pixels[x, y] = 0 + + def clean(self, allowed): + pixels = self.pixels + + w, h = self.image.size + + for x in xrange(w): + for y in xrange(h): + if pixels[x, y] == 255: + continue + # No point in processing white pixels since we only want to remove black pixel + count = 0 + + try: + if pixels[x - 1, y - 1] != 255: + count += 1 + if pixels[x - 1, y] != 255: + count += 1 + if pixels[x - 1, y + 1] != 255: + count += 1 + if pixels[x, y + 1] != 255: + count += 1 + if pixels[x + 1, y + 1] != 255: + count += 1 + if pixels[x + 1, y] != 255: + count += 1 + if pixels[x + 1, y - 1] != 255: + count += 1 + if pixels[x, y - 1] != 255: + count += 1 + except: + pass + + # 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) + for x in xrange(w): + for y in xrange(h): + if pixels[x, y] == 1: + pixels[x, y] = 255 + + self.pixels = pixels + + def derotate_by_average(self): + """rotate by checking each angle and guess most suitable""" + + w, h = self.image.size + pixels = self.pixels + + for x in xrange(w): + for y in xrange(h): + if pixels[x, y] == 0: + pixels[x, y] = 155 + + highest = {} + counts = {} + + for angle in xrange(-45, 45): + + tmpimage = self.image.rotate(angle) + + pixels = tmpimage.load() + + w, h = self.image.size + + for x in xrange(w): + for y in xrange(h): + if pixels[x, y] == 0: + pixels[x, y] = 255 + + count = {} + + for x in xrange(w): + count[x] = 0 + for y in xrange(h): + if pixels[x, y] == 155: + count[x] += 1 + + sum = 0 + cnt = 0 + + for x in count.values(): + if x != 0: + sum += x + cnt += 1 + + avg = sum / cnt + counts[angle] = cnt + highest[angle] = 0 + for x in count.values(): + if x > highest[angle]: + highest[angle] = x + + highest[angle] = highest[angle] - avg + + hkey = 0 + hvalue = 0 + + for key, value in highest.iteritems(): + if value > hvalue: + hkey = key + hvalue = value + + self.image = self.image.rotate(hkey) + pixels = self.image.load() + + for x in xrange(w): + for y in xrange(h): + if pixels[x, y] == 0: + pixels[x, y] = 255 + + if pixels[x, y] == 155: + pixels[x, y] = 0 + + self.pixels = pixels + + def split_captcha_letters(self): + captcha = self.image + started = False + letters = [] + width, height = captcha.size + bottomY, topY = 0, height + pixels = captcha.load() + + for x in xrange(width): + black_pixel_in_col = False + for y in xrange(height): + if pixels[x, y] != 255: + if not started: + started = True + firstX = x + lastX = x + + if y > bottomY: + bottomY = y + if y < topY: + topY = y + if x > lastX: + lastX = x + + black_pixel_in_col = True + + if black_pixel_in_col is False and started is True: + rect = (firstX, topY, lastX, bottomY) + new_captcha = captcha.crop(rect) + + w, h = new_captcha.size + if w > 5 and h > 5: + letters.append(new_captcha) + + started = False + bottomY, topY = 0, height + + return letters + + def correct(self, values, var=None): + if var: + result = var + else: + result = self.result_captcha + + for key, item in values.iteritems(): + + if key.__class__ == str: + result = result.replace(key, item) + else: + for expr in key: + result = result.replace(expr, item) + + if var: + return result + else: + self.result_captcha = result diff --git a/pyload/plugins/base/__init__.py b/pyload/plugins/base/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/pyload/plugins/container/CCF.py b/pyload/plugins/container/CCF.py index 1e647b486..db6588068 100644 --- a/pyload/plugins/container/CCF.py +++ b/pyload/plugins/container/CCF.py @@ -8,7 +8,7 @@ from urllib2 import build_opener from MultipartPostHandler import MultipartPostHandler -from pyload.plugins.Container import Container +from pyload.plugins.base.Container import Container from pyload.utils import safe_join diff --git a/pyload/plugins/container/LinkList.py b/pyload/plugins/container/LinkList.py index b8941ee29..0acdd2983 100644 --- a/pyload/plugins/container/LinkList.py +++ b/pyload/plugins/container/LinkList.py @@ -2,7 +2,7 @@ import codecs -from pyload.plugins.Container import Container +from pyload.plugins.base.Container import Container from pyload.utils import fs_encode diff --git a/pyload/plugins/container/RSDF.py b/pyload/plugins/container/RSDF.py index 2b4d4c686..3175516cf 100644 --- a/pyload/plugins/container/RSDF.py +++ b/pyload/plugins/container/RSDF.py @@ -4,7 +4,7 @@ import base64 import binascii import re -from pyload.plugins.Container import Container +from pyload.plugins.base.Container import Container class RSDF(Container): diff --git a/pyload/plugins/crypter/ChipDe.py b/pyload/plugins/crypter/ChipDe.py index 0ee6adfd3..fe91b69ce 100644 --- a/pyload/plugins/crypter/ChipDe.py +++ b/pyload/plugins/crypter/ChipDe.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class ChipDe(Crypter): diff --git a/pyload/plugins/crypter/CzshareComFolder.py b/pyload/plugins/crypter/CzshareComFolder.py index 94e4f07b3..2191a04b3 100644 --- a/pyload/plugins/crypter/CzshareComFolder.py +++ b/pyload/plugins/crypter/CzshareComFolder.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class CzshareComFolder(Crypter): diff --git a/pyload/plugins/crypter/DDLMusicOrg.py b/pyload/plugins/crypter/DDLMusicOrg.py index be4a92617..52c10dc42 100644 --- a/pyload/plugins/crypter/DDLMusicOrg.py +++ b/pyload/plugins/crypter/DDLMusicOrg.py @@ -4,7 +4,7 @@ import re from time import sleep -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class DDLMusicOrg(Crypter): diff --git a/pyload/plugins/crypter/DailymotionBatch.py b/pyload/plugins/crypter/DailymotionBatch.py index 2c818d8bc..73a0ceed5 100644 --- a/pyload/plugins/crypter/DailymotionBatch.py +++ b/pyload/plugins/crypter/DailymotionBatch.py @@ -5,7 +5,7 @@ import re from urlparse import urljoin from pyload.utils import json_loads -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter from pyload.utils import safe_join diff --git a/pyload/plugins/crypter/Dereferer.py b/pyload/plugins/crypter/Dereferer.py index 6a7ac8c67..90288fb59 100644 --- a/pyload/plugins/crypter/Dereferer.py +++ b/pyload/plugins/crypter/Dereferer.py @@ -4,7 +4,7 @@ import re from urllib import unquote -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class Dereferer(Crypter): diff --git a/pyload/plugins/crypter/DontKnowMe.py b/pyload/plugins/crypter/DontKnowMe.py index b16992b27..5d048994e 100644 --- a/pyload/plugins/crypter/DontKnowMe.py +++ b/pyload/plugins/crypter/DontKnowMe.py @@ -4,7 +4,7 @@ import re from urllib import unquote -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class DontKnowMe(Crypter): diff --git a/pyload/plugins/crypter/DuckCryptInfo.py b/pyload/plugins/crypter/DuckCryptInfo.py index 6c720297d..450fc867a 100644 --- a/pyload/plugins/crypter/DuckCryptInfo.py +++ b/pyload/plugins/crypter/DuckCryptInfo.py @@ -4,7 +4,7 @@ import re from BeautifulSoup import BeautifulSoup -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class DuckCryptInfo(Crypter): diff --git a/pyload/plugins/crypter/EmbeduploadCom.py b/pyload/plugins/crypter/EmbeduploadCom.py index 476767f94..0200d4468 100644 --- a/pyload/plugins/crypter/EmbeduploadCom.py +++ b/pyload/plugins/crypter/EmbeduploadCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter from pyload.network.HTTPRequest import BadHeader diff --git a/pyload/plugins/crypter/FileserveComFolder.py b/pyload/plugins/crypter/FileserveComFolder.py index 52e1df6b4..0a6232603 100644 --- a/pyload/plugins/crypter/FileserveComFolder.py +++ b/pyload/plugins/crypter/FileserveComFolder.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class FileserveComFolder(Crypter): diff --git a/pyload/plugins/crypter/FourChanOrg.py b/pyload/plugins/crypter/FourChanOrg.py index 2d3bfa07a..4762f5d1d 100644 --- a/pyload/plugins/crypter/FourChanOrg.py +++ b/pyload/plugins/crypter/FourChanOrg.py @@ -4,7 +4,7 @@ import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class FourChanOrg(Crypter): diff --git a/pyload/plugins/crypter/GooGl.py b/pyload/plugins/crypter/GooGl.py index 7ede17563..0e89c5bad 100644 --- a/pyload/plugins/crypter/GooGl.py +++ b/pyload/plugins/crypter/GooGl.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter from pyload.utils import json_loads diff --git a/pyload/plugins/crypter/HoerbuchIn.py b/pyload/plugins/crypter/HoerbuchIn.py index fa8e1dc34..2c72eef27 100644 --- a/pyload/plugins/crypter/HoerbuchIn.py +++ b/pyload/plugins/crypter/HoerbuchIn.py @@ -4,7 +4,7 @@ import re from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class HoerbuchIn(Crypter): diff --git a/pyload/plugins/crypter/HotfileFolderCom.py b/pyload/plugins/crypter/HotfileFolderCom.py index 1b5ce28b6..21d086302 100644 --- a/pyload/plugins/crypter/HotfileFolderCom.py +++ b/pyload/plugins/crypter/HotfileFolderCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class HotfileFolderCom(Crypter): diff --git a/pyload/plugins/crypter/LetitbitNetFolder.py b/pyload/plugins/crypter/LetitbitNetFolder.py index b03ea27b2..b5a48a949 100644 --- a/pyload/plugins/crypter/LetitbitNetFolder.py +++ b/pyload/plugins/crypter/LetitbitNetFolder.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class LetitbitNetFolder(Crypter): diff --git a/pyload/plugins/crypter/LinkSaveIn.py b/pyload/plugins/crypter/LinkSaveIn.py index 7aac1475b..fcc526092 100644 --- a/pyload/plugins/crypter/LinkSaveIn.py +++ b/pyload/plugins/crypter/LinkSaveIn.py @@ -8,7 +8,7 @@ import binascii import re from Crypto.Cipher import AES -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter from pyload.utils import html_unescape diff --git a/pyload/plugins/crypter/LinkdecrypterCom.py b/pyload/plugins/crypter/LinkdecrypterCom.py index a8429b579..d2c24b753 100644 --- a/pyload/plugins/crypter/LinkdecrypterCom.py +++ b/pyload/plugins/crypter/LinkdecrypterCom.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class LinkdecrypterCom(Crypter): diff --git a/pyload/plugins/crypter/LixIn.py b/pyload/plugins/crypter/LixIn.py index 5bfbd637e..63d1e1869 100644 --- a/pyload/plugins/crypter/LixIn.py +++ b/pyload/plugins/crypter/LixIn.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class LixIn(Crypter): diff --git a/pyload/plugins/crypter/MediafireComFolder.py b/pyload/plugins/crypter/MediafireComFolder.py index 1035d68f7..d8785a7cf 100644 --- a/pyload/plugins/crypter/MediafireComFolder.py +++ b/pyload/plugins/crypter/MediafireComFolder.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter from pyload.plugins.hoster.MediafireCom import checkHTMLHeader from pyload.utils import json_loads diff --git a/pyload/plugins/crypter/MultiloadCz.py b/pyload/plugins/crypter/MultiloadCz.py index be7950e98..37d0a1663 100644 --- a/pyload/plugins/crypter/MultiloadCz.py +++ b/pyload/plugins/crypter/MultiloadCz.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class MultiloadCz(Crypter): diff --git a/pyload/plugins/crypter/NCryptIn.py b/pyload/plugins/crypter/NCryptIn.py index 0e3043290..3289bddad 100644 --- a/pyload/plugins/crypter/NCryptIn.py +++ b/pyload/plugins/crypter/NCryptIn.py @@ -6,7 +6,7 @@ import re from Crypto.Cipher import AES -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter from pyload.plugins.internal.CaptchaService import ReCaptcha diff --git a/pyload/plugins/crypter/OneKhDe.py b/pyload/plugins/crypter/OneKhDe.py index 4f3ab2a20..4f5592fb8 100644 --- a/pyload/plugins/crypter/OneKhDe.py +++ b/pyload/plugins/crypter/OneKhDe.py @@ -3,7 +3,7 @@ import re from pyload.utils import html_unescape -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class OneKhDe(Crypter): diff --git a/pyload/plugins/crypter/QuickshareCzFolder.py b/pyload/plugins/crypter/QuickshareCzFolder.py index 5d99cbffd..1e4adec2c 100644 --- a/pyload/plugins/crypter/QuickshareCzFolder.py +++ b/pyload/plugins/crypter/QuickshareCzFolder.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class QuickshareCzFolder(Crypter): diff --git a/pyload/plugins/crypter/RelinkUs.py b/pyload/plugins/crypter/RelinkUs.py index 5a56edc4d..2c48f2078 100644 --- a/pyload/plugins/crypter/RelinkUs.py +++ b/pyload/plugins/crypter/RelinkUs.py @@ -6,7 +6,7 @@ import re import os from Crypto.Cipher import AES -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class RelinkUs(Crypter): diff --git a/pyload/plugins/crypter/SafelinkingNet.py b/pyload/plugins/crypter/SafelinkingNet.py index 9c68ba915..4129efca3 100644 --- a/pyload/plugins/crypter/SafelinkingNet.py +++ b/pyload/plugins/crypter/SafelinkingNet.py @@ -7,7 +7,7 @@ from pycurl import FOLLOWLOCATION from BeautifulSoup import BeautifulSoup from pyload.utils import json_loads -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter from pyload.plugins.internal.CaptchaService import SolveMedia diff --git a/pyload/plugins/crypter/ShareLinksBiz.py b/pyload/plugins/crypter/ShareLinksBiz.py index 94e144e74..75c3db302 100644 --- a/pyload/plugins/crypter/ShareLinksBiz.py +++ b/pyload/plugins/crypter/ShareLinksBiz.py @@ -5,7 +5,7 @@ import binascii import re from Crypto.Cipher import AES -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class ShareLinksBiz(Crypter): diff --git a/pyload/plugins/crypter/UlozToFolder.py b/pyload/plugins/crypter/UlozToFolder.py index 2cc440a5d..5d302f58f 100644 --- a/pyload/plugins/crypter/UlozToFolder.py +++ b/pyload/plugins/crypter/UlozToFolder.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class UlozToFolder(Crypter): diff --git a/pyload/plugins/crypter/XupPl.py b/pyload/plugins/crypter/XupPl.py index 8d09e28a3..9a5f99e5a 100644 --- a/pyload/plugins/crypter/XupPl.py +++ b/pyload/plugins/crypter/XupPl.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter class XupPl(Crypter): diff --git a/pyload/plugins/crypter/YoutubeBatch.py b/pyload/plugins/crypter/YoutubeBatch.py index bc72e04ea..5ed0a7abf 100644 --- a/pyload/plugins/crypter/YoutubeBatch.py +++ b/pyload/plugins/crypter/YoutubeBatch.py @@ -5,7 +5,7 @@ import re from urlparse import urljoin from pyload.utils import json_loads -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter from pyload.utils import safe_join API_URL = "AIzaSyCKnWLNlkX-L4oD1aEzqqhRw1zczeD6_k0" diff --git a/pyload/plugins/hooks/BypassCaptcha.py b/pyload/plugins/hooks/BypassCaptcha.py index 0f16d0b06..fdd1e567c 100644 --- a/pyload/plugins/hooks/BypassCaptcha.py +++ b/pyload/plugins/hooks/BypassCaptcha.py @@ -5,7 +5,7 @@ from thread import start_new_thread from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getURL, getRequest -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class BypassCaptchaException(Exception): diff --git a/pyload/plugins/hooks/Captcha9kw.py b/pyload/plugins/hooks/Captcha9kw.py index f8de28710..45890815c 100644 --- a/pyload/plugins/hooks/Captcha9kw.py +++ b/pyload/plugins/hooks/Captcha9kw.py @@ -9,7 +9,7 @@ from thread import start_new_thread from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getURL -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class Captcha9kw(Hook): diff --git a/pyload/plugins/hooks/CaptchaBrotherhood.py b/pyload/plugins/hooks/CaptchaBrotherhood.py index 478a08cc5..8f6f8d68b 100644 --- a/pyload/plugins/hooks/CaptchaBrotherhood.py +++ b/pyload/plugins/hooks/CaptchaBrotherhood.py @@ -11,7 +11,7 @@ from time import sleep from urllib import urlencode from pyload.network.RequestFactory import getURL, getRequest -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class CaptchaBrotherhoodException(Exception): diff --git a/pyload/plugins/hooks/Checksum.py b/pyload/plugins/hooks/Checksum.py index 31d0cbf8c..ae9ee1325 100644 --- a/pyload/plugins/hooks/Checksum.py +++ b/pyload/plugins/hooks/Checksum.py @@ -9,7 +9,7 @@ import zlib from os import remove from os.path import getsize, isfile, splitext -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook from pyload.utils import safe_join, fs_encode diff --git a/pyload/plugins/hooks/ClickAndLoad.py b/pyload/plugins/hooks/ClickAndLoad.py index 501845840..ede970ee8 100644 --- a/pyload/plugins/hooks/ClickAndLoad.py +++ b/pyload/plugins/hooks/ClickAndLoad.py @@ -3,7 +3,7 @@ import socket import thread -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class ClickAndLoad(Hook): diff --git a/pyload/plugins/hooks/DeathByCaptcha.py b/pyload/plugins/hooks/DeathByCaptcha.py index f2bae4848..6e7a585ad 100644 --- a/pyload/plugins/hooks/DeathByCaptcha.py +++ b/pyload/plugins/hooks/DeathByCaptcha.py @@ -12,7 +12,7 @@ from time import sleep from pyload.utils import json_loads from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getRequest -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class DeathByCaptchaException(Exception): diff --git a/pyload/plugins/hooks/DeleteFinished.py b/pyload/plugins/hooks/DeleteFinished.py index 4b22c7fed..6da42c4e3 100644 --- a/pyload/plugins/hooks/DeleteFinished.py +++ b/pyload/plugins/hooks/DeleteFinished.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.database import style -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class DeleteFinished(Hook): diff --git a/pyload/plugins/hooks/DownloadScheduler.py b/pyload/plugins/hooks/DownloadScheduler.py index c5caee35d..8336953ee 100644 --- a/pyload/plugins/hooks/DownloadScheduler.py +++ b/pyload/plugins/hooks/DownloadScheduler.py @@ -4,7 +4,7 @@ import re from time import localtime -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class DownloadScheduler(Hook): diff --git a/pyload/plugins/hooks/Ev0InFetcher.py b/pyload/plugins/hooks/Ev0InFetcher.py index cd7314fc9..0df65ceb6 100644 --- a/pyload/plugins/hooks/Ev0InFetcher.py +++ b/pyload/plugins/hooks/Ev0InFetcher.py @@ -4,7 +4,7 @@ import feedparser from time import mktime, time -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class Ev0InFetcher(Hook): diff --git a/pyload/plugins/hooks/ExpertDecoders.py b/pyload/plugins/hooks/ExpertDecoders.py index 292c84b7c..3f0f64f1e 100644 --- a/pyload/plugins/hooks/ExpertDecoders.py +++ b/pyload/plugins/hooks/ExpertDecoders.py @@ -9,7 +9,7 @@ from uuid import uuid4 from pyload.network.HTTPRequest import BadHeader from pyload.network.RequestFactory import getURL, getRequest -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class ExpertDecoders(Hook): diff --git a/pyload/plugins/hooks/ExternalScripts.py b/pyload/plugins/hooks/ExternalScripts.py index 3b32b5068..edf2139f7 100644 --- a/pyload/plugins/hooks/ExternalScripts.py +++ b/pyload/plugins/hooks/ExternalScripts.py @@ -6,7 +6,7 @@ from itertools import chain from os import listdir, access, X_OK, makedirs from os.path import join, exists, basename, abspath -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook from pyload.utils import safe_join diff --git a/pyload/plugins/hooks/ExtractArchive.py b/pyload/plugins/hooks/ExtractArchive.py index 8d6f09172..92db9ce04 100644 --- a/pyload/plugins/hooks/ExtractArchive.py +++ b/pyload/plugins/hooks/ExtractArchive.py @@ -47,7 +47,7 @@ if os.name != "nt": from os import chown from pwd import getpwnam -from pyload.plugins.Hook import Hook, threaded, Expose +from pyload.plugins.base.Hook import Hook, threaded, Expose from pyload.plugins.internal.AbstractExtractor import ArchiveError, CRCError, WrongPassword from pyload.utils import safe_join, fs_encode diff --git a/pyload/plugins/hooks/HotFolder.py b/pyload/plugins/hooks/HotFolder.py index f76e95af4..140e6d4a8 100644 --- a/pyload/plugins/hooks/HotFolder.py +++ b/pyload/plugins/hooks/HotFolder.py @@ -6,7 +6,7 @@ from os import listdir, makedirs from os.path import exists, isfile, join from shutil import move -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class HotFolder(Hook): diff --git a/pyload/plugins/hooks/IRCInterface.py b/pyload/plugins/hooks/IRCInterface.py index 99ac20acb..04ae87b05 100644 --- a/pyload/plugins/hooks/IRCInterface.py +++ b/pyload/plugins/hooks/IRCInterface.py @@ -12,7 +12,7 @@ from traceback import print_exc from pyload.api import PackageDoesNotExists, FileDoesNotExists from pyload.network.RequestFactory import getURL -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook from pyload.utils import formatSize diff --git a/pyload/plugins/hooks/ImageTyperz.py b/pyload/plugins/hooks/ImageTyperz.py index 8d2fb2006..7317f234d 100644 --- a/pyload/plugins/hooks/ImageTyperz.py +++ b/pyload/plugins/hooks/ImageTyperz.py @@ -9,7 +9,7 @@ from pycurl import FORM_FILE, LOW_SPEED_TIME from thread import start_new_thread from pyload.network.RequestFactory import getURL, getRequest -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class ImageTyperzException(Exception): diff --git a/pyload/plugins/hooks/LinkdecrypterCom.py b/pyload/plugins/hooks/LinkdecrypterCom.py index cb7ab9da5..418ec4ac4 100644 --- a/pyload/plugins/hooks/LinkdecrypterCom.py +++ b/pyload/plugins/hooks/LinkdecrypterCom.py @@ -3,7 +3,7 @@ import re from pyload.network.RequestFactory import getURL -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook from pyload.utils import remove_chars diff --git a/pyload/plugins/hooks/MergeFiles.py b/pyload/plugins/hooks/MergeFiles.py index 540ebafdc..5a39cef65 100644 --- a/pyload/plugins/hooks/MergeFiles.py +++ b/pyload/plugins/hooks/MergeFiles.py @@ -4,7 +4,7 @@ import os import re import traceback -from pyload.plugins.Hook import Hook, threaded +from pyload.plugins.base.Hook import Hook, threaded from pyload.utils import safe_join, fs_encode diff --git a/pyload/plugins/hooks/MultiHome.py b/pyload/plugins/hooks/MultiHome.py index 968214b5c..771c3549b 100644 --- a/pyload/plugins/hooks/MultiHome.py +++ b/pyload/plugins/hooks/MultiHome.py @@ -2,7 +2,7 @@ from time import time -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class MultiHome(Hook): diff --git a/pyload/plugins/hooks/RestartFailed.py b/pyload/plugins/hooks/RestartFailed.py index 8bad74620..e1a11db3f 100644 --- a/pyload/plugins/hooks/RestartFailed.py +++ b/pyload/plugins/hooks/RestartFailed.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class RestartFailed(Hook): diff --git a/pyload/plugins/hooks/UnSkipOnFail.py b/pyload/plugins/hooks/UnSkipOnFail.py index 40b0233f5..5d2db34ae 100644 --- a/pyload/plugins/hooks/UnSkipOnFail.py +++ b/pyload/plugins/hooks/UnSkipOnFail.py @@ -3,7 +3,7 @@ from os.path import basename from pyload.datatypes.PyFile import PyFile -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook from pyload.utils import fs_encode diff --git a/pyload/plugins/hooks/WindowsPhoneToastNotify.py b/pyload/plugins/hooks/WindowsPhoneToastNotify.py index 79812cefa..968b3ffa5 100644 --- a/pyload/plugins/hooks/WindowsPhoneToastNotify.py +++ b/pyload/plugins/hooks/WindowsPhoneToastNotify.py @@ -3,7 +3,7 @@ import httplib import time -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class WindowsPhoneToastNotify(Hook): diff --git a/pyload/plugins/hooks/XFileSharingPro.py b/pyload/plugins/hooks/XFileSharingPro.py index 635d5302b..e926d6655 100644 --- a/pyload/plugins/hooks/XFileSharingPro.py +++ b/pyload/plugins/hooks/XFileSharingPro.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook class XFileSharingPro(Hook): diff --git a/pyload/plugins/hoster/AlldebridCom.py b/pyload/plugins/hoster/AlldebridCom.py index ecf53701b..75257f401 100644 --- a/pyload/plugins/hoster/AlldebridCom.py +++ b/pyload/plugins/hoster/AlldebridCom.py @@ -6,7 +6,7 @@ from random import randrange from urllib import unquote from pyload.utils import json_loads -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import parseFileSize diff --git a/pyload/plugins/hoster/BasePlugin.py b/pyload/plugins/hoster/BasePlugin.py index 3fdd0348d..75780b864 100644 --- a/pyload/plugins/hoster/BasePlugin.py +++ b/pyload/plugins/hoster/BasePlugin.py @@ -6,7 +6,7 @@ from urllib import unquote from urlparse import urlparse from pyload.network.HTTPRequest import BadHeader -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import html_unescape, remove_chars diff --git a/pyload/plugins/hoster/DailymotionCom.py b/pyload/plugins/hoster/DailymotionCom.py index 5692fa652..450b0e4c3 100644 --- a/pyload/plugins/hoster/DailymotionCom.py +++ b/pyload/plugins/hoster/DailymotionCom.py @@ -5,7 +5,7 @@ import re from pyload.datatypes.PyFile import statusMap from pyload.utils import json_loads from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster def getInfo(urls): diff --git a/pyload/plugins/hoster/DebridItaliaCom.py b/pyload/plugins/hoster/DebridItaliaCom.py index 74879e6e5..c9332e6bb 100644 --- a/pyload/plugins/hoster/DebridItaliaCom.py +++ b/pyload/plugins/hoster/DebridItaliaCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class DebridItaliaCom(Hoster): diff --git a/pyload/plugins/hoster/FastixRu.py b/pyload/plugins/hoster/FastixRu.py index cb0cdb278..7bcbec149 100644 --- a/pyload/plugins/hoster/FastixRu.py +++ b/pyload/plugins/hoster/FastixRu.py @@ -6,7 +6,7 @@ from random import randrange from urllib import unquote from pyload.utils import json_loads -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class FastixRu(Hoster): diff --git a/pyload/plugins/hoster/FilesMailRu.py b/pyload/plugins/hoster/FilesMailRu.py index 01d9c256a..a900d58b4 100644 --- a/pyload/plugins/hoster/FilesMailRu.py +++ b/pyload/plugins/hoster/FilesMailRu.py @@ -3,7 +3,7 @@ import re from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.plugins.Plugin import chunks diff --git a/pyload/plugins/hoster/FileserveCom.py b/pyload/plugins/hoster/FileserveCom.py index 367545618..77c1b435f 100644 --- a/pyload/plugins/hoster/FileserveCom.py +++ b/pyload/plugins/hoster/FileserveCom.py @@ -4,7 +4,7 @@ import re from pyload.utils import json_loads from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.plugins.Plugin import chunks from pyload.plugins.hoster.UnrestrictLi import secondsToMidnight from pyload.plugins.internal.CaptchaService import ReCaptcha diff --git a/pyload/plugins/hoster/FileshareInUa.py b/pyload/plugins/hoster/FileshareInUa.py index 162217de2..83cf2dd8b 100644 --- a/pyload/plugins/hoster/FileshareInUa.py +++ b/pyload/plugins/hoster/FileshareInUa.py @@ -3,7 +3,7 @@ import re from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import parseFileSize diff --git a/pyload/plugins/hoster/FreakshareCom.py b/pyload/plugins/hoster/FreakshareCom.py index 979b3c5f2..f58d72980 100644 --- a/pyload/plugins/hoster/FreakshareCom.py +++ b/pyload/plugins/hoster/FreakshareCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.plugins.hoster.UnrestrictLi import secondsToMidnight from pyload.plugins.internal.CaptchaService import ReCaptcha diff --git a/pyload/plugins/hoster/FreeWayMe.py b/pyload/plugins/hoster/FreeWayMe.py index 392430791..2c23ac6de 100644 --- a/pyload/plugins/hoster/FreeWayMe.py +++ b/pyload/plugins/hoster/FreeWayMe.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class FreeWayMe(Hoster): diff --git a/pyload/plugins/hoster/Ftp.py b/pyload/plugins/hoster/Ftp.py index 641d93276..d51907a1a 100644 --- a/pyload/plugins/hoster/Ftp.py +++ b/pyload/plugins/hoster/Ftp.py @@ -6,7 +6,7 @@ import re from urllib import quote, unquote from urlparse import urlparse -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class Ftp(Hoster): diff --git a/pyload/plugins/hoster/GamefrontCom.py b/pyload/plugins/hoster/GamefrontCom.py index 5d88fc0db..2a358dff3 100644 --- a/pyload/plugins/hoster/GamefrontCom.py +++ b/pyload/plugins/hoster/GamefrontCom.py @@ -3,7 +3,7 @@ import re from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import parseFileSize diff --git a/pyload/plugins/hoster/LinksnappyCom.py b/pyload/plugins/hoster/LinksnappyCom.py index 54c6c0ecb..32da0adab 100644 --- a/pyload/plugins/hoster/LinksnappyCom.py +++ b/pyload/plugins/hoster/LinksnappyCom.py @@ -5,7 +5,7 @@ import re from urlparse import urlsplit from pyload.utils import json_loads, json_dumps -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class LinksnappyCom(Hoster): diff --git a/pyload/plugins/hoster/MegaDebridEu.py b/pyload/plugins/hoster/MegaDebridEu.py index ed3747aed..82fde28e9 100644 --- a/pyload/plugins/hoster/MegaDebridEu.py +++ b/pyload/plugins/hoster/MegaDebridEu.py @@ -5,7 +5,7 @@ import re from urllib import unquote_plus from pyload.utils import json_loads -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class MegaDebridEu(Hoster): diff --git a/pyload/plugins/hoster/MegaNz.py b/pyload/plugins/hoster/MegaNz.py index 2e70b5dc6..e01bc2cb7 100644 --- a/pyload/plugins/hoster/MegaNz.py +++ b/pyload/plugins/hoster/MegaNz.py @@ -10,7 +10,7 @@ from base64 import standard_b64decode from os import remove from pyload.utils import json_loads, json_dumps -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class MegaNz(Hoster): diff --git a/pyload/plugins/hoster/MyfastfileCom.py b/pyload/plugins/hoster/MyfastfileCom.py index 604e2ab06..b3ef02186 100644 --- a/pyload/plugins/hoster/MyfastfileCom.py +++ b/pyload/plugins/hoster/MyfastfileCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import json_loads diff --git a/pyload/plugins/hoster/MyvideoDe.py b/pyload/plugins/hoster/MyvideoDe.py index 06cfb9c63..556444708 100644 --- a/pyload/plugins/hoster/MyvideoDe.py +++ b/pyload/plugins/hoster/MyvideoDe.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import html_unescape diff --git a/pyload/plugins/hoster/NetloadIn.py b/pyload/plugins/hoster/NetloadIn.py index 949b1aa92..187d2a504 100644 --- a/pyload/plugins/hoster/NetloadIn.py +++ b/pyload/plugins/hoster/NetloadIn.py @@ -5,7 +5,7 @@ import re from time import sleep, time from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.plugins.Plugin import chunks diff --git a/pyload/plugins/hoster/OboomCom.py b/pyload/plugins/hoster/OboomCom.py index 1571e8bd6..19e3d2ad4 100644 --- a/pyload/plugins/hoster/OboomCom.py +++ b/pyload/plugins/hoster/OboomCom.py @@ -6,7 +6,7 @@ import re from pyload.utils import json_loads -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.plugins.internal.CaptchaService import ReCaptcha diff --git a/pyload/plugins/hoster/OverLoadMe.py b/pyload/plugins/hoster/OverLoadMe.py index e27972fc2..180e2406e 100644 --- a/pyload/plugins/hoster/OverLoadMe.py +++ b/pyload/plugins/hoster/OverLoadMe.py @@ -6,7 +6,7 @@ from random import randrange from urllib import unquote from pyload.utils import json_loads -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import parseFileSize diff --git a/pyload/plugins/hoster/PornhostCom.py b/pyload/plugins/hoster/PornhostCom.py index 802557873..621f52702 100644 --- a/pyload/plugins/hoster/PornhostCom.py +++ b/pyload/plugins/hoster/PornhostCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class PornhostCom(Hoster): diff --git a/pyload/plugins/hoster/PornhubCom.py b/pyload/plugins/hoster/PornhubCom.py index 5236fe09a..49f519dc6 100644 --- a/pyload/plugins/hoster/PornhubCom.py +++ b/pyload/plugins/hoster/PornhubCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class PornhubCom(Hoster): diff --git a/pyload/plugins/hoster/PremiumTo.py b/pyload/plugins/hoster/PremiumTo.py index c0a2868d9..ee7da65b2 100644 --- a/pyload/plugins/hoster/PremiumTo.py +++ b/pyload/plugins/hoster/PremiumTo.py @@ -4,7 +4,7 @@ from os import remove from os.path import exists from urllib import quote -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import fs_encode diff --git a/pyload/plugins/hoster/PremiumizeMe.py b/pyload/plugins/hoster/PremiumizeMe.py index 45c011084..cf08e810f 100644 --- a/pyload/plugins/hoster/PremiumizeMe.py +++ b/pyload/plugins/hoster/PremiumizeMe.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from pyload.utils import json_loads -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class PremiumizeMe(Hoster): diff --git a/pyload/plugins/hoster/RPNetBiz.py b/pyload/plugins/hoster/RPNetBiz.py index 8a7bec097..5f213b330 100644 --- a/pyload/plugins/hoster/RPNetBiz.py +++ b/pyload/plugins/hoster/RPNetBiz.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import json_loads diff --git a/pyload/plugins/hoster/RapidshareCom.py b/pyload/plugins/hoster/RapidshareCom.py index fefa06fd7..37547443e 100644 --- a/pyload/plugins/hoster/RapidshareCom.py +++ b/pyload/plugins/hoster/RapidshareCom.py @@ -3,7 +3,7 @@ import re from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster def getInfo(urls): diff --git a/pyload/plugins/hoster/RealdebridCom.py b/pyload/plugins/hoster/RealdebridCom.py index 08f7b9329..bf7f91e21 100644 --- a/pyload/plugins/hoster/RealdebridCom.py +++ b/pyload/plugins/hoster/RealdebridCom.py @@ -7,7 +7,7 @@ from urllib import quote, unquote from time import time from pyload.utils import json_loads -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import parseFileSize diff --git a/pyload/plugins/hoster/RedtubeCom.py b/pyload/plugins/hoster/RedtubeCom.py index 9f5d2d0d9..814fe4ad3 100644 --- a/pyload/plugins/hoster/RedtubeCom.py +++ b/pyload/plugins/hoster/RedtubeCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import html_unescape diff --git a/pyload/plugins/hoster/RehostTo.py b/pyload/plugins/hoster/RehostTo.py index d3d3fcd8b..9b708a9d5 100644 --- a/pyload/plugins/hoster/RehostTo.py +++ b/pyload/plugins/hoster/RehostTo.py @@ -2,7 +2,7 @@ from urllib import quote, unquote -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class RehostTo(Hoster): diff --git a/pyload/plugins/hoster/ShareonlineBiz.py b/pyload/plugins/hoster/ShareonlineBiz.py index b1d9ae5cb..15898e797 100644 --- a/pyload/plugins/hoster/ShareonlineBiz.py +++ b/pyload/plugins/hoster/ShareonlineBiz.py @@ -5,7 +5,7 @@ import re from time import time from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.plugins.Plugin import chunks from pyload.plugins.internal.CaptchaService import ReCaptcha diff --git a/pyload/plugins/hoster/ShareplaceCom.py b/pyload/plugins/hoster/ShareplaceCom.py index 60bb596cc..d5ef86ae2 100644 --- a/pyload/plugins/hoster/ShareplaceCom.py +++ b/pyload/plugins/hoster/ShareplaceCom.py @@ -4,7 +4,7 @@ import re from urllib import unquote -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class ShareplaceCom(Hoster): diff --git a/pyload/plugins/hoster/SimplyPremiumCom.py b/pyload/plugins/hoster/SimplyPremiumCom.py index 760b7ff1b..9a460b13e 100644 --- a/pyload/plugins/hoster/SimplyPremiumCom.py +++ b/pyload/plugins/hoster/SimplyPremiumCom.py @@ -4,7 +4,7 @@ import re from datetime import datetime, timedelta -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.plugins.hoster.UnrestrictLi import secondsToMidnight diff --git a/pyload/plugins/hoster/SimplydebridCom.py b/pyload/plugins/hoster/SimplydebridCom.py index c6b03c124..66f7149b4 100644 --- a/pyload/plugins/hoster/SimplydebridCom.py +++ b/pyload/plugins/hoster/SimplydebridCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class SimplydebridCom(Hoster): diff --git a/pyload/plugins/hoster/SoundcloudCom.py b/pyload/plugins/hoster/SoundcloudCom.py index afe8eaf62..bf8555439 100644 --- a/pyload/plugins/hoster/SoundcloudCom.py +++ b/pyload/plugins/hoster/SoundcloudCom.py @@ -3,7 +3,7 @@ import pycurl import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class SoundcloudCom(Hoster): diff --git a/pyload/plugins/hoster/StreamCz.py b/pyload/plugins/hoster/StreamCz.py index 7b20049be..27325e9f1 100644 --- a/pyload/plugins/hoster/StreamCz.py +++ b/pyload/plugins/hoster/StreamCz.py @@ -3,7 +3,7 @@ import re from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster def getInfo(urls): diff --git a/pyload/plugins/hoster/UnrestrictLi.py b/pyload/plugins/hoster/UnrestrictLi.py index c0c1e3965..c0d6ddaaa 100644 --- a/pyload/plugins/hoster/UnrestrictLi.py +++ b/pyload/plugins/hoster/UnrestrictLi.py @@ -5,7 +5,7 @@ import re from datetime import datetime, timedelta from pyload.utils import json_loads -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster def secondsToMidnight(gmt=0): diff --git a/pyload/plugins/hoster/UploadedTo.py b/pyload/plugins/hoster/UploadedTo.py index 694a053eb..a72a0c1cb 100644 --- a/pyload/plugins/hoster/UploadedTo.py +++ b/pyload/plugins/hoster/UploadedTo.py @@ -9,7 +9,7 @@ import re from time import sleep from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.plugins.Plugin import chunks from pyload.plugins.internal.CaptchaService import ReCaptcha from pyload.utils import html_unescape, parseFileSize diff --git a/pyload/plugins/hoster/VeehdCom.py b/pyload/plugins/hoster/VeehdCom.py index 8a882a932..429ef8e1b 100644 --- a/pyload/plugins/hoster/VeehdCom.py +++ b/pyload/plugins/hoster/VeehdCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class VeehdCom(Hoster): diff --git a/pyload/plugins/hoster/XHamsterCom.py b/pyload/plugins/hoster/XHamsterCom.py index aa406cc45..77697281d 100644 --- a/pyload/plugins/hoster/XHamsterCom.py +++ b/pyload/plugins/hoster/XHamsterCom.py @@ -5,7 +5,7 @@ import re from urllib import unquote from pyload.utils import json_loads -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster def clean_json(json_expr): diff --git a/pyload/plugins/hoster/XVideosCom.py b/pyload/plugins/hoster/XVideosCom.py index 75162955a..c3e555065 100644 --- a/pyload/plugins/hoster/XVideosCom.py +++ b/pyload/plugins/hoster/XVideosCom.py @@ -4,7 +4,7 @@ import re from urllib import unquote -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class XVideosCom(Hoster): diff --git a/pyload/plugins/hoster/Xdcc.py b/pyload/plugins/hoster/Xdcc.py index 8b427cfdc..ba798d2c2 100644 --- a/pyload/plugins/hoster/Xdcc.py +++ b/pyload/plugins/hoster/Xdcc.py @@ -10,7 +10,7 @@ from os import makedirs from os.path import exists, join from select import select -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import safe_join diff --git a/pyload/plugins/hoster/YoupornCom.py b/pyload/plugins/hoster/YoupornCom.py index de23780c3..26a9a76e7 100644 --- a/pyload/plugins/hoster/YoupornCom.py +++ b/pyload/plugins/hoster/YoupornCom.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class YoupornCom(Hoster): diff --git a/pyload/plugins/hoster/YourfilesTo.py b/pyload/plugins/hoster/YourfilesTo.py index 2de636b4b..7c4157ad5 100644 --- a/pyload/plugins/hoster/YourfilesTo.py +++ b/pyload/plugins/hoster/YourfilesTo.py @@ -4,7 +4,7 @@ import re from urllib import unquote -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class YourfilesTo(Hoster): diff --git a/pyload/plugins/hoster/YoutubeCom.py b/pyload/plugins/hoster/YoutubeCom.py index 6869d8b86..610983294 100644 --- a/pyload/plugins/hoster/YoutubeCom.py +++ b/pyload/plugins/hoster/YoutubeCom.py @@ -6,7 +6,7 @@ import subprocess from urllib import unquote -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.plugins.internal.SimpleHoster import replace_patterns from pyload.utils import html_unescape diff --git a/pyload/plugins/hoster/ZDF.py b/pyload/plugins/hoster/ZDF.py index d7bd5469a..cd1a83c7c 100644 --- a/pyload/plugins/hoster/ZDF.py +++ b/pyload/plugins/hoster/ZDF.py @@ -4,7 +4,7 @@ import re from xml.etree.ElementTree import fromstring -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster # Based on zdfm by Roland Beermann (http://github.com/enkore/zdfm/) diff --git a/pyload/plugins/hoster/ZeveraCom.py b/pyload/plugins/hoster/ZeveraCom.py index 64b93e14d..2f46199dc 100644 --- a/pyload/plugins/hoster/ZeveraCom.py +++ b/pyload/plugins/hoster/ZeveraCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster class ZeveraCom(Hoster): diff --git a/pyload/plugins/internal/DeadCrypter.py b/pyload/plugins/internal/DeadCrypter.py index 1c484274b..c9e1eded1 100644 --- a/pyload/plugins/internal/DeadCrypter.py +++ b/pyload/plugins/internal/DeadCrypter.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Crypter import Crypter as _Crypter +from pyload.plugins.base.Crypter import Crypter as _Crypter class DeadCrypter(_Crypter): diff --git a/pyload/plugins/internal/DeadHoster.py b/pyload/plugins/internal/DeadHoster.py index fc7e1a6ad..a7b873d30 100644 --- a/pyload/plugins/internal/DeadHoster.py +++ b/pyload/plugins/internal/DeadHoster.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.Hoster import Hoster as _Hoster +from pyload.plugins.base.Hoster import Hoster as _Hoster def create_getInfo(plugin): diff --git a/pyload/plugins/internal/MultiHoster.py b/pyload/plugins/internal/MultiHoster.py index fdaccdd5b..48345eeca 100644 --- a/pyload/plugins/internal/MultiHoster.py +++ b/pyload/plugins/internal/MultiHoster.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Hook import Hook +from pyload.plugins.base.Hook import Hook from pyload.utils import remove_chars diff --git a/pyload/plugins/internal/SimpleCrypter.py b/pyload/plugins/internal/SimpleCrypter.py index d9982007d..454a95e84 100644 --- a/pyload/plugins/internal/SimpleCrypter.py +++ b/pyload/plugins/internal/SimpleCrypter.py @@ -2,7 +2,7 @@ import re -from pyload.plugins.Crypter import Crypter +from pyload.plugins.base.Crypter import Crypter from pyload.plugins.internal.SimpleHoster import PluginParseError, replace_patterns, set_cookies from pyload.utils import html_unescape diff --git a/pyload/plugins/internal/SimpleHoster.py b/pyload/plugins/internal/SimpleHoster.py index 399430b9f..8fdff5dd5 100644 --- a/pyload/plugins/internal/SimpleHoster.py +++ b/pyload/plugins/internal/SimpleHoster.py @@ -7,7 +7,7 @@ from urlparse import urlparse from pyload.network.CookieJar import CookieJar from pyload.network.RequestFactory import getURL -from pyload.plugins.Hoster import Hoster +from pyload.plugins.base.Hoster import Hoster from pyload.utils import fixup, html_unescape, parseFileSize diff --git a/pyload/plugins/internal/UpdateManager.py b/pyload/plugins/internal/UpdateManager.py index eb9411236..d003860b9 100644 --- a/pyload/plugins/internal/UpdateManager.py +++ b/pyload/plugins/internal/UpdateManager.py @@ -7,7 +7,7 @@ from operator import itemgetter from os import path, remove, stat from pyload.network.RequestFactory import getURL -from pyload.plugins.Hook import Expose, Hook, threaded +from pyload.plugins.base.Hook import Expose, Hook, threaded from pyload.utils import safe_join diff --git a/pyload/plugins/internal/XFSPAccount.py b/pyload/plugins/internal/XFSPAccount.py index aec9b7dbc..7d89536cc 100644 --- a/pyload/plugins/internal/XFSPAccount.py +++ b/pyload/plugins/internal/XFSPAccount.py @@ -4,7 +4,7 @@ import re from time import mktime, strptime -from pyload.plugins.Account import Account +from pyload.plugins.base.Account import Account from pyload.plugins.internal.SimpleHoster import parseHtmlForm from pyload.utils import parseFileSize diff --git a/pyload/plugins/ocr/GigasizeCom.py b/pyload/plugins/ocr/GigasizeCom.py index b139c304e..424a23790 100644 --- a/pyload/plugins/ocr/GigasizeCom.py +++ b/pyload/plugins/ocr/GigasizeCom.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.OCR import OCR +from pyload.plugins.base.OCR import OCR class GigasizeCom(OCR): diff --git a/pyload/plugins/ocr/LinksaveIn.py b/pyload/plugins/ocr/LinksaveIn.py index 1eb8bd796..98906abbe 100644 --- a/pyload/plugins/ocr/LinksaveIn.py +++ b/pyload/plugins/ocr/LinksaveIn.py @@ -5,7 +5,7 @@ from PIL import Image from os import sep from os.path import abspath, dirname -from pyload.plugins.OCR import OCR +from pyload.plugins.base.OCR import OCR class LinksaveIn(OCR): diff --git a/pyload/plugins/ocr/NetloadIn.py b/pyload/plugins/ocr/NetloadIn.py index 825fba787..7ea9f6671 100644 --- a/pyload/plugins/ocr/NetloadIn.py +++ b/pyload/plugins/ocr/NetloadIn.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.OCR import OCR +from pyload.plugins.base.OCR import OCR class NetloadIn(OCR): diff --git a/pyload/plugins/ocr/ShareonlineBiz.py b/pyload/plugins/ocr/ShareonlineBiz.py index 3cee0348e..1410ccfd5 100644 --- a/pyload/plugins/ocr/ShareonlineBiz.py +++ b/pyload/plugins/ocr/ShareonlineBiz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from pyload.plugins.OCR import OCR +from pyload.plugins.base.OCR import OCR class ShareonlineBiz(OCR): -- cgit v1.2.3