diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Hook.py | 18 | ||||
-rw-r--r-- | module/plugins/container/LinkList.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/ExternalScripts.py | 18 |
3 files changed, 29 insertions, 9 deletions
diff --git a/module/plugins/Hook.py b/module/plugins/Hook.py index 47faba95a..3db3e47e9 100644 --- a/module/plugins/Hook.py +++ b/module/plugins/Hook.py @@ -55,6 +55,11 @@ class Hook(): #: automatically register event listeners for functions, attribute will be deleted dont use it yourself event_map = None + # Alternative to event_map + #: List of events the plugin can handle, name the functions exactly like eventname. + event_list = None # dont make duplicate entries in event_map + + #: periodic call interval in secondc interval = 60 @@ -78,8 +83,14 @@ class Hook(): else: self.manager.addEvent(event, getattr(self,funcs)) - #delete for various reasons - self.event_map = None + #delete for various reasons + self.event_map = None + + if self.event_list: + for f in self.event_list: + self.manager.addEvent(f, getattr(self,f)) + + self.event_list = None self.setup() @@ -140,9 +151,6 @@ class Hook(): def periodical(self): pass - def unrarFinished(self, folder, fname): - pass - def newCaptchaTask(self, task): """ new captcha task for the plugin, it MUST set the handler and timeout or will be ignored """ pass diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py index 22a63c78a..b9eb4b972 100644 --- a/module/plugins/container/LinkList.py +++ b/module/plugins/container/LinkList.py @@ -9,7 +9,7 @@ class LinkList(Container): __version__ = "0.11" __pattern__ = r".+\.txt$" __description__ = """Read Link Lists in txt format""" - __config__ = [("clear", "bool", "Clear Linklist after adding", True)] + __config__ = [("clear", "bool", "Clear Linklist after adding", False)] __author_name__ = ("spoob", "jeix") __author_mail__ = ("spoob@pyload.org", "jeix@hasnomail.com") diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 540b60477..36e026721 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -27,18 +27,20 @@ from module.utils import save_join class ExternalScripts(Hook): __name__ = "ExternalScripts" - __version__ = "0.2" - __description__ = """run external scripts""" + __version__ = "0.21" + __description__ = """Run external scripts""" __config__ = [("activated", "bool", "Activated", "True")] __author_name__ = ("mkaay", "RaNaN", "spoob") __author_mail__ = ("mkaay@mkaay.de", "ranan@pyload.org", "spoob@pyload.org") + event_list = ["unrarFinished", "allDownloadsFinished", "allDownloadsProcessed"] def setup(self): self.scripts = {} folders = ['download_preparing', 'download_finished', 'package_finished', - 'before_reconnect', 'after_reconnect', 'unrar_finished'] + 'before_reconnect', 'after_reconnect', 'unrar_finished', + 'all_dls_finished', 'all_dls_processed'] for folder in folders: @@ -58,6 +60,7 @@ class ExternalScripts(Hook): makedirs(path) except : self.logDebug("Script folder %s not created" % folder) + return for f in listdir(path): if f.startswith("#") or f.startswith(".") or f.startswith("_") or f.endswith("~") or f.endswith(".swp"): @@ -105,3 +108,12 @@ class ExternalScripts(Hook): def unrarFinished(self, folder, fname): for script in self.scripts["unrar_finished"]: self.callScript(script, folder, fname) + + def allDownloadsFinished(self): + for script in self.scripts["all_dls_finished"]: + self.callScript(script) + + def allDownloadsProcessed(self): + for script in self.scripts["all_dls_processed"]: + self.callScript(script) + |