summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-19 11:44:49 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-19 11:44:49 +0200
commit56389e28ba5d2f5658278bc7f486d73be747f135 (patch)
treeac51ad216508487294b15fcaebc813b3add5c393 /module/plugins/internal
parentCode cosmetics (3) (diff)
downloadpyload-56389e28ba5d2f5658278bc7f486d73be747f135.tar.xz
Rename self.core to self.pyload (plugins only)
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/Account.py13
-rw-r--r--module/plugins/internal/Addon.py9
-rw-r--r--module/plugins/internal/Captcha.py3
-rw-r--r--module/plugins/internal/Container.py2
-rw-r--r--module/plugins/internal/Crypter.py10
-rw-r--r--module/plugins/internal/Extractor.py6
-rw-r--r--module/plugins/internal/Hoster.py55
-rw-r--r--module/plugins/internal/MultiHook.py22
-rw-r--r--module/plugins/internal/MultiHoster.py4
-rw-r--r--module/plugins/internal/OCR.py3
-rw-r--r--module/plugins/internal/Plugin.py66
-rw-r--r--module/plugins/internal/SevenZip.py2
-rw-r--r--module/plugins/internal/SimpleCrypter.py2
-rw-r--r--module/plugins/internal/SimpleHoster.py8
-rw-r--r--module/plugins/internal/UnRar.py4
-rw-r--r--module/plugins/internal/XFSCrypter.py2
-rw-r--r--module/plugins/internal/XFSHoster.py2
17 files changed, 91 insertions, 122 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index db0002d09..72981a108 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -24,7 +24,8 @@ class Account(Plugin):
def __init__(self, manager, accounts):
- super(Account, self).__init__(manager.core)
+ self.pyload = manager.core
+ self.info = {} #: Provide information in dict here
self.manager = manager
self.accounts = {}
@@ -78,7 +79,7 @@ class Account(Plugin):
_("Could not login with account %(user)s | %(msg)s") % {'user': user,
'msg': e})
success = data['valid'] = False
- if self.core.debug:
+ if self.pyload.debug:
traceback.print_exc()
else:
@@ -175,7 +176,7 @@ class Account(Plugin):
infos = super(self.__class__, self).load_account_info(name, self.req)
infos['error'] = str(e)
- if self.core.debug:
+ if self.pyload.debug:
traceback.print_exc()
finally:
@@ -236,7 +237,7 @@ class Account(Plugin):
if not user:
user, data = self.select_account()
- return self.core.requestFactory.getRequest(self.__name__, user)
+ return self.pyload.requestFactory.getRequest(self.__name__, user)
def get_account_cookies(self, user=None):
@@ -245,7 +246,7 @@ class Account(Plugin):
if not user:
return None
- cj = self.core.requestFactory.getCookieJar(self.__name__, user)
+ cj = self.pyload.requestFactory.getCookieJar(self.__name__, user)
return cj
@@ -323,7 +324,7 @@ class Account(Plugin):
Add task to refresh account info to sheduler
"""
self.log_debug("Scheduled Account refresh for %s in %s seconds." % (user, time))
- self.core.scheduler.addJob(time, self.get_account_info, [user, force])
+ self.pyload.scheduler.addJob(time, self.get_account_info, [user, force])
#: Deprecated method, use `schedule_refresh` instead
diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py
index f3da5272f..a6bf685b5 100644
--- a/module/plugins/internal/Addon.py
+++ b/module/plugins/internal/Addon.py
@@ -36,7 +36,8 @@ class Addon(Plugin):
def __init__(self, core, manager):
- super(Addon, self).__init__(core)
+ self.pyload = core
+ self.info = {} #: Provide information in dict here
#: `HookManager`
self.manager = manager
@@ -78,7 +79,7 @@ class Addon(Plugin):
def init_periodical(self, delay=0, threaded=False):
- self.cb = self.core.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded)
+ self.cb = self.pyload.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded)
#: Deprecated method, use `init_periodical` instead
@@ -96,10 +97,10 @@ class Addon(Plugin):
except Exception, e:
self.log_error(_("Error executing addon: %s") % e)
- if self.core.debug:
+ if self.pyload.debug:
traceback.print_exc()
- self.cb = self.core.scheduler.addJob(self.interval, self._periodical, [threaded], threaded=threaded)
+ self.cb = self.pyload.scheduler.addJob(self.interval, self._periodical, [threaded], threaded=threaded)
def periodical(self):
diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py
index 1309b0d6b..6ca754a06 100644
--- a/module/plugins/internal/Captcha.py
+++ b/module/plugins/internal/Captcha.py
@@ -14,7 +14,8 @@ class Captcha(Plugin):
def __init__(self, plugin):
- super(Captcha, self).__init__(plugin.core)
+ self.pyload = plugin.core
+ self.info = {} #: Provide information in dict here
self.plugin = plugin
self.key = None #: Last key detected
diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py
index 91b5a6f76..2c092f98a 100644
--- a/module/plugins/internal/Container.py
+++ b/module/plugins/internal/Container.py
@@ -45,7 +45,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 = fs_join(self.core.config.get("general", "download_folder"), self.pyfile.name)
+ self.pyfile.url = fs_join(self.pyload.config.get("general", "download_folder"), self.pyfile.name)
try:
with open(self.pyfile.url, "wb") as f:
f.write(content)
diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py
index 9ad16ece8..653469079 100644
--- a/module/plugins/internal/Crypter.py
+++ b/module/plugins/internal/Crypter.py
@@ -56,7 +56,7 @@ class Crypter(Hoster):
"""
Generate new packages from self.urls
"""
- packages = [(name, links, None) for name, links in self.core.api.generatePackages(self.urls).iteritems()]
+ packages = [(name, links, None) for name, links in self.pyload.api.generatePackages(self.urls).iteritems()]
self.packages.extend(packages)
@@ -68,7 +68,7 @@ class Crypter(Hoster):
package_password = self.pyfile.package().password
package_queue = self.pyfile.package().queue
- folder_per_package = self.core.config.get("general", "folder_per_package")
+ folder_per_package = self.pyload.config.get("general", "folder_per_package")
use_subfolder = self.get_config('use_subfolder', folder_per_package)
subfolder_per_package = self.get_config('subfolder_per_package', True)
@@ -77,13 +77,13 @@ class Crypter(Hoster):
"%d links" % len(links),
"Saved to folder: %s" % folder if folder else "Saved to download folder")
- pid = self.core.api.addPackage(name, self.fixurl(links), package_queue)
+ pid = self.pyload.api.addPackage(name, self.fixurl(links), package_queue)
if package_password:
- self.core.api.setPackageData(pid, {'password': package_password})
+ self.pyload.api.setPackageData(pid, {'password': package_password})
#: Workaround to do not break API addPackage method
- setFolder = lambda x: self.core.api.setPackageData(pid, {'folder': x or ""})
+ setFolder = lambda x: self.pyload.api.setPackageData(pid, {'folder': x or ""})
if use_subfolder:
if not subfolder_per_package:
diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py
index 39220508e..97c2c63b1 100644
--- a/module/plugins/internal/Extractor.py
+++ b/module/plugins/internal/Extractor.py
@@ -85,7 +85,9 @@ class Extractor(Plugin):
"""
Initialize extractor for specific file
"""
- self.manager = manager
+ self.pyload = manager.core
+ self.info = {} #: Provide information in dict here
+
self.filename = filename
self.out = out
self.fullpath = fullpath
@@ -96,7 +98,7 @@ class Extractor(Plugin):
self.keepbroken = keepbroken
self.files = [] #: Store extracted files here
- pyfile = self.manager.core.files.getFile(fid) if fid else None
+ pyfile = self.pyload.files.getFile(fid) if fid else None
self.notify_progress = lambda x: pyfile.setProgress(x) if pyfile else lambda x: None
self.init()
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 497df00f3..f5566fb6e 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -59,7 +59,8 @@ class Hoster(Plugin):
def __init__(self, pyfile):
- super(Hoster, self).__init__(pyfile.m.core)
+ self.pyload = pyfile.m.core
+ self.info = {} #: Provide information in dict here
#: Engage wan reconnection
self.want_reconnect = False
@@ -118,7 +119,7 @@ class Hoster(Plugin):
self.last_check = None
#: Js engine, see `JsEngine`
- self.js = self.core.js
+ self.js = self.pyload.js
#: Captcha task
self.c_task = None
@@ -187,8 +188,8 @@ class Hoster(Plugin):
def get_chunk_count(self):
if self.chunk_limit <= 0:
- return self.core.config.get("download", "chunks")
- return min(self.core.config.get("download", "chunks"), self.chunk_limit)
+ return self.pyload.config.get("download", "chunks")
+ return min(self.pyload.config.get("download", "chunks"), self.chunk_limit)
def reset_account(self):
@@ -196,7 +197,7 @@ class Hoster(Plugin):
Don't use account and retry download
"""
self.account = None
- self.req = self.core.requestFactory.getRequest(self.__name__)
+ self.req = self.pyload.requestFactory.getRequest(self.__name__)
self.retry()
@@ -363,10 +364,10 @@ class Hoster(Plugin):
with open(os.path.join("tmp", "tmpCaptcha_%s_%s.%s" % (self.__name__, id, imgtype)), "wb") as tmpCaptcha:
tmpCaptcha.write(img)
- has_plugin = self.__name__ in self.core.pluginManager.ocrPlugins
+ has_plugin = self.__name__ in self.pyload.pluginManager.ocrPlugins
- if self.core.captcha:
- Ocr = self.core.pluginManager.loadClass("ocr", self.__name__)
+ if self.pyload.captcha:
+ Ocr = self.pyload.pluginManager.loadClass("ocr", self.__name__)
else:
Ocr = None
@@ -378,7 +379,7 @@ class Hoster(Plugin):
ocr = Ocr()
result = ocr.get_captcha(tmpCaptcha.name)
else:
- captchaManager = self.core.captchaManager
+ captchaManager = self.pyload.captchaManager
task = captchaManager.newTask(img, imgtype, tmpCaptcha.name, result_type)
self.c_task = task
captchaManager.handleCaptcha(task)
@@ -401,7 +402,7 @@ class Hoster(Plugin):
result = task.result
self.log_debug("Received captcha result: %s" % result)
- if not self.core.debug:
+ if not self.pyload.debug:
try:
os.remove(tmpCaptcha.name)
except Exception:
@@ -442,8 +443,8 @@ class Hoster(Plugin):
if not url or not isinstance(url, basestring):
self.fail(_("No url given"))
- if self.core.debug:
- self.log_debug("Download url " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
+ if self.pyload.debug:
+ self.log_debug("DOWNLOAD URL " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
self.correct_captcha()
self.check_for_same_files()
@@ -453,17 +454,17 @@ class Hoster(Plugin):
if disposition:
self.pyfile.name = urlparse.urlparse(url).path.split('/')[-1] or self.pyfile.name
- download_folder = self.core.config.get("general", "download_folder")
+ download_folder = self.pyload.config.get("general", "download_folder")
location = fs_join(download_folder, self.pyfile.package().folder)
if not os.path.exists(location):
try:
- os.makedirs(location, int(self.core.config.get("permission", "folder"), 8))
+ os.makedirs(location, int(self.pyload.config.get("permission", "folder"), 8))
- if self.core.config.get("permission", "change_dl") and os.name != "nt":
- uid = pwd.getpwnam(self.core.config.get("permission", "user"))[2]
- gid = grp.getgrnam(self.core.config.get("permission", "group"))[2]
+ if self.pyload.config.get("permission", "change_dl") and os.name != "nt":
+ uid = pwd.getpwnam(self.pyload.config.get("permission", "user"))[2]
+ gid = grp.getgrnam(self.pyload.config.get("permission", "group"))[2]
os.chown(location, uid, gid)
except Exception, e:
@@ -475,7 +476,7 @@ class Hoster(Plugin):
filename = os.path.join(location, name)
- self.core.addonManager.dispatchEvent("download-start", self.pyfile, url, filename)
+ self.pyload.addonManager.dispatchEvent("download-start", self.pyfile, url, filename)
try:
newname = self.req.httpDownload(url, filename, get=get, post=post, ref=ref, cookies=cookies,
@@ -494,16 +495,16 @@ class Hoster(Plugin):
fs_filename = fs_encode(filename)
- if self.core.config.get("permission", "change_file"):
+ if self.pyload.config.get("permission", "change_file"):
try:
- os.chmod(fs_filename, int(self.core.config.get("permission", "file"), 8))
+ os.chmod(fs_filename, int(self.pyload.config.get("permission", "file"), 8))
except Exception, e:
self.log_warning(_("Setting file mode failed"), e)
- if self.core.config.get("permission", "change_dl") and os.name != "nt":
+ if self.pyload.config.get("permission", "change_dl") and os.name != "nt":
try:
- uid = pwd.getpwnam(self.core.config.get("permission", "user"))[2]
- gid = grp.getgrnam(self.core.config.get("permission", "group"))[2]
+ uid = pwd.getpwnam(self.pyload.config.get("permission", "user"))[2]
+ gid = grp.getgrnam(self.pyload.config.get("permission", "group"))[2]
os.chown(fs_filename, uid, gid)
except Exception, e:
@@ -695,22 +696,22 @@ class Hoster(Plugin):
"""
pack = self.pyfile.package()
- for pyfile in self.core.files.cache.values():
+ for pyfile in self.pyload.files.cache.values():
if pyfile != self.pyfile and pyfile.name == self.pyfile.name and pyfile.package().folder == pack.folder:
if pyfile.status in (0, 12): #: Finished or downloading
self.skip(pyfile.pluginname)
elif pyfile.status in (5, 7) and starting: #: A download is waiting/starting and was appenrently started before
self.skip(pyfile.pluginname)
- download_folder = self.core.config.get("general", "download_folder")
+ download_folder = self.pyload.config.get("general", "download_folder")
location = fs_join(download_folder, pack.folder, self.pyfile.name)
- if starting and self.core.config.get("download", "skip_existing") and os.path.exists(location):
+ if starting and self.pyload.config.get("download", "skip_existing") and os.path.exists(location):
size = os.stat(location).st_size
if size >= self.pyfile.size:
self.skip("File exists")
- pyfile = self.core.db.findDuplicates(self.pyfile.id, self.pyfile.package().folder, self.pyfile.name)
+ pyfile = self.pyload.db.findDuplicates(self.pyfile.id, self.pyfile.package().folder, self.pyfile.name)
if pyfile:
if os.path.exists(location):
self.skip(pyfile[0])
diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py
index 127d83ab5..4e6b0cf95 100644
--- a/module/plugins/internal/MultiHook.py
+++ b/module/plugins/internal/MultiHook.py
@@ -70,10 +70,10 @@ class MultiHook(Hook):
def init_plugin(self):
self.pluginname = self.__name__.rsplit("Hook", 1)[0]
- plugin, self.plugintype = self.core.pluginManager.findPlugin(self.pluginname)
+ plugin, self.plugintype = self.pyload.pluginManager.findPlugin(self.pluginname)
if plugin:
- self.pluginmodule = self.core.pluginManager.loadModule(self.plugintype, self.pluginname)
+ self.pluginmodule = self.pyload.pluginManager.loadModule(self.plugintype, self.pluginname)
self.pluginclass = getattr(self.pluginmodule, self.pluginname)
else:
self.log_warning(_("Hook plugin will be deactivated due missing plugin reference"))
@@ -81,7 +81,7 @@ class MultiHook(Hook):
def load_account(self):
- self.account = self.core.accountManager.getAccountPlugin(self.pluginname)
+ self.account = self.pyload.accountManager.getAccountPlugin(self.pluginname)
if self.account and not self.account.can_use():
self.account = None
@@ -161,7 +161,7 @@ class MultiHook(Hook):
if self.get_config('reload', True):
self.interval = max(self.get_config('reloadinterval', 12) * 60 * 60, self.MIN_RELOAD_INTERVAL)
else:
- self.core.scheduler.removeJob(self.cb)
+ self.pyload.scheduler.removeJob(self.cb)
self.cb = None
self.log_info(_("Reloading supported %s list") % self.plugintype)
@@ -186,11 +186,11 @@ class MultiHook(Hook):
excludedList = []
if self.plugintype == "hoster":
- pluginMap = dict((name.lower(), name) for name in self.core.pluginManager.hosterPlugins.iterkeys())
- accountList = [account.type.lower() for account in self.core.api.getAccounts(False) if account.valid and account.premium]
+ pluginMap = dict((name.lower(), name) for name in self.pyload.pluginManager.hosterPlugins.iterkeys())
+ accountList = [account.type.lower() for account in self.pyload.api.getAccounts(False) if account.valid and account.premium]
else:
pluginMap = {}
- accountList = [name[::-1].replace("Folder"[::-1], "", 1).lower()[::-1] for name in self.core.pluginManager.crypterPlugins.iterkeys()]
+ accountList = [name[::-1].replace("Folder"[::-1], "", 1).lower()[::-1] for name in self.pyload.pluginManager.crypterPlugins.iterkeys()]
for plugin in self.plugins_cached():
name = remove_chars(plugin, "-.")
@@ -211,7 +211,7 @@ class MultiHook(Hook):
self.log_debug("Overwritten %ss: %s" % (self.plugintype, ", ".join(sorted(self.supported))))
for plugin in self.supported:
- hdict = self.core.pluginManager.plugins[self.plugintype][plugin]
+ hdict = self.pyload.pluginManager.plugins[self.plugintype][plugin]
hdict['new_module'] = self.pluginmodule
hdict['new_name'] = self.pluginname
@@ -230,13 +230,13 @@ class MultiHook(Hook):
self.log_debug("Regexp: %s" % regexp)
- hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname]
+ hdict = self.pyload.pluginManager.plugins[self.plugintype][self.pluginname]
hdict['pattern'] = regexp
hdict['re'] = re.compile(regexp)
def unload_plugin(self, plugin):
- hdict = self.core.pluginManager.plugins[self.plugintype][plugin]
+ hdict = self.pyload.pluginManager.plugins[self.plugintype][plugin]
if "module" in hdict:
hdict.pop('module', None)
@@ -253,7 +253,7 @@ class MultiHook(Hook):
self.unload_plugin(plugin)
#: Reset pattern
- hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname]
+ hdict = self.pyload.pluginManager.plugins[self.plugintype][self.pluginname]
hdict['pattern'] = getattr(self.pluginclass, "__pattern__", r'^unmatchable$')
hdict['re'] = re.compile(hdict['pattern'])
diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py
index 7bba2f6d3..5ce880cde 100644
--- a/module/plugins/internal/MultiHoster.py
+++ b/module/plugins/internal/MultiHoster.py
@@ -87,8 +87,8 @@ class MultiHoster(SimpleHoster):
self.retry_free()
elif self.get_config("revertfailed", True) \
- and "new_module" in self.core.pluginManager.hosterPlugins[self.__name__]:
- hdict = self.core.pluginManager.hosterPlugins[self.__name__]
+ and "new_module" in self.pyload.pluginManager.hosterPlugins[self.__name__]:
+ hdict = self.pyload.pluginManager.hosterPlugins[self.__name__]
tmp_module = hdict['new_module']
tmp_name = hdict['new_name']
diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py
index a00f53947..c5cf5c2e9 100644
--- a/module/plugins/internal/OCR.py
+++ b/module/plugins/internal/OCR.py
@@ -28,6 +28,9 @@ class OCR(Plugin):
def __init__(self):
+ self.pyload = pyfile.m.core
+ self.info = {} #: Provide information in dict here
+
self.logger = logging.getLogger("log")
self.init()
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 7dec6344e..74f5e7c6d 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -121,8 +121,8 @@ class Plugin(object):
def __init__(self, core):
- self.core = core
- self.info = {} #: Provide information in dict here
+ self.pyload = core
+ self.info = {} #: Provide information in dict here
self.init()
@@ -134,7 +134,7 @@ class Plugin(object):
def _log(self, level, args):
- log = getattr(self.core.log, level)
+ log = getattr(self.pyload.log, level)
msg = fs_encode(" | ".join((a if isinstance(a, basestring) else str(a)).strip() for a in args if a)) #@NOTE: `fs_encode` -> `encode` in 0.4.10
log("%(plugin)s%(id)s: %(msg)s" % {'plugin': self.__name__,
'id' : ("[%s]" % self.pyfile.id) if hasattr(self, 'pyfile') else "",
@@ -142,7 +142,7 @@ class Plugin(object):
def log_debug(self, *args):
- if self.core.debug:
+ if self.pyload.debug:
return self._log("debug", args)
@@ -170,15 +170,7 @@ class Plugin(object):
:param value:
:return:
"""
- self.core.config.setPlugin(self.__name__, option, value)
-
-
- #: Deprecated method, use `set_config` instead
- def setConf(self, *args, **kwargs):
- """
- See `set_config`
- """
- return self.set_config(*args, **kwargs)
+ self.pyload.config.setPlugin(self.__name__, option, value)
def get_config(self, option, default="", plugin=None):
@@ -189,64 +181,32 @@ class Plugin(object):
:return:
"""
try:
- return self.core.config.getPlugin(plugin or self.__name__, option)
+ return self.pyload.config.getPlugin(plugin or self.__name__, option)
except KeyError:
self.log_warning(_("Config option or plugin not found"))
return default
- #: Deprecated method, use `get_config` instead
- def getConf(self, *args, **kwargs):
- """
- See `get_config`
- """
- return self.get_config(*args, **kwargs)
-
-
def store(self, key, value):
"""
Saves a value persistently to the database
"""
- self.core.db.setStorage(self.__name__, key, value)
-
-
- #: Deprecated method, use `store` instead
- def setStorage(self, *args, **kwargs):
- """
- Same as `store`
- """
- return self.store(*args, **kwargs)
+ self.pyload.db.setStorage(self.__name__, key, value)
def retrieve(self, key, default=None):
"""
Retrieves saved value or dict of all saved entries if key is None
"""
- return self.core.db.getStorage(self.__name__, key) or default
-
-
- #: Deprecated method, use `retrieve` instead
- def getStorage(self, *args, **kwargs):
- """
- Same as `retrieve`
- """
- return self.retrieve(*args, **kwargs)
+ return self.pyload.db.getStorage(self.__name__, key) or default
def delete(self, key):
"""
Delete entry in db
"""
- self.core.db.delStorage(self.__name__, key)
-
-
- #: Deprecated method, use `delete` instead
- def delStorage(self, *args, **kwargs):
- """
- Same as `delete`
- """
- return self.delete(*args, **kwargs)
+ self.pyload.db.delStorage(self.__name__, key)
def fail(self, reason):
@@ -288,21 +248,21 @@ class Plugin(object):
if not url or not isinstance(url, basestring):
self.fail(_("No url given"))
- if self.core.debug:
- self.log_debug("Load url " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
+ if self.pyload.debug:
+ self.log_debug("LOAD URL " + url, *["%s=%s" % (key, val) for key, val in locals().iteritems() if key not in ("self", "url")])
if req is None:
if hasattr(self, "req"):
req = self.req
else:
- req = self.core.requestFactory.getRequest(self.__name__)
+ req = self.pyload.requestFactory.getRequest(self.__name__)
res = req.load(url, get, post, ref, cookies, just_header, multipart, bool(decode))
if decode:
res = html_unescape(res).decode(decode if isinstance(decode, basestring) else 'utf8')
- if self.core.debug:
+ if self.pyload.debug:
frame = inspect.currentframe()
framefile = fs_join("tmp", self.__name__, "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno))
try:
diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py
index c76ef43e2..395025bc1 100644
--- a/module/plugins/internal/SevenZip.py
+++ b/module/plugins/internal/SevenZip.py
@@ -147,7 +147,7 @@ class SevenZip(UnRar):
#@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue
call = [self.CMD, command] + args + list(xargs)
- self.manager.log_debug(" ".join(call))
+ self.log_debug(" ".join(call))
p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return p
diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py
index cd447db6b..b249e112d 100644
--- a/module/plugins/internal/SimpleCrypter.py
+++ b/module/plugins/internal/SimpleCrypter.py
@@ -53,7 +53,7 @@ class SimpleCrypter(Crypter, SimpleHoster):
#@TODO: Remove in 0.4.10
def init(self):
account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "")
- account = self.core.accountManager.getAccountPlugin(account_name)
+ account = self.pyload.accountManager.getAccountPlugin(account_name)
if account and account.can_use():
self.user, data = account.select_account()
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 40489d404..3003723a6 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -231,7 +231,7 @@ class SimpleHoster(Hoster):
self.LINK_PREMIUM_PATTERN = self.LINK_PATTERN
if (self.MULTI_HOSTER
- and (self.__pattern__ != self.core.pluginManager.hosterPlugins[self.__name__]['pattern']
+ and (self.__pattern__ != self.pyload.pluginManager.hosterPlugins[self.__name__]['pattern']
or re.match(self.__pattern__, self.pyfile.url) is None)):
self.multihost = True
return
@@ -499,8 +499,8 @@ class SimpleHoster(Hoster):
#: Deprecated method
- def getFileInfo(self):
- self.info = {}
+ def get_fileInfo(self):
+ self.info = {}
self.check_info()
return self.info
@@ -548,5 +548,5 @@ class SimpleHoster(Hoster):
return
self.premium = False
self.account = None
- self.req = self.core.requestFactory.getRequest(self.__name__)
+ self.req = self.pyload.requestFactory.getRequest(self.__name__)
raise Retry(_("Fallback to free download"))
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index abd94b4df..8f6038d64 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -191,7 +191,7 @@ class UnRar(Extractor):
raise ArchiveError(_("Cannot open file"))
if err.strip(): #: Only log error at this point
- self.manager.log_error(err.strip())
+ self.log_error(err.strip())
result = set()
if not self.fullpath and self.VERSION.startswith('5'):
@@ -237,7 +237,7 @@ class UnRar(Extractor):
#@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue
call = [self.CMD, command] + args + list(xargs)
- self.manager.log_debug(" ".join(call))
+ self.log_debug(" ".join(call))
p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return p
diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py
index c371e97f5..a10256a55 100644
--- a/module/plugins/internal/XFSCrypter.py
+++ b/module/plugins/internal/XFSCrypter.py
@@ -32,7 +32,7 @@ class XFSCrypter(SimpleCrypter):
account = self.account
else:
account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "")
- account = self.core.accountManager.getAccountPlugin(account_name)
+ account = self.pyload.accountManager.getAccountPlugin(account_name)
if account and hasattr(account, "HOSTER_DOMAIN") and account.HOSTER_DOMAIN:
self.HOSTER_DOMAIN = account.HOSTER_DOMAIN
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index d4810f8b7..8adda0cd9 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -63,7 +63,7 @@ class XFSHoster(SimpleHoster):
if self.account:
account = self.account
else:
- account = self.core.accountManager.getAccountPlugin(self.__name__)
+ account = self.pyload.accountManager.getAccountPlugin(self.__name__)
if account and hasattr(account, "HOSTER_DOMAIN") and account.HOSTER_DOMAIN:
self.HOSTER_DOMAIN = account.HOSTER_DOMAIN