summaryrefslogtreecommitdiffstats
path: root/pyload/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-15 16:00:52 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-15 16:00:52 +0100
commit8a54e49327df06a8955fc8850756ca52252f6e4f (patch)
treeec115d8d83d731c03d037997c35af13fdfc2c638 /pyload/plugins
parentUpdate PluginManager (diff)
downloadpyload-8a54e49327df06a8955fc8850756ca52252f6e4f.tar.xz
Code cosmetics
Diffstat (limited to 'pyload/plugins')
-rw-r--r--pyload/plugins/Plugin.py31
-rw-r--r--pyload/plugins/crypter/LinkCryptWs.py4
-rw-r--r--pyload/plugins/crypter/MultiuploadCom.py2
-rw-r--r--pyload/plugins/internal/Addon.py4
-rw-r--r--pyload/plugins/internal/Container.py2
-rw-r--r--pyload/plugins/internal/Crypter.py2
-rw-r--r--pyload/plugins/internal/MultiHoster.py2
-rw-r--r--pyload/plugins/internal/OCR.py2
8 files changed, 20 insertions, 29 deletions
diff --git a/pyload/plugins/Plugin.py b/pyload/plugins/Plugin.py
index a4b4cf74e..0b8e02512 100644
--- a/pyload/plugins/Plugin.py
+++ b/pyload/plugins/Plugin.py
@@ -54,15 +54,11 @@ class Base(object):
def __init__(self, core):
#: Core instance
self.core = core
- #: logging instance
- self.log = core.log
- #: core config
- self.config = core.config
def _log(self, type, args):
msg = " | ".join([str(a).strip() for a in args if a])
- logger = getattr(self.log, type)
+ logger = getattr(self.core.log, type)
logger("%s: %s" % (self.__name__, msg or _("%s MARK" % type.upper())))
@@ -228,21 +224,16 @@ class Plugin(Base):
#: captcha task
self.cTask = None
- self.html = None #@TODO: Move to hoster class
+ self.html = None #@TODO: Move to hoster class in 0.4.10
self.retries = 0
- #: some plugins store html code here
-
- #: quick caller for API
- # self.api = self.core.api
-
self.init()
def getChunkCount(self):
if self.chunkLimit <= 0:
- return self.config['download']['chunks']
- return min(self.config['download']['chunks'], self.chunkLimit)
+ return self.core.config['download']['chunks']
+ return min(self.core.config['download']['chunks'], self.chunkLimit)
def __call__(self):
@@ -607,7 +598,7 @@ class Plugin(Base):
self.pyfile.setStatus("downloading")
- download_folder = self.config['general']['download_folder']
+ download_folder = self.core.config['general']['download_folder']
location = safe_join(download_folder, self.pyfile.package().folder)
@@ -616,8 +607,8 @@ class Plugin(Base):
makedirs(location, int(self.core.config['permission']['folder'], 8))
if self.core.config['permission']['change_dl'] and os.name != "nt":
- uid = getpwnam(self.config['permission']['user'])[2]
- gid = getgrnam(self.config['permission']['group'])[2]
+ uid = getpwnam(self.core.config['permission']['user'])[2]
+ gid = getgrnam(self.core.config['permission']['group'])[2]
chown(location, uid, gid)
except Exception, e:
@@ -656,8 +647,8 @@ class Plugin(Base):
if self.core.config['permission']['change_dl'] and os.name != "nt":
try:
- uid = getpwnam(self.config['permission']['user'])[2]
- gid = getgrnam(self.config['permission']['group'])[2]
+ uid = getpwnam(self.core.config['permission']['user'])[2]
+ gid = getgrnam(self.core.config['permission']['group'])[2]
chown(fs_filename, uid, gid)
except Exception, e:
@@ -732,10 +723,10 @@ class Plugin(Base):
5, 7) and starting: #a download is waiting/starting and was appenrently started before
raise SkipDownload(pyfile.pluginname)
- download_folder = self.config['general']['download_folder']
+ download_folder = self.core.config['general']['download_folder']
location = safe_join(download_folder, pack.folder, self.pyfile.name)
- if starting and self.config['download']['skip_existing'] and exists(location):
+ if starting and self.core.config['download']['skip_existing'] and exists(location):
size = os.stat(location).st_size
if size >= self.pyfile.size:
raise SkipDownload("File exists")
diff --git a/pyload/plugins/crypter/LinkCryptWs.py b/pyload/plugins/crypter/LinkCryptWs.py
index bbcef02fd..4eb48deae 100644
--- a/pyload/plugins/crypter/LinkCryptWs.py
+++ b/pyload/plugins/crypter/LinkCryptWs.py
@@ -188,10 +188,10 @@ class LinkCryptWs(Crypter):
def handleLinkSource(self, type_):
- if type_ is 'cnl':
+ if type_ == 'cnl':
return self.handleCNL2()
- elif type_ is 'web':
+ elif type_ == 'web':
return self.handleWebLinks()
elif type_ in ('rsdf', 'ccf', 'dlc'):
diff --git a/pyload/plugins/crypter/MultiuploadCom.py b/pyload/plugins/crypter/MultiuploadCom.py
index 61295bc85..713d67c18 100644
--- a/pyload/plugins/crypter/MultiuploadCom.py
+++ b/pyload/plugins/crypter/MultiuploadCom.py
@@ -10,6 +10,6 @@ class MultiuploadCom(DeadCrypter):
__pattern__ = r'http://(?:www\.)?multiupload\.(com|nl)/\w+'
- __description__ = """ MultiUpload.com decrypter plugin """
+ __description__ = """MultiUpload.com decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
diff --git a/pyload/plugins/internal/Addon.py b/pyload/plugins/internal/Addon.py
index 1aa51c69a..e0be3097e 100644
--- a/pyload/plugins/internal/Addon.py
+++ b/pyload/plugins/internal/Addon.py
@@ -30,7 +30,7 @@ class Addon(Base):
__config__ = [] #: [("name", "type", "desc", "default")]
- __description__ = """Interface for addon"""
+ __description__ = """Base addon/hook plugin"""
__license__ = "GPLv3"
__authors__ = [("mkaay", "mkaay@mkaay.de"),
("RaNaN", "RaNaN@pyload.org")]
@@ -113,7 +113,7 @@ class Addon(Base):
def isActivated(self):
""" checks if addon is activated"""
- return self.config.getPlugin(self.__name__, "activated")
+ return self.core.config.getPlugin(self.__name__, "activated")
#event methods - overwrite these if needed
diff --git a/pyload/plugins/internal/Container.py b/pyload/plugins/internal/Container.py
index 4bd6644f9..b7dd3aa20 100644
--- a/pyload/plugins/internal/Container.py
+++ b/pyload/plugins/internal/Container.py
@@ -43,7 +43,7 @@ class Container(Crypter):
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)
+ self.pyfile.url = safe_join(self.core.config['general']['download_folder'], self.pyfile.name)
try:
with open(self.pyfile.url, "wb") as f:
f.write(content)
diff --git a/pyload/plugins/internal/Crypter.py b/pyload/plugins/internal/Crypter.py
index ed92357a5..4fae07ff1 100644
--- a/pyload/plugins/internal/Crypter.py
+++ b/pyload/plugins/internal/Crypter.py
@@ -63,7 +63,7 @@ class Crypter(Plugin):
package_password = self.pyfile.package().password
package_queue = self.pyfile.package().queue
- folder_per_package = self.config['general']['folder_per_package']
+ folder_per_package = self.core.config['general']['folder_per_package']
try:
use_subfolder = self.getConfig('use_subfolder')
except:
diff --git a/pyload/plugins/internal/MultiHoster.py b/pyload/plugins/internal/MultiHoster.py
index 88a9c888b..02594e04e 100644
--- a/pyload/plugins/internal/MultiHoster.py
+++ b/pyload/plugins/internal/MultiHoster.py
@@ -11,7 +11,7 @@ class MultiHoster(Addon):
__type__ = "addon"
__version__ = "0.20"
- __description__ = """Generic MultiHoster plugin"""
+ __description__ = """Base multi-hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("pyLoad Team", "admin@pyload.org")]
diff --git a/pyload/plugins/internal/OCR.py b/pyload/plugins/internal/OCR.py
index b5ee30cb7..dec9f28b7 100644
--- a/pyload/plugins/internal/OCR.py
+++ b/pyload/plugins/internal/OCR.py
@@ -18,7 +18,7 @@ class OCR(object):
__type__ = "ocr"
__version__ = "0.01"
- __description__ = """OCR base plugin"""
+ __description__ = """Base OCR plugin"""
__license__ = "GPLv3"
__authors__ = [("pyLoad Team", "admin@pyload.org")]