From d070742d8e4aebe59797a1ea86b51f9eb25915b4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 18 Mar 2015 13:31:58 +0100 Subject: [AndroidPhoneNotify][WindowsPhoneNotify] New notifications --- module/plugins/hooks/AndroidPhoneNotify.py | 25 ++++++++++++++++++++++--- module/plugins/hooks/WindowsPhoneNotify.py | 25 ++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 6 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index 180ad0d78..55ba3e73d 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -9,12 +9,14 @@ from module.plugins.Hook import Hook, Expose class AndroidPhoneNotify(Hook): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.06" + __version__ = "0.07" __config__ = [("apikey" , "str" , "API key" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify status of processed packages" , True ), + ("notifyprocessed", "bool", "Notify packages processed" , True ), + ("notifyupdate" , "bool", "Notify plugin updates" , True ), + ("notifyexit" , "bool", "Notify pyLoad shutdown" , True ), ("sendtimewait" , "int" , "Timewait in seconds between notifications", 5 ), ("sendpermin" , "int" , "Max notifications per minute" , 12 ), ("ignoreclient" , "bool", "Send notifications if client is connected", False)] @@ -25,7 +27,7 @@ class AndroidPhoneNotify(Hook): ("Walter Purcaro", "vuolter@gmail.com" )] - event_list = ["allDownloadsProcessed"] + event_list = ["allDownloadsProcessed", "plugin_updated"] #@TODO: Remove in 0.4.10 @@ -39,6 +41,23 @@ class AndroidPhoneNotify(Hook): self.notifications = 0 + def plugin_updated(self, type_plugins): + if not self.getConfig('notifyupdate'): + return + + self.notify(_("Plugins updated"), str(type_plugins)) + + + def coreExiting(self): + if not self.getConfig('notifyexit'): + return + + if self.core.do_restart: + self.notify(_("Restarting pyLoad")) + else: + self.notify(_("Exiting pyLoad")) + + def newCaptchaTask(self, task): if not self.getConfig('notifycaptcha'): return diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py index a1068ead5..d8215f9fe 100644 --- a/module/plugins/hooks/WindowsPhoneNotify.py +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -9,13 +9,15 @@ from module.plugins.Hook import Hook, Expose class WindowsPhoneNotify(Hook): __name__ = "WindowsPhoneNotify" __type__ = "hook" - __version__ = "0.08" + __version__ = "0.09" __config__ = [("id" , "str" , "Push ID" , "" ), ("url" , "str" , "Push url" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), ("notifypackage" , "bool", "Notify package finished" , True ), - ("notifyprocessed", "bool", "Notify status of processed packages" , True ), + ("notifyprocessed", "bool", "Notify packages processed" , True ), + ("notifyupdate" , "bool", "Notify plugin updates" , True ), + ("notifyexit" , "bool", "Notify pyLoad shutdown" , True ), ("sendtimewait" , "int" , "Timewait in seconds between notifications", 5 ), ("sendpermin" , "int" , "Max notifications per minute" , 12 ), ("ignoreclient" , "bool", "Send notifications if client is connected", False)] @@ -26,7 +28,7 @@ class WindowsPhoneNotify(Hook): ("Walter Purcaro", "vuolter@gmail.com" )] - event_list = ["allDownloadsProcessed"] + event_list = ["allDownloadsProcessed", "plugin_updated"] #@TODO: Remove in 0.4.10 @@ -40,6 +42,23 @@ class WindowsPhoneNotify(Hook): self.notifications = 0 + def plugin_updated(self, type_plugins): + if not self.getConfig('notifyupdate'): + return + + self.notify(_("Plugins updated"), str(type_plugins)) + + + def coreExiting(self): + if not self.getConfig('notifyexit'): + return + + if self.core.do_restart: + self.notify(_("Restarting pyLoad")) + else: + self.notify(_("Exiting pyLoad")) + + def newCaptchaTask(self, task): if not self.getConfig('notifycaptcha'): return -- cgit v1.2.3