You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.8 KiB
66 lines
1.8 KiB
14 years ago
|
from couchpotato.core.helpers.encoding import toUnicode
|
||
|
from couchpotato.core.logger import CPLog
|
||
|
from couchpotato.core.notifications.base import Notification
|
||
|
import time
|
||
|
|
||
|
log = CPLog(__name__)
|
||
|
|
||
|
|
||
|
class Boxcar(Notification):
|
||
|
|
||
|
url = 'https://boxcar.io/devices/providers/7MNNXY3UIzVBwvzkKwkC/notifications'
|
||
|
|
||
12 years ago
|
def notify(self, message = '', data = None, listener = None):
|
||
|
if not data: data = {}
|
||
14 years ago
|
|
||
|
try:
|
||
|
message = message.strip()
|
||
|
|
||
11 years ago
|
data = {
|
||
14 years ago
|
'email': self.conf('email'),
|
||
|
'notification[from_screen_name]': self.default_title,
|
||
|
'notification[message]': toUnicode(message),
|
||
|
'notification[from_remote_service_id]': int(time.time()),
|
||
|
}
|
||
|
|
||
11 years ago
|
self.urlopen(self.url, data = data)
|
||
14 years ago
|
except:
|
||
|
log.error('Check your email and added services on boxcar.io')
|
||
|
return False
|
||
|
|
||
|
log.info('Boxcar notification successful.')
|
||
|
return True
|
||
|
|
||
|
def isEnabled(self):
|
||
14 years ago
|
return super(Boxcar, self).isEnabled() and self.conf('email')
|
||
11 years ago
|
|
||
|
|
||
|
config = [{
|
||
|
'name': 'boxcar',
|
||
|
'groups': [
|
||
|
{
|
||
|
'tab': 'notifications',
|
||
|
'list': 'notification_providers',
|
||
|
'name': 'boxcar',
|
||
|
'options': [
|
||
|
{
|
||
|
'name': 'enabled',
|
||
|
'default': 0,
|
||
|
'type': 'enabler',
|
||
|
},
|
||
|
{
|
||
|
'name': 'email',
|
||
|
'description': 'Your Boxcar registration emailaddress.'
|
||
|
},
|
||
|
{
|
||
|
'name': 'on_snatch',
|
||
|
'default': 0,
|
||
|
'type': 'bool',
|
||
|
'advanced': True,
|
||
|
'description': 'Also send message when movie is snatched.',
|
||
|
},
|
||
|
],
|
||
|
}
|
||
|
],
|
||
|
}]
|