summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/WindowsPhoneNotify.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
commitb1759bc440cd6013837697eb8de540914f693ffd (patch)
treed170caf63d7f65e44d23ea2d91a65759a1665928 /module/plugins/hooks/WindowsPhoneNotify.py
parent[Plugin] Fix decoding in load method (diff)
downloadpyload-b1759bc440cd6013837697eb8de540914f693ffd.tar.xz
No camelCase style anymore
Diffstat (limited to 'module/plugins/hooks/WindowsPhoneNotify.py')
-rw-r--r--module/plugins/hooks/WindowsPhoneNotify.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py
index 713499322..511b4b568 100644
--- a/module/plugins/hooks/WindowsPhoneNotify.py
+++ b/module/plugins/hooks/WindowsPhoneNotify.py
@@ -9,7 +9,7 @@ from module.plugins.internal.Hook import Hook, Expose
class WindowsPhoneNotify(Hook):
__name__ = "WindowsPhoneNotify"
__type__ = "hook"
- __version__ = "0.11"
+ __version__ = "0.12"
__config__ = [("push-id" , "str" , "Push ID" , "" ),
("push-url" , "str" , "Push url" , "" ),
@@ -34,25 +34,26 @@ class WindowsPhoneNotify(Hook):
def setup(self):
self.info = {} #@TODO: Remove in 0.4.10
- self.event_list = ["allDownloadsProcessed", "plugin_updated"]
+ self.event_list = ["plugin_updated"]
+ self.event_map = {'allDownloadsProcessed': "all_downloads_processed"}
self.last_notify = 0
self.notifications = 0
def plugin_updated(self, type_plugins):
- if not self.getConfig('notifyupdate'):
+ if not self.get_config('notifyupdate'):
return
self.notify(_("Plugins updated"), str(type_plugins))
def activate(self):
- self.key = (self.getConfig('push-id'), self.getConfig('push-url'))
+ self.key = (self.get_config('push-id'), self.get_config('push-url'))
def exit(self):
- if not self.getConfig('notifyexit'):
+ if not self.get_config('notifyexit'):
return
if self.core.do_restart:
@@ -62,19 +63,19 @@ class WindowsPhoneNotify(Hook):
def captcha_task(self, task):
- if not self.getConfig('notifycaptcha'):
+ if not self.get_config('notifycaptcha'):
return
self.notify(_("Captcha"), _("New request waiting user input"))
def package_finished(self, pypack):
- if self.getConfig('notifypackage'):
+ if self.get_config('notifypackage'):
self.notify(_("Package finished"), pypack.name)
- def allDownloadsProcessed(self):
- if not self.getConfig('notifyprocessed'):
+ def all_downloads_processed(self):
+ if not self.get_config('notifyprocessed'):
return
if any(True for pdata in self.core.api.getQueue() if pdata.linksdone < pdata.linkstotal):
@@ -83,7 +84,7 @@ class WindowsPhoneNotify(Hook):
self.notify(_("All packages finished"))
- def getXmlData(self, msg):
+ def get_xml_data(self, msg):
return ("<?xml version='1.0' encoding='utf-8'?> <wp:Notification xmlns:wp='WPNotification'> "
"<wp:Toast> <wp:Text1>pyLoad</wp:Text1> <wp:Text2>%s</wp:Text2> "
"</wp:Toast> </wp:Notification>" % msg)
@@ -99,21 +100,21 @@ class WindowsPhoneNotify(Hook):
if not id or not url:
return
- if self.core.isClientConnected() and not self.getConfig('ignoreclient'):
+ if self.core.isClientConnected() and not self.get_config('ignoreclient'):
return
elapsed_time = time.time() - self.last_notify
- if elapsed_time < self.getConfig("sendtimewait"):
+ if elapsed_time < self.get_config("sendtimewait"):
return
if elapsed_time > 60:
self.notifications = 0
- elif self.notifications >= self.getConfig("sendpermin"):
+ elif self.notifications >= self.get_config("sendpermin"):
return
- request = self.getXmlData("%s: %s" % (event, msg) if msg else event)
+ request = self.get_xml_data("%s: %s" % (event, msg) if msg else event)
webservice = httplib.HTTP(url)
webservice.putrequest("POST", id)