summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r--module/plugins/hooks/AndroidPhoneNotify.py6
-rw-r--r--module/plugins/hooks/BypassCaptcha.py2
-rw-r--r--module/plugins/hooks/Captcha9Kw.py2
-rw-r--r--module/plugins/hooks/CaptchaBrotherhood.py2
-rw-r--r--module/plugins/hooks/Checksum.py4
-rw-r--r--module/plugins/hooks/ClickAndLoad.py6
-rw-r--r--module/plugins/hooks/DeathByCaptcha.py4
-rw-r--r--module/plugins/hooks/DownloadScheduler.py18
-rw-r--r--module/plugins/hooks/ExpertDecoders.py2
-rw-r--r--module/plugins/hooks/ExternalScripts.py40
-rw-r--r--module/plugins/hooks/ExtractArchive.py26
-rw-r--r--module/plugins/hooks/HotFolder.py4
-rw-r--r--module/plugins/hooks/IRCInterface.py32
-rw-r--r--module/plugins/hooks/ImageTyperz.py2
-rw-r--r--module/plugins/hooks/JustPremium.py8
-rw-r--r--module/plugins/hooks/MegaDebridEuHook.py2
-rw-r--r--module/plugins/hooks/MergeFiles.py6
-rw-r--r--module/plugins/hooks/MultiHome.py4
-rw-r--r--module/plugins/hooks/RestartFailed.py4
-rw-r--r--module/plugins/hooks/SkipRev.py8
-rw-r--r--module/plugins/hooks/UnSkipOnFail.py8
-rw-r--r--module/plugins/hooks/UpdateManager.py26
-rw-r--r--module/plugins/hooks/WindowsPhoneNotify.py6
-rw-r--r--module/plugins/hooks/XFileSharingPro.py8
24 files changed, 115 insertions, 115 deletions
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)