diff options
author | Sahil Shekhawat <sahilshekhawat01@gmail.com> | 2015-01-05 19:31:35 +0100 |
---|---|---|
committer | Sahil Shekhawat <sahilshekhawat01@gmail.com> | 2015-01-05 19:31:35 +0100 |
commit | 7b8593899e3d37846fb3ed94d47d9daba13a02d7 (patch) | |
tree | 5427650c3dd14b0c2878a1081be3709458bf48db /module | |
parent | Created plugin for Nitroflare.com (diff) | |
parent | Spare code improvements (diff) | |
download | pyload-7b8593899e3d37846fb3ed94d47d9daba13a02d7.tar.xz |
Merge branch 'stable' of https://github.com/pyload/pyload into stable
Diffstat (limited to 'module')
21 files changed, 124 insertions, 157 deletions
diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py index 052e8303f..4a188aa83 100644 --- a/module/plugins/crypter/DlProtectCom.py +++ b/module/plugins/crypter/DlProtectCom.py @@ -37,7 +37,7 @@ class DlProtectCom(SimpleCrypter): if "Please click on continue to see the content" in self.html: post_req['submitform'] = "Continue" - self.wait(5) + self.wait(2) else: mstime = int(round(time() * 1000)) diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index a32de7f42..8e0d9d36e 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- from pycurl import FORM_FILE, LOW_SPEED_TIME -from thread import start_new_thread from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class BypassCaptchaException(Exception): @@ -29,7 +28,7 @@ class BypassCaptchaException(Exception): class BypassCaptcha(Hook): __name__ = "BypassCaptcha" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("force", "bool", "Force BC even if client is connected", False), ("passkey", "password", "Passkey", "")] @@ -116,7 +115,7 @@ class BypassCaptcha(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) @@ -132,7 +131,8 @@ class BypassCaptcha(Hook): self.respond(task.data['ticket'], False) - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index 33ad00c49..6eb4ef305 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -5,19 +5,18 @@ from __future__ import with_statement import re from base64 import b64encode -from thread import start_new_thread from time import sleep from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class Captcha9kw(Hook): __name__ = "Captcha9kw" __type__ = "hook" - __version__ = "0.26" + __version__ = "0.27" __config__ = [("activated" , "bool" , "Activated" , True ), ("ssl" , "bool" , "Use HTTPS" , True ), @@ -68,6 +67,7 @@ class Captcha9kw(Hook): return 0 + @threaded def _processCaptcha(self, task): try: with open(task.captchaFile, 'rb') as f: diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 6d4127871..9a9f05b29 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -10,12 +10,11 @@ try: except ImportError: import Image -from thread import start_new_thread from time import sleep from urllib import urlencode from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class CaptchaBrotherhoodException(Exception): @@ -39,7 +38,7 @@ class CaptchaBrotherhoodException(Exception): class CaptchaBrotherhood(Hook): __name__ = "CaptchaBrotherhood" __type__ = "hook" - __version__ = "0.06" + __version__ = "0.07" __config__ = [("username", "str", "Username", ""), ("force", "bool", "Force CT even if client is connected", False), @@ -154,7 +153,7 @@ class CaptchaBrotherhood(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) else: self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits")) @@ -164,7 +163,8 @@ class CaptchaBrotherhood(Hook): res = self.get_api("complainCaptcha", task.data['ticket']) - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 04aac2f10..8ef31ec1e 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -1,41 +1,10 @@ # -*- coding: utf-8 -*- import socket -import thread - -from module.plugins.Hook import Hook - - -def proxy(self, *settings): - thread.start_new_thread(server, (self,) + settings) - lock = thread.allocate_lock() - lock.acquire() - lock.acquire() - - -def server(self, *settings): - try: - dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - dock_socket.bind((settings[0], settings[2])) - dock_socket.listen(5) - while True: - client_socket = dock_socket.accept()[0] - server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - server_socket.connect(("127.0.0.1", settings[1])) - thread.start_new_thread(forward, (client_socket, server_socket)) - thread.start_new_thread(forward, (server_socket, client_socket)) - except socket.error, e: - if hasattr(e, "errno"): - errno = e.errno - else: - errno = e.args[0] - if errno == 98: - self.logWarning(_("Click'N'Load: Port 9666 already in use")) - return - thread.start_new_thread(server, (self,) + settings) - except: - thread.start_new_thread(server, (self,) + settings) +from threading import Thread, Lock + +from module.plugins.Hook import Hook, threaded def forward(source, destination): @@ -45,33 +14,68 @@ def forward(source, destination): if string: destination.sendall(string) else: - #source.shutdown(socket.SHUT_RD) destination.shutdown(socket.SHUT_WR) class ClickAndLoad(Hook): __name__ = "ClickAndLoad" __type__ = "hook" - __version__ = "0.24" + __version__ = "0.25" - __config__ = [("activated", "bool", "Activated", True), - ("extern", "bool", "Allow external link adding", False)] + __config__ = [("activated", "bool", "Activated" , True ), + ("port" , "int" , "Port" , 9666 ), + ("extern" , "bool", "Listen for requests coming from WAN (internet)", False)] __description__ = """Click'N'Load hook plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.de"), - ("mkaay", "mkaay@mkaay.de")] + ("Walter Purcaro", "vuolter@gmail.com")] def coreReady(self): - self.port = int(self.config['webinterface']['port']) - if self.config['webinterface']['activated']: - try: - if self.getConfig("extern"): - ip = "0.0.0.0" - else: - ip = "127.0.0.1" - - thread.start_new_thread(proxy, (self, ip, self.port, 9666)) - except: - self.logError(_("ClickAndLoad port already in use")) + if not self.config['webinterface']['activated']: + return + + ip = "0.0.0.0" if self.getConfig("extern") else "127.0.0.1" + webport = int(self.config['webinterface']['port']) + cnlport = self.getConfig('port') + + self.proxy(ip, webport, cnlport) + + + @threaded + def proxy(self, ip, webport, cnlport): + hookManager.startThread(self.server, ip, webport, cnlport) + lock = Lock() + lock.acquire() + lock.acquire() + + + def server(self, ip, webport, cnlport): + try: + dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + dock_socket.bind((ip, cnlport)) + dock_socket.listen(5) + + while True: + server_socket = dock_socket.accept()[0] + client_socket = socket.create_connection(("127.0.0.1", webport)) + + hookManager.startThread(forward, server_socket, client_socket) + hookManager.startThread(forward, client_socket, server_socket) + + except socket.error, e: + if hasattr(e, "errno"): + errno = e.errno + else: + errno = e.args[0] + + if errno == 98: + self.logWarning(_("Port %s already in use") % cnlport) + else: + self.logError(e) + self.server(ip, webport, cnlport) + + except Exception, e: + self.logError(e) + self.server(ip, webport, cnlport) diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index f03ac4567..98412c218 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -6,13 +6,12 @@ import re from base64 import b64encode from pycurl import FORM_FILE, HTTPHEADER -from thread import start_new_thread from time import sleep from module.common.json_layer import json_loads from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class DeathByCaptchaException(Exception): @@ -52,7 +51,7 @@ class DeathByCaptchaException(Exception): class DeathByCaptcha(Hook): __name__ = "DeathByCaptcha" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), @@ -195,7 +194,7 @@ class DeathByCaptcha(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(180) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) def captchaInvalid(self, task): @@ -210,7 +209,8 @@ class DeathByCaptcha(Hook): self.logError(e) - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 16149580c..1606c9f30 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHook import MultiHook class EasybytezCom(MultiHook): __name__ = "EasybytezCom" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("pluginlist", "str", "Hoster list (comma separated)", "")] @@ -19,8 +19,7 @@ class EasybytezCom(MultiHook): def getHosters(self): - self.account = self.core.accountManager.getAccountPlugin(self.__name__) - user = self.account.selectAccount()[0] + user, data = self.account.selectAccount() try: req = self.account.getAccountRequest(user) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 54de8eb53..c80401003 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -4,18 +4,17 @@ from __future__ import with_statement from base64 import b64encode from pycurl import LOW_SPEED_TIME -from thread import start_new_thread from uuid import uuid4 from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class ExpertDecoders(Hook): __name__ = "ExpertDecoders" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("force", "bool", "Force CT even if client is connected", False), ("passkey", "password", "Access key", "")] @@ -50,7 +49,8 @@ class ExpertDecoders(Hook): return 0 - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): task.data['ticket'] = ticket = uuid4() result = None @@ -85,7 +85,7 @@ class ExpertDecoders(Hook): if self.getCredits() > 0: task.handler.append(self) task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) else: self.logInfo(_("Your ExpertDecoders Account has not enough credits")) diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index f89d64c37..d448d1be9 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -6,10 +6,9 @@ import re from base64 import b64encode from pycurl import FORM_FILE, LOW_SPEED_TIME -from thread import start_new_thread from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook +from module.plugins.Hook import Hook, threaded class ImageTyperzException(Exception): @@ -33,7 +32,7 @@ class ImageTyperzException(Exception): class ImageTyperz(Hook): __name__ = "ImageTyperz" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), @@ -130,7 +129,7 @@ class ImageTyperz(Hook): task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - start_new_thread(self.processCaptcha, (task,)) + self._processCaptcha(task) else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) @@ -150,7 +149,8 @@ class ImageTyperz(Hook): self.logError(_("Bad captcha solution received, refund request failed"), res) - def processCaptcha(self, task): + @threaded + def _processCaptcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index c0717afc7..d334ddd25 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHook import MultiHook class PremiumizeMe(MultiHook): __name__ = "PremiumizeMe" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.16" __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), @@ -20,12 +20,8 @@ class PremiumizeMe(MultiHook): def getHosters(self): - # If no accounts are available there will be no hosters available - if not self.account or not self.account.canUse(): - return [] - # Get account data - (user, data) = self.account.selectAccount() + user, data = self.account.selectAccount() # Get supported hosters list from premiumize.me using the # json API v1 (see https://secure.premiumize.me/?show=api) @@ -39,15 +35,3 @@ class PremiumizeMe(MultiHook): # Extract hosters from json file return data['result']['hosterlist'] - - - def coreReady(self): - # Get account plugin and check if there is a valid account available - self.account = self.core.accountManager.getAccountPlugin("PremiumizeMe") - if not self.account.canUse(): - self.account = None - self.logError(_("Please add a valid premiumize.me account first and restart pyLoad")) - return - - # Run the overwriten core ready which actually enables the multihoster hook - return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index bbbe8e128..9c88e6c01 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHook import MultiHook class RPNetBiz(MultiHook): __name__ = "RPNetBiz" __type__ = "hook" - __version__ = "0.12" + __version__ = "0.13" __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), @@ -20,12 +20,8 @@ class RPNetBiz(MultiHook): def getHosters(self): - # No hosts supported if no account - if not self.account or not self.account.canUse(): - return [] - # Get account data - (user, data) = self.account.selectAccount() + user, data = self.account.selectAccount() res = self.getURL("https://premium.rpnet.biz/client_api.php", get={'username': user, 'password': data['password'], 'action': "showHosterList"}) @@ -37,15 +33,3 @@ class RPNetBiz(MultiHook): # Extract hosters from json file return hoster_list['hosters'] - - - def coreReady(self): - # Get account plugin and check if there is a valid account available - self.account = self.core.accountManager.getAccountPlugin("RPNetBiz") - if not self.account.canUse(): - self.account = None - self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet") - return - - # Run the overwriten core ready which actually enables the multihoster hook - return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index c3b626bf7..527770eb6 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.45" + __version__ = "0.46" __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("pluginlist", "str", "Hoster list (comma separated)", ""), @@ -25,16 +25,9 @@ class RehostTo(MultiHook): def coreReady(self): - self.account = self.core.accountManager.getAccountPlugin("RehostTo") + super(RehostTo, self).coreReady() - user = self.account.selectAccount()[0] + user, data = self.account.selectAccount() - if not user: - self.logError(_("Please add your rehost.to account first and restart pyLoad")) - return - - data = self.account.getAccountInfo(user) - self.ses = data['ses'] + self.ses = data['ses'] self.long_ses = data['long_ses'] - - return MultiHook.coreReady(self) diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index ee84f613f..421ad111b 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' @@ -21,7 +21,8 @@ class MultishareCz(SimpleHoster): SIZE_REPLACEMENTS = [(' ', '')] - MULTI_HOSTER = True + CHECK_TRAFFIC = True + MULTI_HOSTER = True INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' @@ -32,10 +33,6 @@ class MultishareCz(SimpleHoster): def handlePremium(self): - if not self.checkCredit(): - self.logWarning(_("Not enough credit left to download file")) - self.resetAccount() - self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.info['pattern']['ID']) @@ -44,7 +41,7 @@ class MultishareCz(SimpleHoster): self.checkInfo() - if not self.checkCredit(): + if not self.checkTrafficLeft(): self.fail(_("Not enough credit left to download file")) self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()), @@ -54,12 +51,4 @@ class MultishareCz(SimpleHoster): disposition=True) - def checkCredit(self): - self.acc_info = self.account.getAccountInfo(self.user, True) - - self.logInfo(_("User %s has %i MB left") % (self.user, self.acc_info['trafficleft'] / 1024)) - - return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] - - getInfo = create_getInfo(MultishareCz) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index f4f7ba56a..feedd7651 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -43,8 +43,9 @@ class NoPremiumPl(SimpleHoster): if not self.account: self.fail(_("Please enter your %s account or deactivate this plugin") % "NoPremium.pl") else: - self._usr = self.account.getAccountData(self.user).get('usr') - self._pwd = self.account.getAccountData(self.user).get('pwd') + data = self.account.getAccountData(self.user) + self._usr = data['usr'] + self._pwd = data['pwd'] def runFileQuery(self, url, mode=None): query = self._api_query.copy() diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index 8a998c816..11d4e9541 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -11,7 +11,7 @@ from module.utils import fs_encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.19" __pattern__ = r'^unmatchable$' @@ -22,6 +22,9 @@ class PremiumTo(MultiHoster): ("stickell", "l.stickell@yahoo.it")] + CHECK_TRAFFIC = True + + def handlePremium(self): #raise timeout to 2min self.download("http://premium.to/api/getfile.php", diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 9fd20e69e..7260ebbe3 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -41,8 +41,9 @@ class RapideoPl(SimpleHoster): if not self.account: self.fail(_("Please enter your %s account or deactivate this plugin") % "Rapideo.pl") else: - self._usr = self.account.getAccountData(self.user).get('usr') - self._pwd = self.account.getAccountData(self.user).get('pwd') + data = self.account.getAccountData(self.user) + self._usr = data['usr'] + self._pwd = data['pwd'] def runFileQuery(self, url, mode=None): query = self._api_query.copy() diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 5dd17e374..96443d5f5 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class RehostTo(MultiHoster): __name__ = "RehostTo" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __pattern__ = r'https?://.*rehost\.to\..+' @@ -22,7 +22,7 @@ class RehostTo(MultiHoster): def handlePremium(self): - data = self.account.getAccountInfo(self.user) + data = self.account.getAccountData(self.user) self.download("http://rehost.to/process_download.php", get={'user': "cookie", diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index dc3d5093c..bbf75c94a 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' @@ -28,6 +28,8 @@ class ShareonlineBiz(SimpleHoster): URL_REPLACEMENTS = [(__pattern__ + ".*", "http://www.share-online.biz/dl/\g<ID>")] + CHECK_TRAFFIC = True + RECAPTCHA_KEY = "6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX" ERROR_INFO_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' @@ -125,8 +127,6 @@ class ShareonlineBiz(SimpleHoster): def handlePremium(self): #: should be working better loading (account) api internally - self.account.getAccountInfo(self.user, True) - html = self.load("http://api.share-online.biz/account.php", {"username": self.user, "password": self.account.accounts[self.user]['password'], "act": "download", "lid": self.info['fileid']}) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index 8211d40d4..0be9bfa12 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -36,7 +36,7 @@ class SimplydebridCom(MultiHoster): self.logDebug("New URL: %s" % self.link) if not re.match(self.__pattern__, self.link): - page = self.load("http://simply-debrid.com/api.php", get={'dl': self.link}) # +'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password']) + page = self.load("http://simply-debrid.com/api.php", get={'dl': self.link}) if 'tiger Link' in page or 'Invalid Link' in page or ('API' in page and 'ERROR' in page): self.fail(_("Unable to unrestrict link")) self.link = page diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index b5ac132b7..ea9f32673 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -9,7 +9,7 @@ from module.utils import remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.28" + __version__ = "0.29" __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -43,6 +43,7 @@ class MultiHook(Hook): def setup(self): + self.account = None self.type = self.core.pluginManager.findPlugin(self.__name__)[1] or "hoster" self.plugins = [] self.supported = [] @@ -51,7 +52,12 @@ class MultiHook(Hook): def coreReady(self): self.account = self.core.accountManager.getAccountPlugin(self.__name__) + + if self.account and not self.account.canUse(): + self.account = None + if not self.account: + self.logWarning("MultiHook will be deactivated due missing account reference") self.setConfig('activated', False) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 4e2b4803b..c87a6160f 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -182,7 +182,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.89" + __version__ = "0.90" __pattern__ = r'^unmatchable$' @@ -593,6 +593,9 @@ class SimpleHoster(Hoster): def checkTrafficLeft(self): + if not self.account: + return True + traffic = self.account.getAccountInfo(self.user, True)['trafficleft'] if traffic is None: |