diff options
-rw-r--r-- | module/plugins/hooks/AndroidPhoneNotify.py | 12 | ||||
-rw-r--r-- | module/plugins/hooks/WindowsPhoneNotify.py | 18 |
2 files changed, 20 insertions, 10 deletions
diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index 67a0ea4f0..9fea0b8e6 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -9,7 +9,7 @@ from module.plugins.Hook import Hook, Expose class AndroidPhoneNotify(Hook): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" __config__ = [("apikey" , "str" , "API key" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), @@ -44,6 +44,10 @@ class AndroidPhoneNotify(Hook): self.notify(_("Plugins updated"), str(type_plugins)) + def coreReady(self): + self.key = self.getConfig('apikey') + + def coreExiting(self): if not self.getConfig('notifyexit'): return @@ -80,8 +84,9 @@ class AndroidPhoneNotify(Hook): def notify(self, event, msg="", - key=self.getConfig('apikey')): + key=None): + key = key or self.key if not key: return @@ -99,7 +104,6 @@ class AndroidPhoneNotify(Hook): elif self.notifications >= self.getConf("sendpermin"): return - getURL("http://www.notifymyandroid.com/publicapi/notify", get={'apikey' : key, 'application': "pyLoad", @@ -108,3 +112,5 @@ class AndroidPhoneNotify(Hook): self.last_notify = time.time() self.notifications += 1 + + return True diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py index e61057f9f..da960591c 100644 --- a/module/plugins/hooks/WindowsPhoneNotify.py +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -9,10 +9,10 @@ from module.plugins.Hook import Hook, Expose class WindowsPhoneNotify(Hook): __name__ = "WindowsPhoneNotify" __type__ = "hook" - __version__ = "0.09" + __version__ = "0.10" - __config__ = [("id" , "str" , "Push ID" , "" ), - ("url" , "str" , "Push url" , "" ), + __config__ = [("push-id" , "str" , "Push ID" , "" ), + ("push-url" , "str" , "Push url" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), ("notifypackage" , "bool", "Notify package finished" , True ), ("notifyprocessed", "bool", "Notify packages processed" , True ), @@ -45,6 +45,10 @@ class WindowsPhoneNotify(Hook): self.notify(_("Plugins updated"), str(type_plugins)) + def coreReady(self): + self.key = (self.getConfig('push-id'), self.getConfig('push-url')) + + def coreExiting(self): if not self.getConfig('notifyexit'): return @@ -87,10 +91,9 @@ class WindowsPhoneNotify(Hook): def notify(self, event, msg="", - key=(self.getConfig('id'), self.getConfig('url'))): - - id, url = key + key=(None, None)): + id, url = key or self.key if not id or not url: return @@ -108,7 +111,6 @@ class WindowsPhoneNotify(Hook): elif self.notifications >= self.getConf("sendpermin"): return - request = self.getXmlData("%s: %s" % (event, msg) if msg else event) webservice = httplib.HTTP(url) @@ -124,3 +126,5 @@ class WindowsPhoneNotify(Hook): self.last_notify = time.time() self.notifications += 1 + + return True |