summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/Plugin.py
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 /pyload/plugin/Plugin.py
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
Diffstat (limited to 'pyload/plugin/Plugin.py')
-rw-r--r--pyload/plugin/Plugin.py28
1 files changed, 14 insertions, 14 deletions
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