diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-11 04:26:40 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-11 04:26:40 +0100 |
commit | e58ca4183db292918e4434b22739761185a74b8d (patch) | |
tree | 90951e572ffbd08aa89e36843ad5263bfa6ee3f1 | |
parent | [XFSHoster] Fix https://github.com/pyload/pyload/issues/1112 (diff) | |
download | pyload-e58ca4183db292918e4434b22739761185a74b8d.tar.xz |
[AndroidPhoneNotify][WindowsPhoneNotify] Don't use storage
-rw-r--r-- | module/plugins/hooks/AndroidPhoneNotify.py | 9 | ||||
-rw-r--r-- | module/plugins/hooks/WindowsPhoneNotify.py (renamed from module/plugins/hooks/WindowsPhoneToastNotify.py) | 13 |
2 files changed, 12 insertions, 10 deletions
diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index fbc2acd5c..d4536842d 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -9,7 +9,7 @@ from module.plugins.Hook import Hook class AndroidPhoneNotify(Hook): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [("apikey" , "str" , "API key" , "" ), ("notifycaptcha" , "bool", "Notify captcha request" , True ), @@ -33,14 +33,15 @@ class AndroidPhoneNotify(Hook): def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 + self.info = {} #@TODO: Remove in 0.4.10 + self.last_notify = 0 def newCaptchaTask(self, task): if not self.getConfig("notifycaptcha"): return False - if time() - float(self.getStorage("AndroidPhoneNotify", 0)) < self.getConf("timeout"): + if time() - self.last_notify < self.getConf("timeout"): return False self.notify(_("Captcha"), _("New request waiting user input")) @@ -76,4 +77,4 @@ class AndroidPhoneNotify(Hook): 'event' : event, 'description': msg}) - self.setStorage("AndroidPhoneNotify", time()) + self.last_notify = time() diff --git a/module/plugins/hooks/WindowsPhoneToastNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py index 20686ee36..821b9643c 100644 --- a/module/plugins/hooks/WindowsPhoneToastNotify.py +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -7,10 +7,10 @@ from time import time from module.plugins.Hook import Hook -class WindowsPhoneToastNotify(Hook): - __name__ = "WindowsPhoneToastNotify" +class WindowsPhoneNotify(Hook): + __name__ = "WindowsPhoneNotify" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("id" , "str" , "Push ID" , "" ), ("url" , "str" , "Push url" , "" ), @@ -35,14 +35,15 @@ class WindowsPhoneToastNotify(Hook): def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 + self.info = {} #@TODO: Remove in 0.4.10 + self.last_notify = 0 def newCaptchaTask(self, task): if not self.getConfig("notifycaptcha"): return False - if time() - float(self.getStorage("WindowsPhoneToastNotify", 0)) < self.getConf("timeout"): + if time() - self.last_notify < self.getConf("timeout"): return False self.notify(_("Captcha"), _("New request waiting user input")) @@ -92,4 +93,4 @@ class WindowsPhoneToastNotify(Hook): webservice.send(request) webservice.close() - self.setStorage("WindowsPhoneToastNotify", time()) + self.last_notify = time() |