Remove Notifo
This commit is contained in:
@@ -1,36 +0,0 @@
|
|||||||
from .main import Notifo
|
|
||||||
|
|
||||||
def start():
|
|
||||||
return Notifo()
|
|
||||||
|
|
||||||
config = [{
|
|
||||||
'name': 'notifo',
|
|
||||||
'groups': [
|
|
||||||
{
|
|
||||||
'tab': 'notifications',
|
|
||||||
'list': 'notification_providers',
|
|
||||||
'name': 'notifo',
|
|
||||||
'description': 'Keep in mind that Notifo service will end soon.',
|
|
||||||
'options': [
|
|
||||||
{
|
|
||||||
'name': 'enabled',
|
|
||||||
'default': 0,
|
|
||||||
'type': 'enabler',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'username',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'api_key',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'on_snatch',
|
|
||||||
'default': 0,
|
|
||||||
'type': 'bool',
|
|
||||||
'advanced': True,
|
|
||||||
'description': 'Also send message when movie is snatched.',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
],
|
|
||||||
}]
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
from couchpotato.core.helpers.encoding import toUnicode
|
|
||||||
from couchpotato.core.logger import CPLog
|
|
||||||
from couchpotato.core.notifications.base import Notification
|
|
||||||
import base64
|
|
||||||
import json
|
|
||||||
import traceback
|
|
||||||
|
|
||||||
log = CPLog(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class Notifo(Notification):
|
|
||||||
|
|
||||||
url = 'https://api.notifo.com/v1/send_notification'
|
|
||||||
|
|
||||||
def notify(self, message = '', data = None, listener = None):
|
|
||||||
if not data: data = {}
|
|
||||||
|
|
||||||
try:
|
|
||||||
params = {
|
|
||||||
'label': self.default_title,
|
|
||||||
'msg': toUnicode(message),
|
|
||||||
}
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
'Authorization': "Basic %s" % base64.encodestring('%s:%s' % (self.conf('username'), self.conf('api_key')))[:-1]
|
|
||||||
}
|
|
||||||
|
|
||||||
handle = self.urlopen(self.url, params = params, headers = headers)
|
|
||||||
result = json.loads(handle)
|
|
||||||
|
|
||||||
if result['status'] != 'success' or result['response_message'] != 'OK':
|
|
||||||
raise Exception
|
|
||||||
|
|
||||||
except:
|
|
||||||
log.error('Notification failed: %s', traceback.format_exc())
|
|
||||||
return False
|
|
||||||
|
|
||||||
log.info('Notifo notification successful.')
|
|
||||||
return True
|
|
||||||
Reference in New Issue
Block a user