diff options
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/AntiStandby.py | 10 | ||||
-rw-r--r-- | module/plugins/hooks/DeleteFinished.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/ExternalScripts.py | 36 | ||||
-rw-r--r-- | module/plugins/hooks/HotFolder.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/LogMarker.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/RestartFailed.py | 6 |
6 files changed, 29 insertions, 35 deletions
diff --git a/module/plugins/hooks/AntiStandby.py b/module/plugins/hooks/AntiStandby.py index 34f9dd832..2159e5937 100644 --- a/module/plugins/hooks/AntiStandby.py +++ b/module/plugins/hooks/AntiStandby.py @@ -12,8 +12,8 @@ try: except ImportError: pass -from module.plugins.internal.Addon import Addon -from module.plugins.internal.misc import Expose, encode, fsjoin +from module.plugins.internal.Addon import Addon, Expose +from module.plugins.internal.misc import encode, fsjoin class Kernel32(object): @@ -55,7 +55,7 @@ class AntiStandby(Addon): display = not self.config.get('display') if hdd: - self.start_periodical(self.config.get('interval'), threaded=True) + self.periodical.start(self.config.get('interval'), threaded=True) if os.name is "nt": self.win_standby(system, display) @@ -153,7 +153,7 @@ class AntiStandby(Addon): for file in files)) - def periodical(self): + def periodical_task(self): if self.config.get('hdd') is False: return @@ -163,7 +163,7 @@ class AntiStandby(Addon): return dl_folder = self.pyload.config.get("general", "download_folder") - if (self.max_mtime(dl_folder) - self.mtime) < self.interval: + if (self.max_mtime(dl_folder) - self.mtime) < self.periodical.interval: return self.touch(self.TMP_FILE) diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py index 2fb8de938..67e1a1056 100644 --- a/module/plugins/hooks/DeleteFinished.py +++ b/module/plugins/hooks/DeleteFinished.py @@ -19,7 +19,7 @@ class DeleteFinished(Addon): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - def periodical(self): + def periodical_task(self): if not self.info['sleep']: deloffline = self.config.get('deloffline') mode = "0,1,4" if deloffline else "0,4" @@ -37,7 +37,7 @@ class DeleteFinished(Addon): def activate(self): self.info['sleep'] = True self.add_event('package_finished', self.wakeup) - self.start_periodical(self.config.get('interval') * 60 * 60) + self.periodical.start(self.config.get('interval') * 60 * 60) ## own methods ## diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index b8b79027e..3f4fa74db 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -4,7 +4,7 @@ import os import subprocess from module.plugins.internal.Addon import Addon, Expose -from module.plugins.internal.misc import encode, fsjoin +from module.plugins.internal.misc import encode class ExternalScripts(Addon): @@ -35,7 +35,7 @@ class ExternalScripts(Addon): 'all_archives_processed': "all_archives_processed" , 'pyload_updated' : "pyload_updated" } - self.start_periodical(60) + self.periodical.start(60) self.pyload_start() @@ -61,7 +61,7 @@ class ExternalScripts(Addon): self.log_debug(e, trace=True) - def periodical(self): + def periodical_task(self): self.make_folders() folders = [entry for entry in os.listdir("scripts") \ @@ -157,12 +157,7 @@ class ExternalScripts(Addon): def download_failed(self, pyfile): - if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fsjoin(self.pyload.config.get("general", "download_folder"), pyfile.package().folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") - - file = os.path.join(dl_folder, pyfile.name) + file = pyfile.plugin.last_download args = [pyfile.id, pyfile.name, file, pyfile.pluginname, pyfile.url] self.call_script("download_failed", *args) @@ -184,42 +179,41 @@ class ExternalScripts(Addon): def package_finished(self, pypack): + dl_folder = self.pyload.config.get("general", "download_folder") + if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fsjoin(self.pyload.config.get("general", "download_folder"), pypack.folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") + dl_folder = os.path.join(dl_folder, pypack.folder) args = [pypack.id, pypack.name, dl_folder, pypack.password] self.call_script("package_finished", *args) def package_deleted(self, pid): + dl_folder = self.pyload.config.get("general", "download_folder") pdata = self.pyload.api.getPackageInfo(pid) if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fsjoin(self.pyload.config.get("general", "download_folder"), pdata.folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") + dl_folder = os.path.join(dl_folder, pdata.folder) args = [pdata.pid, pdata.name, dl_folder, pdata.password] self.call_script("package_deleted", *args) def package_extract_failed(self, pypack): + dl_folder = self.pyload.config.get("general", "download_folder") + if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fsjoin(self.pyload.config.get("general", "download_folder"), pypack.folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") + dl_folder = os.path.join(dl_folder, pypack.folder) args = [pypack.id, pypack.name, dl_folder, pypack.password] self.call_script("package_extract_failed", *args) def package_extracted(self, pypack): + dl_folder = self.pyload.config.get("general", "download_folder") + if self.pyload.config.get("general", "folder_per_package"): - dl_folder = fsjoin(self.pyload.config.get("general", "download_folder"), pypack.folder) - else: - dl_folder = self.pyload.config.get("general", "download_folder") + dl_folder = os.path.join(dl_folder, pypack.folder) args = [pypack.id, pypack.name, dl_folder] self.call_script("package_extracted", *args) diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py index 1af427b25..26217c0f8 100644 --- a/module/plugins/hooks/HotFolder.py +++ b/module/plugins/hooks/HotFolder.py @@ -27,10 +27,10 @@ class HotFolder(Addon): def activate(self): - self.start_periodical(30, threaded=True) + self.periodical.start(30, threaded=True) - def periodical(self): + def periodical_task(self): folder = encode(self.config.get('folder')) file = encode(self.config.get('file')) diff --git a/module/plugins/hooks/LogMarker.py b/module/plugins/hooks/LogMarker.py index 3889ce288..80f7b17fb 100644 --- a/module/plugins/hooks/LogMarker.py +++ b/module/plugins/hooks/LogMarker.py @@ -22,10 +22,10 @@ class LogMarker(Addon): def activated(self): - self.start_periodical(1 * 60 * 60 - 1, delay=seconds_to_nexthour(strict=True) - 1) + self.periodical.start(1 * 60 * 60 - 1, delay=seconds_to_nexthour(strict=True) - 1) - def periodical(self): + def periodical_task(self): if self.config.get('mark_day') and datetime.datetime.today().hour is 0: self.log_info("------------------------------------------------") self.log_info(_("------------------- DAY MARK -------------------")) diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py index 2babff89d..62298ea14 100644 --- a/module/plugins/hooks/RestartFailed.py +++ b/module/plugins/hooks/RestartFailed.py @@ -15,12 +15,12 @@ class RestartFailed(Addon): __description__ = """Restart all the failed downloads in queue""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - def periodical(self): + + def periodical_task(self): self.log_info(_("Restarting all failed downloads...")) self.pyload.api.restartFailed() def activate(self): - self.start_periodical(self.config.get('interval') * 60) + self.periodical.start(self.config.get('interval') * 60) |