diff options
Diffstat (limited to 'module/plugins')
59 files changed, 229 insertions, 260 deletions
diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py index ca77f0c00..d283658b0 100644 --- a/module/plugins/container/CCF.py +++ b/module/plugins/container/CCF.py @@ -32,7 +32,7 @@ class CCF(Container): 'filename': "test.ccf", 'upload' : open(fs_filename, "rb")}).read() - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") dlc_file = fs_join(download_folder, "tmp_%s.dlc" % pyfile.name) try: diff --git a/module/plugins/crypter/DailymotionComFolder.py b/module/plugins/crypter/DailymotionComFolder.py index 688a880cb..a84934a40 100644 --- a/module/plugins/crypter/DailymotionComFolder.py +++ b/module/plugins/crypter/DailymotionComFolder.py @@ -100,6 +100,6 @@ class DailymotionComFolder(Crypter): for p_id, p_name, p_owner in playlists: p_videos = self.get_videos(p_id) - p_folder = fs_join(self.core.config.get("general", "download_folder"), p_owner, p_name) + p_folder = fs_join(self.pyload.config.get("general", "download_folder"), p_owner, p_name) self.log_debug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) self.packages.append((p_name, p_videos, p_folder)) #: Folder is NOT recognized by pyload 0.4.9! diff --git a/module/plugins/crypter/Dereferer.py b/module/plugins/crypter/Dereferer.py index 88d9aab85..2854c2b29 100644 --- a/module/plugins/crypter/Dereferer.py +++ b/module/plugins/crypter/Dereferer.py @@ -30,7 +30,7 @@ class Dereferer(SimpleCrypter): def init(self): super(Dereferer, self).init() - self.__pattern__ = self.core.pluginManager.crypterPlugins[self.__name__]['pattern'] #@TODO: Recheck in 0.4.10 + self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['pattern'] #@TODO: Recheck in 0.4.10 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/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index f7eec388b..9d4332f25 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -249,7 +249,7 @@ class LinkCryptWs(Crypter): package_name, folder_name = self.get_package_info() self.log_debug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1))) - self.core.api.uploadContainer('.'.join([package_name, type]), self.load(clink.group(1))) + self.pyload.api.uploadContainer('.'.join([package_name, type]), self.load(clink.group(1))) return "Found it" return package_links diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 77d5eff50..8c4d4eba0 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -219,7 +219,7 @@ class RelinkUs(Crypter): try: dlc = self.load(container_url) dlc_filename = self.fileid + ".dlc" - dlc_filepath = fs_join(self.core.config.get("general", "download_folder"), dlc_filename) + dlc_filepath = fs_join(self.pyload.config.get("general", "download_folder"), dlc_filename) with open(dlc_filepath, "wb") as f: f.write(dlc) package_links.append(dlc_filepath) diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py index a7af1f0b0..a68ebd77e 100644 --- a/module/plugins/crypter/XFileSharingProFolder.py +++ b/module/plugins/crypter/XFileSharingProFolder.py @@ -26,12 +26,12 @@ class XFileSharingProFolder(XFSCrypter): def init(self): super(XFileSharingProFolder, self).init() - self.__pattern__ = self.core.pluginManager.crypterPlugins[self.__name__]['pattern'] + self.__pattern__ = self.pyload.pluginManager.crypterPlugins[self.__name__]['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 != '.') - account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) + account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME) if account and account.can_use(): self.account = account diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py index 4d941f2b9..6cbee3585 100644 --- a/module/plugins/crypter/YoutubeComFolder.py +++ b/module/plugins/crypter/YoutubeComFolder.py @@ -131,7 +131,7 @@ class YoutubeComFolder(Crypter): for p in playlists: p_name = p['title'] p_videos = self.get_videos_id(p['id']) - p_folder = fs_join(self.core.config.get("general", "download_folder"), p['channelTitle'], p_name) + p_folder = fs_join(self.pyload.config.get("general", "download_folder"), p['channelTitle'], p_name) self.log_debug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) if not p_videos: diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index e6ddac546..ce3ac9b4c 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -49,7 +49,7 @@ class AndroidPhoneNotify(Addon): if not self.get_config('notifyexit'): return - if self.core.do_restart: + if self.pyload.do_restart: self.notify(_("Restarting pyLoad")) else: self.notify(_("Exiting pyLoad")) @@ -71,7 +71,7 @@ class AndroidPhoneNotify(Addon): if not self.get_config('notifyprocessed'): return - if any(True for pdata in self.core.api.getQueue() if pdata.linksdone < pdata.linkstotal): + if any(True for pdata in self.pyload.api.getQueue() if pdata.linksdone < pdata.linkstotal): self.notify(_("Package failed"), _("One or more packages was not completed successfully")) else: self.notify(_("All packages finished")) @@ -87,7 +87,7 @@ class AndroidPhoneNotify(Addon): if not key: return - if self.core.isClientConnected() and not self.get_config('ignoreclient'): + if self.pyload.isClientConnected() and not self.get_config('ignoreclient'): return elapsed_time = time.time() - self.last_notify diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index 8a47da5bd..2ef3033c4 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -99,7 +99,7 @@ class BypassCaptcha(Hook): if not self.get_config('passkey'): return False - if self.core.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.get_config('check_client'): return False if self.get_credits() > 0: diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index ec989ae51..8006d9462 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -161,7 +161,7 @@ class Captcha9Kw(Hook): if not self.get_config('passkey'): return - if self.core.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.get_config('check_client'): return credits = self.get_credits() diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 1660e2059..946ee2372 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -137,7 +137,7 @@ class CaptchaBrotherhood(Hook): if not self.get_config('username') or not self.get_config('password'): return False - if self.core.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.get_config('check_client'): return False if self.get_credits() > 10: diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 29263a180..3110f6d66 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -102,7 +102,7 @@ class Checksum(Addon): self.check_failed(pyfile, None, "No file downloaded") local_file = fs_encode(pyfile.plugin.lastDownload) - # download_folder = self.core.config.get("general", "download_folder") + # download_folder = self.pyload.config.get("general", "download_folder") # local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) if not os.path.isfile(local_file): @@ -163,7 +163,7 @@ class Checksum(Addon): def package_finished(self, pypack): - download_folder = fs_join(self.core.config.get("general", "download_folder"), pypack.folder, "") + download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder, "") for link in pypack.getChildren().itervalues(): file_type = os.path.splitext(link['name'])[1][1:].lower() diff --git a/module/plugins/hooks/ClickAndLoad.py b/module/plugins/hooks/ClickAndLoad.py index 61e28f469..f6c226225 100644 --- a/module/plugins/hooks/ClickAndLoad.py +++ b/module/plugins/hooks/ClickAndLoad.py @@ -42,11 +42,11 @@ class ClickAndLoad(Addon): def activate(self): - if not self.core.config.get("webinterface", "activated"): + if not self.pyload.config.get("webinterface", "activated"): return ip = "" if self.get_config('extern') else "127.0.0.1" - webport = self.core.config.get("webinterface", "port") + webport = self.pyload.config.get("webinterface", "port") cnlport = self.get_config('port') self.proxy(ip, webport, cnlport) @@ -78,7 +78,7 @@ class ClickAndLoad(Addon): server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - if self.core.config.get("webinterface", "https"): + if self.pyload.config.get("webinterface", "https"): try: server_socket = ssl.wrap_socket(server_socket) diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 699243ddc..e11e7305c 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -68,7 +68,7 @@ class DeathByCaptcha(Hook): def api_response(self, api="captcha", post=False, multipart=False): req = get_request() - req.c.setopt(pycurl.HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version]) + req.c.setopt(pycurl.HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.pyload.version]) if post: if not isinstance(post, dict): @@ -168,7 +168,7 @@ class DeathByCaptcha(Hook): if not self.get_config('username') or not self.get_config('password'): return False - if self.core.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.get_config('check_client'): return False try: diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py index bd67dec67..c32088532 100644 --- a/module/plugins/hooks/DownloadScheduler.py +++ b/module/plugins/hooks/DownloadScheduler.py @@ -48,25 +48,25 @@ class DownloadScheduler(Addon): self.set_download_speed(last[3]) next_time = (((24 + next[0] - now[0]) * 60 + next[1] - now[1]) * 60 + next[2] - now[2]) % 86400 - self.core.scheduler.removeJob(self.cb) - self.cb = self.core.scheduler.addJob(next_time, self.update_schedule, threaded=False) + self.pyload.scheduler.removeJob(self.cb) + self.cb = self.pyload.scheduler.addJob(next_time, self.update_schedule, threaded=False) def set_download_speed(self, speed): if speed == 0: abort = self.get_config('abort') self.log_info(_("Stopping download server. (Running downloads will %sbe aborted.)") % '' if abort else _('not ')) - self.core.api.pauseServer() + self.pyload.api.pauseServer() if abort: - self.core.api.stopAllDownloads() + self.pyload.api.stopAllDownloads() else: - self.core.api.unpauseServer() + self.pyload.api.unpauseServer() if speed > 0: self.log_info(_("Setting download speed to %d kB/s") % speed) - self.core.config.set("download", "limit_speed", 1) - self.core.config.set("download", "max_speed", speed) + self.pyload.config.set("download", "limit_speed", 1) + self.pyload.config.set("download", "max_speed", speed) else: self.log_info(_("Setting download speed to FULL")) - self.core.config.set("download", "limit_speed", 0) - self.core.config.set("download", "max_speed", -1) + self.pyload.config.set("download", "limit_speed", 0) + self.pyload.config.set("download", "max_speed", -1) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index ac1b223df..7b1ae15b1 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -74,7 +74,7 @@ class ExpertDecoders(Hook): if not self.get_config('passkey'): return False - if self.core.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.get_config('check_client'): return False if self.get_credits() > 0: diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 2a96d9e59..6c8acca48 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -103,7 +103,7 @@ class ExternalScripts(Addon): def exit(self): - for script in self.scripts['pyload_restart' if self.core.do_restart else 'pyload_stop']: + for script in self.scripts['pyload_restart' if self.pyload.do_restart else 'pyload_stop']: self.call_script(script) @@ -124,10 +124,10 @@ class ExternalScripts(Addon): def download_failed(self, pyfile): - if self.core.config.get("general", "folder_per_package"): - download_folder = fs_join(self.core.config.get("general", "download_folder"), pyfile.package().folder) + if self.pyload.config.get("general", "folder_per_package"): + download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pyfile.package().folder) else: - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") for script in self.scripts['download_failed']: file = fs_join(download_folder, pyfile.name) @@ -135,10 +135,10 @@ class ExternalScripts(Addon): def download_finished(self, pyfile): - if self.core.config.get("general", "folder_per_package"): - download_folder = fs_join(self.core.config.get("general", "download_folder"), pyfile.package().folder) + if self.pyload.config.get("general", "folder_per_package"): + download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pyfile.package().folder) else: - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") for script in self.scripts['download_finished']: file = fs_join(download_folder, pyfile.name) @@ -156,42 +156,42 @@ class ExternalScripts(Addon): def package_finished(self, pypack): - if self.core.config.get("general", "folder_per_package"): - download_folder = fs_join(self.core.config.get("general", "download_folder"), pypack.folder) + if self.pyload.config.get("general", "folder_per_package"): + download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder) else: - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") for script in self.scripts['package_finished']: self.call_script(script, pypack.id, pypack.name, download_folder, pypack.password) def package_deleted(self, pid): - pack = self.core.api.getPackageInfo(pid) + pack = self.pyload.api.getPackageInfo(pid) - if self.core.config.get("general", "folder_per_package"): - download_folder = fs_join(self.core.config.get("general", "download_folder"), pack.folder) + if self.pyload.config.get("general", "folder_per_package"): + download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pack.folder) else: - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") for script in self.scripts['package_deleted']: self.call_script(script, pack.id, pack.name, download_folder, pack.password) def package_extract_failed(self, pypack): - if self.core.config.get("general", "folder_per_package"): - download_folder = fs_join(self.core.config.get("general", "download_folder"), pypack.folder) + if self.pyload.config.get("general", "folder_per_package"): + download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder) else: - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") for script in self.scripts['package_extract_failed']: self.call_script(script, pypack.id, pypack.name, download_folder, pypack.password) def package_extracted(self, pypack): - if self.core.config.get("general", "folder_per_package"): - download_folder = fs_join(self.core.config.get("general", "download_folder"), pypack.folder) + if self.pyload.config.get("general", "folder_per_package"): + download_folder = fs_join(self.pyload.config.get("general", "download_folder"), pypack.folder) else: - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") for script in self.scripts['package_extracted']: self.call_script(script, pypack.id, pypack.name, download_folder) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index cead3595c..92774b423 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -159,7 +159,7 @@ class ExtractArchive(Addon): def activate(self): for p in ("UnRar", "SevenZip", "UnZip"): try: - module = self.core.pluginManager.loadModule("internal", p) + module = self.pyload.pluginManager.loadModule("internal", p) klass = getattr(module, p) if klass.is_usable(): self.extractors.append(klass) @@ -171,12 +171,12 @@ class ExtractArchive(Addon): self.log_warning(_("No %s installed") % p) else: self.log_warning(_("Could not activate: %s") % p, e) - if self.core.debug: + if self.pyload.debug: traceback.print_exc() except Exception, e: self.log_warning(_("Could not activate: %s") % p, e) - if self.core.debug: + if self.pyload.debug: traceback.print_exc() if self.extractors: @@ -274,11 +274,11 @@ class ExtractArchive(Addon): #: Reload from txt file self.reload_passwords() - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") #: Iterate packages -> extractors -> targets for pid in ids: - pypack = self.core.files.getPackage(pid) + pypack = self.pyload.files.getPackage(pid) if not pypack: self.queue.remove(pid) @@ -323,7 +323,7 @@ class ExtractArchive(Addon): self.log_info(name, _("Extract to: %s") % fout) try: - pyfile = self.core.files.getFile(fid) + pyfile = self.pyload.files.getFile(fid) archive = Extractor(self, fname, fout, @@ -513,7 +513,7 @@ class ExtractArchive(Addon): except Exception, e: self.log_error(name, _("Unknown error"), e) - if self.core.debug: + if self.pyload.debug: traceback.print_exc() self.manager.dispatchEvent("archive_extract_failed", pyfile, archive) @@ -589,16 +589,16 @@ class ExtractArchive(Addon): continue try: - if self.core.config.get("permission", "change_file"): + if self.pyload.config.get("permission", "change_file"): if os.path.isfile(f): - os.chmod(f, int(self.core.config.get("permission", "file"), 8)) + os.chmod(f, int(self.pyload.config.get("permission", "file"), 8)) elif os.path.isdir(f): - os.chmod(f, int(self.core.config.get("permission", "folder"), 8)) + os.chmod(f, int(self.pyload.config.get("permission", "folder"), 8)) - if self.core.config.get("permission", "change_dl") and os.name != "nt": - uid = getpwnam(self.core.config.get("permission", "user"))[2] - gid = getgrnam(self.core.config.get("permission", "group"))[2] + if self.pyload.config.get("permission", "change_dl") and os.name != "nt": + uid = getpwnam(self.pyload.config.get("permission", "user"))[2] + gid = getgrnam(self.pyload.config.get("permission", "group"))[2] os.chown(f, uid, gid) except Exception, e: diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index b98f325fa..860e6bd37 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -52,7 +52,7 @@ class HotFolder(Addon): with open(fs_join(folder, "finished", name), "wb") as f: f.write(content) - self.core.api.addPackage(f.name, [f.name], 1) + self.pyload.api.addPackage(f.name, [f.name], 1) for f in os.listdir(folder): path = os.path.join(folder, f) @@ -64,7 +64,7 @@ class HotFolder(Addon): move(path, newpath) self.log_info(_("Added %s from HotFolder") % f) - self.core.api.addPackage(f, [newpath], 1) + self.pyload.api.addPackage(f, [newpath], 1) except (IOError, OSError), e: self.log_error(e) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 732340e3e..1f2db0a14 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -203,7 +203,7 @@ class IRCInterface(Thread, Addon): def event_status(self, args): - downloads = self.core.api.statusDownloads() + downloads = self.pyload.api.statusDownloads() if not downloads: return ["INFO: There are no active downloads currently."] @@ -229,7 +229,7 @@ class IRCInterface(Thread, Addon): def event_queue(self, args): - ps = self.core.api.getQueueData() + ps = self.pyload.api.getQueueData() if not ps: return ["INFO: There are no packages in queue."] @@ -242,7 +242,7 @@ class IRCInterface(Thread, Addon): def event_collector(self, args): - ps = self.core.api.getCollectorData() + ps = self.pyload.api.getCollectorData() if not ps: return ["INFO: No packages in collector!"] @@ -259,7 +259,7 @@ class IRCInterface(Thread, Addon): info = None try: - info = self.core.api.getFileData(int(args[0])) + info = self.pyload.api.getFileData(int(args[0])) except FileDoesNotExists: return ["ERROR: Link doesn't exists."] @@ -274,7 +274,7 @@ class IRCInterface(Thread, Addon): lines = [] pack = None try: - pack = self.core.api.getPackageData(int(args[0])) + pack = self.pyload.api.getPackageData(int(args[0])) except PackageDoesNotExists: return ["ERROR: Package doesn't exists."] @@ -311,12 +311,12 @@ class IRCInterface(Thread, Addon): def event_start(self, args): - self.core.api.unpauseServer() + self.pyload.api.unpauseServer() return ["INFO: Starting downloads."] def event_stop(self, args): - self.core.api.pauseServer() + self.pyload.api.pauseServer() return ["INFO: No new downloads will be started."] @@ -332,7 +332,7 @@ class IRCInterface(Thread, Addon): count_failed = 0 try: id = int(pack) - pack = self.core.api.getPackageData(id) + pack = self.pyload.api.getPackageData(id) if not pack: return ["ERROR: Package doesn't exists."] @@ -342,7 +342,7 @@ class IRCInterface(Thread, Addon): except Exception: #: Create new package - id = self.core.api.addPackage(pack, links, 1) + id = self.pyload.api.addPackage(pack, links, 1) return ["INFO: Created new Package %s [#%d] with %d links." % (pack, id, len(links))] @@ -351,11 +351,11 @@ class IRCInterface(Thread, Addon): return ["ERROR: Use del command like this: del -p|-l <id> [...] (-p indicates that the ids are from packages, -l indicates that the ids are from links)"] if args[0] == "-p": - ret = self.core.api.deletePackages(map(int, args[1:])) + ret = self.pyload.api.deletePackages(map(int, args[1:])) return ["INFO: Deleted %d packages!" % len(args[1:])] elif args[0] == "-l": - ret = self.core.api.delLinks(map(int, args[1:])) + ret = self.pyload.api.delLinks(map(int, args[1:])) return ["INFO: Deleted %d links!" % len(args[1:])] else: @@ -368,11 +368,11 @@ class IRCInterface(Thread, Addon): id = int(args[0]) try: - info = self.core.api.getPackageInfo(id) + info = self.pyload.api.getPackageInfo(id) except PackageDoesNotExists: return ["ERROR: Package #%d does not exist." % id] - self.core.api.pushToQueue(id) + self.pyload.api.pushToQueue(id) return ["INFO: Pushed package #%d to queue." % id] @@ -381,10 +381,10 @@ class IRCInterface(Thread, Addon): return ["ERROR: Pull package from queue like this: pull <package id>."] id = int(args[0]) - if not self.core.api.getPackageData(id): + if not self.pyload.api.getPackageData(id): return ["ERROR: Package #%d does not exist." % id] - self.core.api.pullFromQueue(id) + self.pyload.api.pullFromQueue(id) return ["INFO: Pulled package #%d from queue to collector." % id] @@ -395,7 +395,7 @@ class IRCInterface(Thread, Addon): if not args: return ["ERROR: Captcha ID missing."] - task = self.core.captchaManager.getTaskByID(args[0]) + task = self.pyload.captchaManager.getTaskByID(args[0]) if not task: return ["ERROR: Captcha Task with ID %s does not exists." % args[0]] diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 9687819a3..3c251f9f7 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -114,7 +114,7 @@ class ImageTyperz(Hook): if not self.get_config('username') or not self.get_config('password'): return False - if self.core.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.get_config('check_client'): return False if self.get_credits() > 0: diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index b30625e9a..bae9eb173 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -25,12 +25,12 @@ class JustPremium(Addon): def links_added(self, links, pid): - hosterdict = self.core.pluginManager.hosterPlugins - linkdict = self.core.api.checkURLs(links) + hosterdict = self.pyload.pluginManager.hosterPlugins + linkdict = self.pyload.api.checkURLs(links) - premiumplugins = set(account.type for account in self.core.api.getAccounts(False) \ + premiumplugins = set(account.type for account in self.pyload.api.getAccounts(False) \ if account.valid and account.premium) - multihosters = set(hoster for hoster in self.core.pluginManager.hosterPlugins \ + multihosters = set(hoster for hoster in self.pyload.pluginManager.hosterPlugins \ if 'new_name' in hosterdict[hoster] \ and hosterdict[hoster]['new_name'] in premiumplugins) diff --git a/module/plugins/hooks/MegaDebridEuHook.py b/module/plugins/hooks/MegaDebridEuHook.py index 36aa807ae..202eeb797 100644 --- a/module/plugins/hooks/MegaDebridEuHook.py +++ b/module/plugins/hooks/MegaDebridEuHook.py @@ -27,6 +27,6 @@ class MegaDebridEuHook(MultiHook): host_list = [element[0] for element in json_data['hosters']] else: self.log_error(_("Unable to retrieve hoster list")) - host_list = list() + host_list = [] return host_list diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index b5245cc14..d9049c5b2 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -37,9 +37,9 @@ class MergeFiles(Addon): files[data['name'][:-4]].sort() fid_dict[data['name']] = fid - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") - if self.core.config.get("general", "folder_per_package"): + if self.pyload.config.get("general", "folder_per_package"): download_folder = fs_join(download_folder, pack.folder) for name, file_list in files.iteritems(): @@ -49,7 +49,7 @@ class MergeFiles(Addon): for splitted_file in file_list: self.log_debug("Merging part", splitted_file) - pyfile = self.core.files.getFile(fid_dict[splitted_file]) + pyfile = self.pyload.files.getFile(fid_dict[splitted_file]) pyfile.setStatus("processing") diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index bfb420aea..05fd5de1e 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -24,7 +24,7 @@ class MultiHome(Addon): self.parse_interfaces(self.get_config('interfaces').split(";")) if not self.interfaces: - self.parse_interfaces([self.core.config.get("download", "interface")]) + self.parse_interfaces([self.pyload.config.get("download", "interface")]) self.set_config("interfaces", self.to_config()) @@ -40,7 +40,7 @@ class MultiHome(Addon): def activate(self): - requestFactory = self.core.requestFactory + requestFactory = self.pyload.requestFactory oldGetRequest = requestFactory.getRequest diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py index 8740ccd7d..bb248b895 100644 --- a/module/plugins/hooks/RestartFailed.py +++ b/module/plugins/hooks/RestartFailed.py @@ -22,7 +22,7 @@ class RestartFailed(Addon): # if name == "interval": # interval = value * 60 # if self.MIN_CHECK_INTERVAL <= interval != self.interval: - # self.core.scheduler.removeJob(self.cb) + # self.pyload.scheduler.removeJob(self.cb) # self.interval = interval # self.init_periodical() # else: @@ -31,7 +31,7 @@ class RestartFailed(Addon): def periodical(self): self.log_debug("Restart failed downloads") - self.core.api.restartFailed() + self.pyload.api.restartFailed() def init(self): diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index 2123a6543..112395c64 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -35,7 +35,7 @@ class SkipRev(Addon): def _pyfile(self, link): - return PyFile(self.core.files, + return PyFile(self.pyload.files, link.fid, link.url, link.name, @@ -59,7 +59,7 @@ class SkipRev(Addon): status_list = (1, 4, 8, 9, 14) if revtokeep < 0 else (1, 3, 4, 8, 9, 14) pyname = re.compile(r'%s\.part\d+\.rev$' % name.rsplit('.', 2)[0].replace('.', '\.')) - queued = [True for link in self.core.api.getPackageData(pyfile.package().id).links \ + queued = [True for link in self.pyload.api.getPackageData(pyfile.package().id).links \ if link.status not in status_list and pyname.match(link.name)].count(True) if not queued or queued < revtokeep: #: Keep one rev at least in auto mode @@ -85,7 +85,7 @@ class SkipRev(Addon): pyname = re.compile(r'%s\.part\d+\.rev$' % pyfile.name.rsplit('.', 2)[0].replace('.', '\.')) - for link in self.core.api.getPackageData(pyfile.package().id).links: + for link in self.pyload.api.getPackageData(pyfile.package().id).links: if link.status is 4 and pyname.match(link.name): pylink = self._pyfile(link) @@ -94,6 +94,6 @@ class SkipRev(Addon): else: pylink.setCustomStatus(_("unskipped"), "queued") - self.core.files.save() + self.pyload.files.save() pylink.release() return diff --git a/module/plugins/hooks/UnSkipOnFail.py b/module/plugins/hooks/UnSkipOnFail.py index c8e58294c..9adf13e3e 100644 --- a/module/plugins/hooks/UnSkipOnFail.py +++ b/module/plugins/hooks/UnSkipOnFail.py @@ -39,7 +39,7 @@ class UnSkipOnFail(Addon): pylink.setCustomStatus(_("unskipped"), "queued") - self.core.files.save() + self.pyload.files.save() pylink.release() else: @@ -56,7 +56,7 @@ class UnSkipOnFail(Addon): the data for "pyfile" iotselöf. It does MOT check the link's status. """ - queue = self.core.api.getQueue() #: Get packages (w/o files, as most file data is useless here) + queue = self.pyload.api.getQueue() #: Get packages (w/o files, as most file data is useless here) for package in queue: #: Check if package-folder equals pyfile's package folder @@ -64,7 +64,7 @@ class UnSkipOnFail(Addon): continue #: Now get packaged data w/ files/links - pdata = self.core.api.getPackageData(package.pid) + pdata = self.pyload.api.getPackageData(package.pid) for link in pdata.links: #: Check if link is "skipped" if link.status != 4: @@ -77,7 +77,7 @@ class UnSkipOnFail(Addon): def _pyfile(self, link): - return PyFile(self.core.files, + return PyFile(self.pyload.files, link.fid, link.url, link.name, diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 4ec981ac0..7209f4672 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -51,10 +51,10 @@ class UpdateManager(Addon): def activate(self): if self.checkonstart: - self.core.api.pauseServer() + self.pyload.api.pauseServer() self.update() if self.do_restart is False: - self.core.api.unpauseServer() + self.pyload.api.unpauseServer() self.init_periodical() @@ -68,7 +68,7 @@ class UpdateManager(Addon): self.interval = 10 if self.get_config('checkonstart'): - self.core.api.pauseServer() + self.pyload.api.pauseServer() self.checkonstart = True else: self.checkonstart = False @@ -79,11 +79,11 @@ class UpdateManager(Addon): def all_downloads_processed(self): if self.do_restart is True: self.log_warning(_("Downloads are done, restarting pyLoad to reload the updated plugins")) - self.core.api.restart() + self.pyload.api.restart() def periodical(self): - if self.core.debug: + if self.pyload.debug: if self.get_config('reloadplugins'): self.autoreload_plugins() @@ -120,7 +120,7 @@ class UpdateManager(Addon): for m in modules: root, type, name = m.__name__.rsplit(".", 2) id = (type, name) - if type in self.core.pluginManager.plugins: + if type in self.pyload.pluginManager.plugins: f = m.__file__.replace(".pyc", ".py") if not os.path.isfile(f): continue @@ -133,13 +133,13 @@ class UpdateManager(Addon): reloads.append(id) self.mtimes[id] = mtime - return True if self.core.pluginManager.reloadPlugins(reloads) else False + return True if self.pyload.pluginManager.reloadPlugins(reloads) else False def server_response(self): try: return self.load(self.SERVER_URL, - get={'v': self.core.api.getServerVersion()}).splitlines() + get={'v': self.pyload.api.getServerVersion()}).splitlines() except Exception: self.log_warning(_("Unable to retrieve server to get updates")) @@ -152,12 +152,12 @@ class UpdateManager(Addon): Check for updates """ if self._update() is 2 and self.get_config('autorestart'): - if not self.core.api.statusDownloads(): - self.core.api.restart() + if not self.pyload.api.statusDownloads(): + self.pyload.api.restart() else: self.do_restart = True self.log_warning(_("Downloads are active, will restart once the download is done")) - self.core.api.pauseServer() + self.pyload.api.pauseServer() def _update(self): @@ -249,7 +249,7 @@ class UpdateManager(Addon): else: type = prefix - plugins = getattr(self.core.pluginManager, "%sPlugins" % type) + plugins = getattr(self.pyload.pluginManager, "%sPlugins" % type) oldver = float(plugins[name]['v']) if name in plugins else None newver = float(version) @@ -283,7 +283,7 @@ class UpdateManager(Addon): if updated: self.log_info(_("*** Plugins updated ***")) - if self.core.pluginManager.reloadPlugins(updated): + if self.pyload.pluginManager.reloadPlugins(updated): exitcode = 1 else: self.log_warning(_("pyLoad restart required to reload the updated plugins")) diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py index b4b4d2658..ebd755c90 100644 --- a/module/plugins/hooks/WindowsPhoneNotify.py +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -51,7 +51,7 @@ class WindowsPhoneNotify(Addon): if not self.get_config('notifyexit'): return - if self.core.do_restart: + if self.pyload.do_restart: self.notify(_("Restarting pyLoad")) else: self.notify(_("Exiting pyLoad")) @@ -73,7 +73,7 @@ class WindowsPhoneNotify(Addon): if not self.get_config('notifyprocessed'): return - if any(True for pdata in self.core.api.getQueue() if pdata.linksdone < pdata.linkstotal): + if any(True for pdata in self.pyload.api.getQueue() if pdata.linksdone < pdata.linkstotal): self.notify(_("Package failed"), _("One or more packages was not completed successfully")) else: self.notify(_("All packages finished")) @@ -95,7 +95,7 @@ class WindowsPhoneNotify(Addon): if not id or not url: return - if self.core.isClientConnected() and not self.get_config('ignoreclient'): + if self.pyload.isClientConnected() and not self.get_config('ignoreclient'): return elapsed_time = time.time() - self.last_notify diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 5829378d8..c82308bb1 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -47,7 +47,7 @@ class XFileSharingPro(Hook): # self.load_pattern() - def init(self): + # def init(self): # self.event_map = {'pluginConfigChanged': "plugin_config_changed"} @@ -89,7 +89,7 @@ class XFileSharingPro(Hook): pattern = self.regexp[type][1] % match_list.replace('.', '\.') - dict = self.core.pluginManager.plugins[type][plugin] + dict = self.pyload.pluginManager.plugins[type][plugin] dict['pattern'] = pattern dict['re'] = re.compile(pattern) @@ -97,7 +97,7 @@ class XFileSharingPro(Hook): def _unload(self, type, plugin): - dict = self.core.pluginManager.plugins[type][plugin] + dict = self.pyload.pluginManager.plugins[type][plugin] dict['pattern'] = r'^unmatchable$' dict['re'] = re.compile(dict['pattern']) @@ -110,7 +110,7 @@ class XFileSharingPro(Hook): def unload_hoster(self, hoster): - hdict = self.core.pluginManager.hosterPlugins[hoster] + hdict = self.pyload.pluginManager.hosterPlugins[hoster] if "new_name" in hdict and hdict['new_name'] == "XFileSharingPro": if "module" in hdict: hdict.pop('module', None) diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index ed8c8b32c..e9871e366 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -65,7 +65,7 @@ class BasePlugin(Hoster): elif e.code in (401, 403): self.log_debug("Auth required", "Received HTTP status code: %d" % e.code) - account = self.core.accountManager.getAccountPlugin('Http') + account = self.pyload.accountManager.getAccountPlugin('Http') servers = [x['login'] for x in account.get_all_accounts()] server = urlparse.urlparse(pyfile.url).netloc diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index ef64bed32..ea82d2f05 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -60,7 +60,7 @@ class DlFreeFr(SimpleHoster): def init(self): - factory = self.core.requestFactory + factory = self.pyload.requestFactory self.req = CustomBrowser(factory.bucket, factory.getOptions()) diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index c29231a7b..c7c456ac2 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -40,7 +40,7 @@ class EdiskCz(SimpleHoster): action = m.group(1) self.html = self.load(url) - self.getFileInfo() + self.get_fileInfo() self.html = self.load(re.sub("/en/download/", "/en/download-slow/", url)) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 685e7ce87..27ebed842 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -72,6 +72,6 @@ class Ftp(Hoster): res = self.load(pyfile.url, decode=False) links = [pyfile.url + x for x in res.splitlines()] self.log_debug("LINKS", links) - self.core.api.addPackage(pkgname, links) + self.pyload.api.addPackage(pkgname, links) else: self.fail(_("Unexpected server response")) diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index cc39b32cb..cc48d36dc 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -41,7 +41,7 @@ class IfolderRu(SimpleHoster): def handle_free(self, pyfile): url = "http://rusfolder.com/%s" % self.info['pattern']['ID'] self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID']) - self.getFileInfo() + self.get_fileInfo() session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups() diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 3756ef81f..386e29674 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -36,7 +36,7 @@ class OboomCom(Hoster): self.html = self.load(pyfile.url) self.get_file_id(self.pyfile.url) self.get_session_token() - self.getFileInfo(self.session_token, self.file_id) + self.get_fileInfo(self.session_token, self.file_id) self.pyfile.name = self.file_name self.pyfile.size = self.file_size if not self.premium: @@ -47,7 +47,7 @@ class OboomCom(Hoster): def load_url(self, url, get=None): if get is None: - get = dict() + get = {} return json_loads(self.load(url, get)) @@ -110,7 +110,7 @@ class OboomCom(Hoster): self.fail(_("Received invalid captcha 5 times")) - def getFileInfo(self, token, fileId): + def get_fileInfo(self, token, fileId): apiUrl = "https://api.oboom.com/1.0/info" params = {'token': token, 'items': fileId, 'http_errors': 0} diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 3af8c42de..444ec6fab 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -26,7 +26,7 @@ class QuickshareCz(SimpleHoster): def process(self, pyfile): self.html = self.load(pyfile.url) - self.getFileInfo() + self.get_fileInfo() #: Parse js variables self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'.+?')", self.html)) diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index ad6283433..c5e4ba68c 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -31,7 +31,7 @@ class UloziskoSk(SimpleHoster): def process(self, pyfile): self.html = self.load(pyfile.url) - self.getFileInfo() + self.get_fileInfo() m = re.search(self.IMG_PATTERN, self.html) if m: diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index 04abf15ee..b711faba4 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -36,7 +36,7 @@ class UploadingCom(SimpleHoster): pyfile.url = pyfile.url.replace("/files", "/files/get") self.html = self.load(pyfile.url) - self.getFileInfo() + self.get_fileInfo() if self.premium: self.handle_premium(pyfile) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 2cbd42906..6d484ac61 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -27,12 +27,12 @@ class XFileSharingPro(XFSHoster): def init(self): super(XFileSharingPro, self).init() - self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] + self.__pattern__ = self.pyload.pluginManager.hosterPlugins[self.__name__]['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 != '.') - account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) + account = self.pyload.accountManager.getAccountPlugin(self.HOSTER_NAME) if account and account.can_use(): self.account = account diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index 4a947da1b..1d8b6490b 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -34,7 +34,7 @@ class Xdcc(Hoster): def process(self, pyfile): #: Change request type - self.req = self.core.requestFactory.getRequest(self.__name__, type="XDCC") + self.req = self.pyload.requestFactory.getRequest(self.__name__, type="XDCC") self.pyfile = pyfile for _i in xrange(0, 3): @@ -187,7 +187,7 @@ class Xdcc(Hoster): self.pyfile.name = packname - download_folder = self.core.config.get("general", "download_folder") + download_folder = self.pyload.config.get("general", "download_folder") filename = fs_join(download_folder, packname) self.log_info(_("Downloading %s from %s:%d") % (packname, ip, port)) 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 |