From 66a3983c9e7ae45cbb6609b79d0d952e8ced34b7 Mon Sep 17 00:00:00 2001 From: Stefano Date: Fri, 23 Aug 2013 11:36:57 +0200 Subject: Moved new plugin to pyload addons --- module/plugins/hooks/WindowsPhoneToastNotify.py | 64 ------------------------ pyload/plugins/addons/WindowsPhoneToastNotify.py | 64 ++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 64 deletions(-) delete mode 100644 module/plugins/hooks/WindowsPhoneToastNotify.py create mode 100644 pyload/plugins/addons/WindowsPhoneToastNotify.py diff --git a/module/plugins/hooks/WindowsPhoneToastNotify.py b/module/plugins/hooks/WindowsPhoneToastNotify.py deleted file mode 100644 index c9a84982f..000000000 --- a/module/plugins/hooks/WindowsPhoneToastNotify.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . - - @author: RaNaN, Godofdream, zoidberg -""" -import sys, httplib -from module.plugins.Hook import Hook - -class WindowsPhoneToastNotify(Hook): - __name__ = "WindowsPhoneToastNotify" - __version__ = "0.01" - __description__ = """Send push notifications to Windows Phone.""" - __author_name__ = ("Andy Voigt") - __author_mail__ = ("phone-support@hotmail.de") - __config__ = [("activated", "bool", "Activated", False), - ("force", "bool", "Force even if client is connected", False), - ("pushId", "pId", "pushId", ""), - ("pushUrl","pUrl","pushUrl", "")] - - def setup(self): - self.info = {} - - def getXmlData(self): - myxml = " -Pyload Mobile Captcha waiting! " - return myxml - - def doRequest(self): - URL = self.getConfig("pushUrl") - request = self.getXmlData() - webservice = httplib.HTTP(URL) - webservice.putrequest("POST", self.getConfig("pushId")) - webservice.putheader("Host", URL) - webservice.putheader("Content-type", "text/xml") - webservice.putheader("X-NotificationClass", "2") - webservice.putheader("X-WindowsPhone-Target", "toast") - webservice.putheader("Content-length", "%d" % len(request)) - webservice.endheaders() - webservice.send(request) - #statuscode, statusmessage, header = webservice.getreply() - #result = webservice.getfile().read() - webservice.close() - - def newCaptchaTask(self, task): - if not self.getConfig("pushId") or not self.getConfig("pushUrl"): - return False - - if self.core.isClientConnected() and not self.getConfig("force"): - return False - - self.doRequest() - diff --git a/pyload/plugins/addons/WindowsPhoneToastNotify.py b/pyload/plugins/addons/WindowsPhoneToastNotify.py new file mode 100644 index 000000000..c9a84982f --- /dev/null +++ b/pyload/plugins/addons/WindowsPhoneToastNotify.py @@ -0,0 +1,64 @@ +# -*- coding: utf-8 -*- +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: RaNaN, Godofdream, zoidberg +""" +import sys, httplib +from module.plugins.Hook import Hook + +class WindowsPhoneToastNotify(Hook): + __name__ = "WindowsPhoneToastNotify" + __version__ = "0.01" + __description__ = """Send push notifications to Windows Phone.""" + __author_name__ = ("Andy Voigt") + __author_mail__ = ("phone-support@hotmail.de") + __config__ = [("activated", "bool", "Activated", False), + ("force", "bool", "Force even if client is connected", False), + ("pushId", "pId", "pushId", ""), + ("pushUrl","pUrl","pushUrl", "")] + + def setup(self): + self.info = {} + + def getXmlData(self): + myxml = " +Pyload Mobile Captcha waiting! " + return myxml + + def doRequest(self): + URL = self.getConfig("pushUrl") + request = self.getXmlData() + webservice = httplib.HTTP(URL) + webservice.putrequest("POST", self.getConfig("pushId")) + webservice.putheader("Host", URL) + webservice.putheader("Content-type", "text/xml") + webservice.putheader("X-NotificationClass", "2") + webservice.putheader("X-WindowsPhone-Target", "toast") + webservice.putheader("Content-length", "%d" % len(request)) + webservice.endheaders() + webservice.send(request) + #statuscode, statusmessage, header = webservice.getreply() + #result = webservice.getfile().read() + webservice.close() + + def newCaptchaTask(self, task): + if not self.getConfig("pushId") or not self.getConfig("pushUrl"): + return False + + if self.core.isClientConnected() and not self.getConfig("force"): + return False + + self.doRequest() + -- cgit v1.2.3