summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/AndroidPhoneNotify.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hooks/AndroidPhoneNotify.py')
-rw-r--r--module/plugins/hooks/AndroidPhoneNotify.py52
1 files changed, 24 insertions, 28 deletions
diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py
index a8a1cff72..f79f226e4 100644
--- a/module/plugins/hooks/AndroidPhoneNotify.py
+++ b/module/plugins/hooks/AndroidPhoneNotify.py
@@ -2,14 +2,14 @@
import time
-from module.network.RequestFactory import getURL
-from module.plugins.Hook import Hook, Expose
+from module.plugins.internal.Addon import Addon, Expose
-class AndroidPhoneNotify(Hook):
+class AndroidPhoneNotify(Addon):
__name__ = "AndroidPhoneNotify"
__type__ = "hook"
- __version__ = "0.08"
+ __version__ = "0.10"
+ __status__ = "testing"
__config__ = [("apikey" , "str" , "API key" , "" ),
("notifycaptcha" , "bool", "Notify captcha request" , True ),
@@ -27,56 +27,52 @@ class AndroidPhoneNotify(Hook):
("Walter Purcaro", "vuolter@gmail.com" )]
- interval = 0 #@TODO: Remove in 0.4.10
-
-
- def setup(self):
- self.info = {} #@TODO: Remove in 0.4.10
-
- self.event_list = ["allDownloadsProcessed", "plugin_updated"]
+ def init(self):
+ 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 coreReady(self):
- self.key = self.getConfig('apikey')
+ def activate(self):
+ self.key = self.get_config('apikey')
- def coreExiting(self):
- if not self.getConfig('notifyexit'):
+ def exit(self):
+ if not self.get_config('notifyexit'):
return
- if self.core.do_restart:
+ if self.pyload.do_restart:
self.notify(_("Restarting pyLoad"))
else:
self.notify(_("Exiting pyLoad"))
- def newCaptchaTask(self, task):
- if not self.getConfig('notifycaptcha'):
+ def captcha_task(self, task):
+ if not self.get_config('notifycaptcha'):
return
self.notify(_("Captcha"), _("New request waiting user input"))
- def packageFinished(self, pypack):
- if self.getConfig('notifypackage'):
+ def package_finished(self, pypack):
+ 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):
+ if any(True for pdata in self.pyload.api.getQueue() if pdata.linksdone < pdata.linkstotal):
self.notify(_("Package failed"), _("One or more packages was not completed successfully"))
else:
self.notify(_("All packages finished"))
@@ -92,21 +88,21 @@ class AndroidPhoneNotify(Hook):
if not key:
return
- if self.core.isClientConnected() and not self.getConfig('ignoreclient'):
+ if self.pyload.isClientConnected() and not self.get_config('ignoreclient'):
return
elapsed_time = time.time() - self.last_notify
- if elapsed_time < self.getConf("sendtimewait"):
+ if elapsed_time < self.get_config("sendtimewait"):
return
if elapsed_time > 60:
self.notifications = 0
- elif self.notifications >= self.getConf("sendpermin"):
+ elif self.notifications >= self.get_config("sendpermin"):
return
- getURL("http://www.notifymyandroid.com/publicapi/notify",
+ self.load("http://www.notifymyandroid.com/publicapi/notify",
get={'apikey' : key,
'application': "pyLoad",
'event' : event,