From 9d0fef4d50c9f46daf00e50814a57b3000097ac8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 27 May 2015 23:17:33 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1428 --- module/plugins/hooks/WindowsPhoneNotify.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'module/plugins/hooks/WindowsPhoneNotify.py') 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 -- cgit v1.2.3