summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-20 23:07:42 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-04-20 23:07:42 +0200
commit2475ddb7654d0d6fb1be18082b5c8c480befdbb3 (patch)
treeb82a8b5fc0a309f69733b0a004284f4ef45833d8
parentSpare code cosmetics (9) (diff)
parentadded check of classname == filename (diff)
downloadpyload-2475ddb7654d0d6fb1be18082b5c8c480befdbb3.tar.xz
Merge branch 'pr/n10_ardi69' into 0.4.10
Conflicts: pyload/plugin/hoster/FileserveCom.py
-rw-r--r--pyload/manager/Plugin.py3
-rw-r--r--pyload/plugin/Account.py6
-rw-r--r--pyload/plugin/Addon.py8
-rw-r--r--pyload/plugin/Extractor.py7
-rw-r--r--pyload/plugin/OCR.py6
-rw-r--r--pyload/plugin/Plugin.py28
-rw-r--r--pyload/plugin/addon/DeleteFinished.py2
-rw-r--r--pyload/plugin/addon/ExtractArchive.py36
-rw-r--r--pyload/plugin/addon/RestartFailed.py2
-rw-r--r--pyload/plugin/crypter/XFileSharingPro.py4
-rw-r--r--pyload/plugin/hook/BypassCaptcha.py8
-rw-r--r--pyload/plugin/hook/Captcha9Kw.py26
-rw-r--r--pyload/plugin/hook/CaptchaBrotherhood.py4
-rw-r--r--pyload/plugin/hook/DeathByCaptcha.py4
-rw-r--r--pyload/plugin/hook/ImageTyperz.py6
-rw-r--r--pyload/plugin/hoster/FileserveCom.py4
-rw-r--r--pyload/plugin/hoster/NoPremiumPl.py2
-rw-r--r--pyload/plugin/hoster/RapideoPl.py2
-rw-r--r--pyload/plugin/hoster/XFileSharingPro.py4
-rw-r--r--pyload/plugin/hoster/Xdcc.py2
-rw-r--r--pyload/plugin/internal/MultiHook.py2
-rw-r--r--pyload/plugin/internal/MultiHoster.py4
-rw-r--r--pyload/plugin/internal/SimpleHoster.py4
-rw-r--r--pyload/plugin/internal/XFSCrypter.py2
-rw-r--r--pyload/plugin/internal/XFSHoster.py2
25 files changed, 95 insertions, 83 deletions
diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py
index 118dea8f0..c6ba5e81b 100644
--- a/pyload/manager/Plugin.py
+++ b/pyload/manager/Plugin.py
@@ -110,6 +110,9 @@ class PluginManager(object):
if name[-1] == ".":
name = name[:-4]
+ if not re.search("class\\s+%s\\(" % name, content):
+ self.core.log.error(_("invalid classname: %s ignored") % join(pfolder, f))
+
version = self.VERSION.findall(content)
if version:
version = float(version[0][1])
diff --git a/pyload/plugin/Account.py b/pyload/plugin/Account.py
index fda76a78f..bb8f7d59a 100644
--- a/pyload/plugin/Account.py
+++ b/pyload/plugin/Account.py
@@ -196,7 +196,7 @@ class Account(Base):
"maxtraffic" : None,
"premium" : None,
"timestamp" : 0, #: time this info was retrieved
- "type" : self.__class__.__name__}
+ "type" : self.getClassName()}
def getAllAccounts(self, force=False):
@@ -209,7 +209,7 @@ class Account(Base):
if not user:
return None
- req = self.core.requestFactory.getRequest(self.__class__.__name__, user)
+ req = self.core.requestFactory.getRequest(self.getClassName(), user)
return req
@@ -219,7 +219,7 @@ class Account(Base):
if not user:
return None
- cj = self.core.requestFactory.getCookieJar(self.__class__.__name__, user)
+ cj = self.core.requestFactory.getCookieJar(self.getClassName(), user)
return cj
diff --git a/pyload/plugin/Addon.py b/pyload/plugin/Addon.py
index e8cc03de2..21a86ab05 100644
--- a/pyload/plugin/Addon.py
+++ b/pyload/plugin/Addon.py
@@ -16,7 +16,7 @@ class Expose(object):
def threaded(fn):
- def run(*args,**kwargs):
+ def run(*args, **kwargs):
addonManager.startThread(fn, *args, **kwargs)
return run
@@ -69,6 +69,8 @@ class Addon(Base):
self.event_map = None
if self.event_list:
+ self.logWarning(_("Plugin used deprecated 'event_list', use 'event_map' instead"))
+
for f in self.event_list:
self.manager.addEvent(f, getattr(self, f))
@@ -98,7 +100,7 @@ class Addon(Base):
def __repr__(self):
- return "<Addon %s>" % self.__class__.__name__
+ return "<Addon %s>" % self.getClassName()
def setup(self):
@@ -109,6 +111,7 @@ class Addon(Base):
def deactivate(self):
""" called when addon was deactivated """
if has_method(self.__class__, "unload"):
+ self.logWarning(_("Deprecated method 'unload()', use deactivate() instead"))
self.unload()
@@ -127,6 +130,7 @@ class Addon(Base):
def activate(self):
""" called when addon was activated """
if has_method(self.__class__, "coreReady"):
+ self.logWarning(_("Deprecated method 'coreReady()', use activate() instead"))
self.coreReady()
diff --git a/pyload/plugin/Extractor.py b/pyload/plugin/Extractor.py
index c0948c3dd..e50ab8818 100644
--- a/pyload/plugin/Extractor.py
+++ b/pyload/plugin/Extractor.py
@@ -27,7 +27,7 @@ class Extractor:
__description = """Base extractor plugin"""
__license = "GPLv3"
__authors = [("Walter Purcaro", "vuolter@gmail.com"),
- ("Immenz" , "immenz@gmx.net" )]
+ ("Immenz" , "immenz@gmx.net")]
EXTENSIONS = []
@@ -36,6 +36,11 @@ class Extractor:
@classmethod
+ def NAME(self):
+ return getattr(self, "_" + self.__name__ + "__name")
+
+
+ @classmethod
def isArchive(cls, filename):
name = os.path.basename(filename).lower()
return any(name.endswith(ext) for ext in cls.EXTENSIONS)
diff --git a/pyload/plugin/OCR.py b/pyload/plugin/OCR.py
index df5eeea1f..126283f01 100644
--- a/pyload/plugin/OCR.py
+++ b/pyload/plugin/OCR.py
@@ -60,11 +60,11 @@ class OCR(Base):
def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True, pagesegmode=None):
# tmpTif = tempfile.NamedTemporaryFile(suffix=".tif")
try:
- tmpTif = open(fs_join("tmp", "tmpTif_%s.tif" % self.__class__.__name__), "wb")
+ tmpTif = open(fs_join("tmp", "tmpTif_%s.tif" % self.getClassName()), "wb")
tmpTif.close()
# tmpTxt = tempfile.NamedTemporaryFile(suffix=".txt")
- tmpTxt = open(fs_join("tmp", "tmpTxt_%s.txt" % self.__class__.__name__), "wb")
+ tmpTxt = open(fs_join("tmp", "tmpTxt_%s.txt" % self.getClassName()), "wb")
tmpTxt.close()
except IOError, e:
@@ -86,7 +86,7 @@ class OCR(Base):
if subset and (digits or lowercase or uppercase):
# tmpSub = tempfile.NamedTemporaryFile(suffix=".subset")
- with open(fs_join("tmp", "tmpSub_%s.subset" % self.__class__.__name__), "wb") as tmpSub:
+ with open(fs_join("tmp", "tmpSub_%s.subset" % self.getClassName()), "wb") as tmpSub:
tmpSub.write("tessedit_char_whitelist ")
if digits:
diff --git a/pyload/plugin/Plugin.py b/pyload/plugin/Plugin.py
index 8b7e6fbc2..a14bb1e9c 100644
--- a/pyload/plugin/Plugin.py
+++ b/pyload/plugin/Plugin.py
@@ -66,7 +66,7 @@ class Base(object):
def _log(self, type, args):
msg = " | ".join([encode(str(a)).strip() for a in args if a])
logger = getattr(self.core.log, type)
- logger("%s: %s" % (self.__class__.__name__, msg or _("%s MARK" % type.upper())))
+ logger("%s: %s" % (self.getClassName(), msg or _("%s MARK" % type.upper())))
def logDebug(self, *args):
@@ -91,7 +91,7 @@ class Base(object):
def getPluginType(self):
- return getattr(self, "_%s__type" % self.__class__.__name__)
+ return getattr(self, "_%s__type" % self.getClassName())
@classmethod
@@ -100,7 +100,7 @@ class Base(object):
def getPluginConfSection(self):
- return "%s_%s" % (self.__class__.__name__, getattr(self, "_%s__type" % self.__class__.__name__))
+ return "%s_%s" % (self.getClassName(), getattr(self, "_%s__type" % self.getClassName()))
#: Deprecated method
@@ -160,7 +160,7 @@ class Base(object):
def delStorage(self, key):
""" Delete entry in db """
- self.core.db.delStorage(self.__class__.__name__, key)
+ self.core.db.delStorage(self.getClassName(), key)
class Plugin(Base):
@@ -206,7 +206,7 @@ class Plugin(Base):
self.ocr = None
#: account handler instance, see :py:class:`Account`
- self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__class__.__name__)
+ self.account = pyfile.m.core.accountManager.getAccountPlugin(self.getClassName())
#: premium status
self.premium = False
@@ -227,7 +227,7 @@ class Plugin(Base):
#: premium status
self.premium = self.account.isPremium(self.user)
else:
- self.req = pyfile.m.core.requestFactory.getRequest(self.__class__.__name__)
+ self.req = pyfile.m.core.requestFactory.getRequest(self.getClassName())
#: associated pyfile instance, see `PyFile`
self.pyfile = pyfile
@@ -258,7 +258,7 @@ class Plugin(Base):
def __call__(self):
- return self.__class__.__name__
+ return self.getClassName()
def init(self):
@@ -295,7 +295,7 @@ class Plugin(Base):
def resetAccount(self):
""" dont use account and retry download """
self.account = None
- self.req = self.core.requestFactory.getRequest(self.__class__.__name__)
+ self.req = self.core.requestFactory.getRequest(self.getClassName())
self.retry()
@@ -469,13 +469,13 @@ class Plugin(Base):
id = ("%.2f" % time())[-6:].replace(".", "")
- with open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__class__.__name__, id, imgtype)), "wb") as tmpCaptcha:
+ with open(join("tmp", "tmpCaptcha_%s_%s.%s" % (self.getClassName(), id, imgtype)), "wb") as tmpCaptcha:
tmpCaptcha.write(img)
- has_plugin = self.__class__.__name__ in self.core.pluginManager.ocrPlugins
+ has_plugin = self.getClassName() in self.core.pluginManager.ocrPlugins
if self.core.captcha:
- Ocr = self.core.pluginManager.loadClass("ocr", self.__class__.__name__)
+ Ocr = self.core.pluginManager.loadClass("ocr", self.getClassName())
else:
Ocr = None
@@ -553,10 +553,10 @@ class Plugin(Base):
from inspect import currentframe
frame = currentframe()
- framefile = fs_join("tmp", self.__class__.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno))
+ framefile = fs_join("tmp", self.getClassName(), "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno))
try:
- if not exists(join("tmp", self.__class__.__name__)):
- makedirs(join("tmp", self.__class__.__name__))
+ if not exists(join("tmp", self.getClassName())):
+ makedirs(join("tmp", self.getClassName()))
with open(framefile, "wb") as f:
del frame #: delete the frame or it wont be cleaned
diff --git a/pyload/plugin/addon/DeleteFinished.py b/pyload/plugin/addon/DeleteFinished.py
index b9368a642..8fe0b1497 100644
--- a/pyload/plugin/addon/DeleteFinished.py
+++ b/pyload/plugin/addon/DeleteFinished.py
@@ -53,7 +53,7 @@ class DeleteFinished(Addon):
def activate(self):
self.info['sleep'] = True
# interval = self.getConfig('interval')
- # self.pluginConfigChanged(self.__class__.__name__, 'interval', interval)
+ # self.pluginConfigChanged(self.getClassName(), 'interval', interval)
self.interval = max(self.MIN_CHECK_INTERVAL, self.getConfig('interval') * 60 * 60)
self.addEvent('packageFinished', self.wakeup)
self.initPeriodical()
diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py
index 82938921e..b0a24446a 100644
--- a/pyload/plugin/addon/ExtractArchive.py
+++ b/pyload/plugin/addon/ExtractArchive.py
@@ -111,28 +111,28 @@ class ExtractArchive(Addon):
__type = "addon"
__version = "1.41"
- __config = [("activated" , "bool" , "Activated" , True ),
- ("fullpath" , "bool" , "Extract with full paths" , True ),
- ("overwrite" , "bool" , "Overwrite files" , False ),
- ("keepbroken" , "bool" , "Try to extract broken archives" , False ),
- ("repair" , "bool" , "Repair broken archives (RAR required)" , False ),
- ("test" , "bool" , "Test archive before extracting" , False ),
- ("usepasswordfile", "bool" , "Use password file" , True ),
- ("passwordfile" , "file" , "Password file" , "archive_password.txt" ),
- ("delete" , "bool" , "Delete archive after extraction" , True ),
- ("deltotrash" , "bool" , "Move to trash (recycle bin) instead delete", True ),
- ("subfolder" , "bool" , "Create subfolder for each package" , False ),
- ("destination" , "folder" , "Extract files to folder" , "" ),
+ __config = [("activated" , "bool" , "Activated" , True),
+ ("fullpath" , "bool" , "Extract with full paths" , True),
+ ("overwrite" , "bool" , "Overwrite files" , False),
+ ("keepbroken" , "bool" , "Try to extract broken archives" , False),
+ ("repair" , "bool" , "Repair broken archives (RAR required)" , False),
+ ("test" , "bool" , "Test archive before extracting" , False),
+ ("usepasswordfile", "bool" , "Use password file" , True),
+ ("passwordfile" , "file" , "Password file" , "archive_password.txt"),
+ ("delete" , "bool" , "Delete archive after extraction" , True),
+ ("deltotrash" , "bool" , "Move to trash (recycle bin) instead delete", True),
+ ("subfolder" , "bool" , "Create subfolder for each package" , False),
+ ("destination" , "folder" , "Extract files to folder" , ""),
("extensions" , "str" , "Extract archives ending with extension" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"),
- ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ),
- ("recursive" , "bool" , "Extract archives in archives" , True ),
- ("waitall" , "bool" , "Run after all downloads was processed" , False ),
- ("renice" , "int" , "CPU priority" , 0 )]
+ ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db"),
+ ("recursive" , "bool" , "Extract archives in archives" , True),
+ ("waitall" , "bool" , "Run after all downloads was processed" , False),
+ ("renice" , "int" , "CPU priority" , 0)]
__description = """Extract different kind of archives"""
__license = "GPLv3"
__authors = [("Walter Purcaro", "vuolter@gmail.com"),
- ("Immenz" , "immenz@gmx.net" )]
+ ("Immenz" , "immenz@gmx.net")]
event_list = ["allDownloadsProcessed", "packageDeleted"]
@@ -186,7 +186,7 @@ class ExtractArchive(Addon):
traceback.print_exc()
if self.extractors:
- self.logDebug(*["Found %s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors])
+ self.logDebug(*["Found %s %s" % (Extractor.NAME(), Extractor.VERSION) for Extractor in self.extractors])
self.extractQueued() #: Resume unfinished extractions
else:
self.logInfo(_("No Extract plugins activated"))
diff --git a/pyload/plugin/addon/RestartFailed.py b/pyload/plugin/addon/RestartFailed.py
index 695ebb154..8a3a36fe1 100644
--- a/pyload/plugin/addon/RestartFailed.py
+++ b/pyload/plugin/addon/RestartFailed.py
@@ -38,6 +38,6 @@ class RestartFailed(Addon):
def activate(self):
- # self.pluginConfigChanged(self.__class__.__name__, "interval", self.getConfig('interval'))
+ # self.pluginConfigChanged(self.getClassName(), "interval", self.getConfig('interval'))
self.interval = max(self.MIN_CHECK_INTERVAL, self.getConfig('interval') * 60)
self.initPeriodical()
diff --git a/pyload/plugin/crypter/XFileSharingPro.py b/pyload/plugin/crypter/XFileSharingPro.py
index c83c0c67e..b78d83262 100644
--- a/pyload/plugin/crypter/XFileSharingPro.py
+++ b/pyload/plugin/crypter/XFileSharingPro.py
@@ -22,13 +22,13 @@ class XFileSharingPro(XFSCrypter):
def _log(self, type, args):
msg = " | ".join(str(a).strip() for a in args if a)
logger = getattr(self.log, type)
- logger("%s: %s: %s" % (self.__class__.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
+ logger("%s: %s: %s" % (self.getClassName(), self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
def init(self):
super(XFileSharingPro, self).init()
- self.__pattern = self.core.pluginManager.crypterPlugins[self.__class__.__name__]['pattern']
+ self.__pattern = self.core.pluginManager.crypterPlugins[self.getClassName()]['pattern']
self.HOSTER_DOMAIN = re.match(self.__pattern, self.pyfile.url).group("DOMAIN").lower()
self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.')
diff --git a/pyload/plugin/hook/BypassCaptcha.py b/pyload/plugin/hook/BypassCaptcha.py
index 554452776..95be5f3a6 100644
--- a/pyload/plugin/hook/BypassCaptcha.py
+++ b/pyload/plugin/hook/BypassCaptcha.py
@@ -104,21 +104,21 @@ class BypassCaptcha(Hook):
if self.getCredits() > 0:
task.handler.append(self)
- task.data['service'] = self.__class__.__name__
+ task.data['service'] = self.getClassName()
task.setWaiting(100)
self._processCaptcha(task)
else:
- self.logInfo(_("Your %s account has not enough credits") % self.__class__.__name__)
+ self.logInfo(_("Your %s account has not enough credits") % self.getClassName())
def captchaCorrect(self, task):
- if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
+ if task.data['service'] == self.getClassName() and "ticket" in task.data:
self.respond(task.data['ticket'], True)
def captchaInvalid(self, task):
- if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
+ if task.data['service'] == self.getClassName() and "ticket" in task.data:
self.respond(task.data['ticket'], False)
diff --git a/pyload/plugin/hook/Captcha9Kw.py b/pyload/plugin/hook/Captcha9Kw.py
index bbf283623..9ceab4b2b 100644
--- a/pyload/plugin/hook/Captcha9Kw.py
+++ b/pyload/plugin/hook/Captcha9Kw.py
@@ -13,27 +13,27 @@ from pyload.network.RequestFactory import getURL
from pyload.plugin.Hook import Hook, threaded
-class Captcha9kw(Hook):
+class Captcha9Kw(Hook):
__name = "Captcha9Kw"
__type = "hook"
__version = "0.28"
- __config = [("ssl" , "bool" , "Use HTTPS" , True ),
- ("force" , "bool" , "Force captcha resolving even if client is connected" , True ),
- ("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False ),
- ("captchaperhour", "int" , "Captcha per hour" , "9999" ),
- ("captchapermin" , "int" , "Captcha per minute" , "9999" ),
- ("prio" , "int" , "Priority (max 10)(cost +0 -> +10 credits)" , "0" ),
- ("queue" , "int" , "Max. Queue (max 999)" , "50" ),
+ __config = [("ssl" , "bool" , "Use HTTPS" , True),
+ ("force" , "bool" , "Force captcha resolving even if client is connected" , True),
+ ("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False),
+ ("captchaperhour", "int" , "Captcha per hour" , "9999"),
+ ("captchapermin" , "int" , "Captcha per minute" , "9999"),
+ ("prio" , "int" , "Priority (max 10)(cost +0 -> +10 credits)" , "0"),
+ ("queue" , "int" , "Max. Queue (max 999)" , "50"),
("hoster_options", "string" , "Hoster options (format: pluginname:prio=1:selfsolfe=1:confirm=1:timeout=900|...)", "ShareonlineBiz:prio=0:timeout=999 | UploadedTo:prio=0:timeout=999"),
- ("selfsolve" , "bool" , "Selfsolve (manually solve your captcha in your 9kw client if active)" , "0" ),
- ("passkey" , "password", "API key" , "" ),
- ("timeout" , "int" , "Timeout in seconds (min 60, max 3999)" , "900" )]
+ ("selfsolve" , "bool" , "Selfsolve (manually solve your captcha in your 9kw client if active)" , "0"),
+ ("passkey" , "password", "API key" , ""),
+ ("timeout" , "int" , "Timeout in seconds (min 60, max 3999)" , "900")]
__description = """Send captchas to 9kw.eu"""
__license = "GPLv3"
- __authors = [("RaNaN" , "RaNaN@pyload.org" ),
- ("Walter Purcaro", "vuolter@gmail.com")]
+ __authors = [("RaNaN" , "RaNaN@pyload.org"),
+ ("Walter Purcaro", "vuolter@gmail.com")]
API_URL = "http://www.9kw.eu/index.cgi"
diff --git a/pyload/plugin/hook/CaptchaBrotherhood.py b/pyload/plugin/hook/CaptchaBrotherhood.py
index 15338b0af..97e1ff25f 100644
--- a/pyload/plugin/hook/CaptchaBrotherhood.py
+++ b/pyload/plugin/hook/CaptchaBrotherhood.py
@@ -147,7 +147,7 @@ class CaptchaBrotherhood(Hook):
if self.getCredits() > 10:
task.handler.append(self)
- task.data['service'] = self.__class__.__name__
+ task.data['service'] = self.getClassName()
task.setWaiting(100)
self._processCaptcha(task)
else:
@@ -155,7 +155,7 @@ class CaptchaBrotherhood(Hook):
def captchaInvalid(self, task):
- if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
+ if task.data['service'] == self.getClassName() and "ticket" in task.data:
res = self.api_response("complainCaptcha", task.data['ticket'])
diff --git a/pyload/plugin/hook/DeathByCaptcha.py b/pyload/plugin/hook/DeathByCaptcha.py
index b28848422..71d1ddb0a 100644
--- a/pyload/plugin/hook/DeathByCaptcha.py
+++ b/pyload/plugin/hook/DeathByCaptcha.py
@@ -188,13 +188,13 @@ class DeathByCaptcha(Hook):
if balance > rate:
task.handler.append(self)
- task.data['service'] = self.__class__.__name__
+ task.data['service'] = self.getClassName()
task.setWaiting(180)
self._processCaptcha(task)
def captchaInvalid(self, task):
- if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
+ if task.data['service'] == self.getClassName() and "ticket" in task.data:
try:
res = self.api_response("captcha/%d/report" % task.data['ticket'], True)
diff --git a/pyload/plugin/hook/ImageTyperz.py b/pyload/plugin/hook/ImageTyperz.py
index 6c3c5c84b..c134cdaeb 100644
--- a/pyload/plugin/hook/ImageTyperz.py
+++ b/pyload/plugin/hook/ImageTyperz.py
@@ -118,16 +118,16 @@ class ImageTyperz(Hook):
if self.getCredits() > 0:
task.handler.append(self)
- task.data['service'] = self.__class__.__name__
+ task.data['service'] = self.getClassName()
task.setWaiting(100)
self._processCaptcha(task)
else:
- self.logInfo(_("Your %s account has not enough credits") % self.__class__.__name__)
+ self.logInfo(_("Your %s account has not enough credits") % self.getClassName())
def captchaInvalid(self, task):
- if task.data['service'] == self.__class__.__name__ and "ticket" in task.data:
+ if task.data['service'] == self.getClassName() and "ticket" in task.data:
res = getURL(self.RESPOND_URL,
post={'action': "SETBADIMAGE",
'username': self.getConfig('username'),
diff --git a/pyload/plugin/hoster/FileserveCom.py b/pyload/plugin/hoster/FileserveCom.py
index 4530f8ff8..1d4179e5c 100644
--- a/pyload/plugin/hoster/FileserveCom.py
+++ b/pyload/plugin/hoster/FileserveCom.py
@@ -144,7 +144,7 @@ class FileserveCom(Hoster):
if "fail" in res:
self.fail(_("Failed getting wait time"))
- if self.__class__.__name__ == "FilejungleCom":
+ if self.getClassName() == "FilejungleCom":
m = re.search(r'"waitTime":(\d+)', res)
if m is None:
self.fail(_("Cannot get wait time"))
@@ -184,7 +184,7 @@ class FileserveCom(Hoster):
def handlePremium(self, pyfile):
premium_url = None
- if self.__class__.__name__ == "FileserveCom":
+ if self.getClassName() == "FileserveCom":
# try api download
res = self.load("http://app.fileserve.com/api/download/premium/",
post={"username": self.user,
diff --git a/pyload/plugin/hoster/NoPremiumPl.py b/pyload/plugin/hoster/NoPremiumPl.py
index 8921afe1c..be1e4794e 100644
--- a/pyload/plugin/hoster/NoPremiumPl.py
+++ b/pyload/plugin/hoster/NoPremiumPl.py
@@ -79,7 +79,7 @@ class NoPremiumPl(MultiHoster):
if "errno" in parsed.keys():
if parsed['errno'] in self.ERROR_CODES:
# error code in known
- self.fail(self.ERROR_CODES[parsed['errno']] % self.__class__.__name__)
+ self.fail(self.ERROR_CODES[parsed['errno']] % self.getClassName())
else:
# error code isn't yet added to plugin
self.fail(
diff --git a/pyload/plugin/hoster/RapideoPl.py b/pyload/plugin/hoster/RapideoPl.py
index e19ccc45b..35d4da0ad 100644
--- a/pyload/plugin/hoster/RapideoPl.py
+++ b/pyload/plugin/hoster/RapideoPl.py
@@ -79,7 +79,7 @@ class RapideoPl(MultiHoster):
if "errno" in parsed.keys():
if parsed['errno'] in self.ERROR_CODES:
# error code in known
- self.fail(self.ERROR_CODES[parsed['errno']] % self.__class__.__name__)
+ self.fail(self.ERROR_CODES[parsed['errno']] % self.getClassName())
else:
# error code isn't yet added to plugin
self.fail(
diff --git a/pyload/plugin/hoster/XFileSharingPro.py b/pyload/plugin/hoster/XFileSharingPro.py
index 8274a818a..140a69a72 100644
--- a/pyload/plugin/hoster/XFileSharingPro.py
+++ b/pyload/plugin/hoster/XFileSharingPro.py
@@ -23,13 +23,13 @@ class XFileSharingPro(XFSHoster):
def _log(self, type, args):
msg = " | ".join(str(a).strip() for a in args if a)
logger = getattr(self.log, type)
- logger("%s: %s: %s" % (self.__class__.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
+ logger("%s: %s: %s" % (self.getClassName(), self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
def init(self):
super(XFileSharingPro, self).init()
- self.__pattern = self.core.pluginManager.hosterPlugins[self.__class__.__name__]['pattern']
+ self.__pattern = self.core.pluginManager.hosterPlugins[self.getClassName()]['pattern']
self.HOSTER_DOMAIN = re.match(self.__pattern, self.pyfile.url).group("DOMAIN").lower()
self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.')
diff --git a/pyload/plugin/hoster/Xdcc.py b/pyload/plugin/hoster/Xdcc.py
index e1a4c72b2..6943f495e 100644
--- a/pyload/plugin/hoster/Xdcc.py
+++ b/pyload/plugin/hoster/Xdcc.py
@@ -36,7 +36,7 @@ class Xdcc(Hoster):
def process(self, pyfile):
# change request type
- self.req = pyfile.m.core.requestFactory.getRequest(self.__class__.__name__, type="XDCC")
+ self.req = pyfile.m.core.requestFactory.getRequest(self.getClassName(), type="XDCC")
self.pyfile = pyfile
for _i in xrange(0, 3):
diff --git a/pyload/plugin/internal/MultiHook.py b/pyload/plugin/internal/MultiHook.py
index 8140e2431..dc97ffea9 100644
--- a/pyload/plugin/internal/MultiHook.py
+++ b/pyload/plugin/internal/MultiHook.py
@@ -69,7 +69,7 @@ class MultiHook(Hook):
def initPlugin(self):
- self.pluginname = self.__class__.__name__
+ self.pluginname = self.getClassName()
plugin, self.plugintype = self.core.pluginManager.findPlugin(("hoster", "crypter", "container"), self.pluginname)
if plugin:
diff --git a/pyload/plugin/internal/MultiHoster.py b/pyload/plugin/internal/MultiHoster.py
index a7e74b2ff..8dbcf4f30 100644
--- a/pyload/plugin/internal/MultiHoster.py
+++ b/pyload/plugin/internal/MultiHoster.py
@@ -86,8 +86,8 @@ class MultiHoster(SimpleHoster):
self.retryFree()
elif self.getConfig('revertfailed', True) \
- and "new_module" in self.core.pluginManager.hosterPlugins[self.__class__.__name__]:
- hdict = self.core.pluginManager.hosterPlugins[self.__class__.__name__]
+ and "new_module" in self.core.pluginManager.hosterPlugins[self.getClassName()]:
+ hdict = self.core.pluginManager.hosterPlugins[self.getClassName()]
tmp_module = hdict['new_module']
tmp_name = hdict['new_name']
diff --git a/pyload/plugin/internal/SimpleHoster.py b/pyload/plugin/internal/SimpleHoster.py
index 02231decc..75970d814 100644
--- a/pyload/plugin/internal/SimpleHoster.py
+++ b/pyload/plugin/internal/SimpleHoster.py
@@ -434,7 +434,7 @@ class SimpleHoster(Hoster):
set_cookies(self.req.cj, self.COOKIES)
if (self.MULTI_HOSTER
- and (self.__pattern != self.core.pluginManager.hosterPlugins[self.__class__.__name__]['pattern']
+ and (self.__pattern != self.core.pluginManager.hosterPlugins[self.getClassName()]['pattern']
or re.match(self.__pattern, self.pyfile.url) is None)):
self.multihost = True
return
@@ -746,7 +746,7 @@ class SimpleHoster(Hoster):
return
self.premium = False
self.account = None
- self.req = self.core.requestFactory.getRequest(self.__class__.__name__)
+ self.req = self.core.requestFactory.getRequest(self.getClassName())
self.retries = 0
raise Retry(_("Fallback to free download"))
diff --git a/pyload/plugin/internal/XFSCrypter.py b/pyload/plugin/internal/XFSCrypter.py
index 6a3f09e55..6c3a97405 100644
--- a/pyload/plugin/internal/XFSCrypter.py
+++ b/pyload/plugin/internal/XFSCrypter.py
@@ -31,7 +31,7 @@ class XFSCrypter(SimpleCrypter):
if self.account:
account = self.account
else:
- account_name = (self.__class__.__name__ + ".py").replace("Folder.py", "").replace(".py", "")
+ account_name = (self.getClassName() + ".py").replace("Folder.py", "").replace(".py", "")
account = self.pyfile.m.core.accountManager.getAccountPlugin(account_name)
if account and hasattr(account, "HOSTER_DOMAIN") and account.HOSTER_DOMAIN:
diff --git a/pyload/plugin/internal/XFSHoster.py b/pyload/plugin/internal/XFSHoster.py
index 7b8149bc3..ff8077f81 100644
--- a/pyload/plugin/internal/XFSHoster.py
+++ b/pyload/plugin/internal/XFSHoster.py
@@ -65,7 +65,7 @@ class XFSHoster(SimpleHoster):
if self.account:
account = self.account
else:
- account = self.pyfile.m.core.accountManager.getAccountPlugin(self.__class__.__name__)
+ account = self.pyfile.m.core.accountManager.getAccountPlugin(self.getClassName())
if account and hasattr(account, "HOSTER_DOMAIN") and account.HOSTER_DOMAIN:
self.HOSTER_DOMAIN = account.HOSTER_DOMAIN