Join notification subject line optional

This commit is contained in:
JonnyWong16 2016-06-27 20:33:12 -07:00
parent a73053e380
commit 47797ffcd4
2 changed files with 11 additions and 1 deletions

View file

@ -222,6 +222,7 @@ _CONFIG_DEFINITIONS = {
'JOIN_APIKEY': (str, 'Join', ''),
'JOIN_DEVICEID': (str, 'Join', ''),
'JOIN_ENABLED': (int, 'Join', 0),
'JOIN_INCL_SUBJECT': (int, 'Join', 1),
'JOIN_ON_PLAY': (int, 'Join', 0),
'JOIN_ON_STOP': (int, 'Join', 0),
'JOIN_ON_PAUSE': (int, 'Join', 0),

View file

@ -2555,6 +2555,7 @@ class JOIN(object):
def __init__(self):
self.apikey = plexpy.CONFIG.JOIN_APIKEY
self.deviceid = plexpy.CONFIG.JOIN_DEVICEID
self.incl_subject = plexpy.CONFIG.JOIN_INCL_SUBJECT
def conf(self, options):
return cherrypy.config['config'].get('PUSHBULLET', options)
@ -2567,9 +2568,11 @@ class JOIN(object):
data = {'apikey': self.apikey,
deviceid_key: self.deviceid,
'title': subject.encode("utf-8"),
'text': message.encode("utf-8")}
if self.incl_subject:
data['title'] = subject.encode("utf-8")
response = requests.post('https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush',
params=data)
request_status = response.status_code
@ -2650,6 +2653,12 @@ class JOIN(object):
{'label': 'Your Devices IDs',
'description': devices,
'input_type': 'help'
},
{'label': 'Include Subject Line',
'value': self.incl_subject,
'name': 'join_incl_subject',
'description': 'Include the subject line with the notifications.',
'input_type': 'checkbox'
}
]