diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-05-27 23:17:33 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-05-27 23:17:33 +0200 |
commit | 9d0fef4d50c9f46daf00e50814a57b3000097ac8 (patch) | |
tree | 90fda7c322ba186ab7f48e05464bc9a228106c8c /module/plugins/hooks/WindowsPhoneNotify.py | |
parent | Merge pull request #1430 from zapp-brannigan/patch-1 (diff) | |
download | pyload-9d0fef4d50c9f46daf00e50814a57b3000097ac8.tar.xz |
Fix https://github.com/pyload/pyload/issues/1428
Diffstat (limited to 'module/plugins/hooks/WindowsPhoneNotify.py')
-rw-r--r-- | module/plugins/hooks/WindowsPhoneNotify.py | 18 |
1 files changed, 11 insertions, 7 deletions
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 |