mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 12:59:42 -07:00
Add android app notification priority option
This commit is contained in:
parent
e6023a4702
commit
441c56854d
1 changed files with 34 additions and 22 deletions
|
@ -64,6 +64,7 @@ import request
|
||||||
from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS
|
from plexpy.config import _BLACKLIST_KEYS, _WHITELIST_KEYS
|
||||||
from plexpy.helpers import checked
|
from plexpy.helpers import checked
|
||||||
|
|
||||||
|
|
||||||
AGENT_IDS = {'growl': 0,
|
AGENT_IDS = {'growl': 0,
|
||||||
'prowl': 1,
|
'prowl': 1,
|
||||||
'xbmc': 2,
|
'xbmc': 2,
|
||||||
|
@ -692,7 +693,8 @@ class ANDROIDAPP(Notifier):
|
||||||
"""
|
"""
|
||||||
PlexPy Android app notifications
|
PlexPy Android app notifications
|
||||||
"""
|
"""
|
||||||
_DEFAULT_CONFIG = {'device_id': ''
|
_DEFAULT_CONFIG = {'device_id': '',
|
||||||
|
'priority': 3
|
||||||
}
|
}
|
||||||
|
|
||||||
ONESIGNAL_APP_ID = '3b4b666a-d557-4b92-acdf-e2c8c4b95357'
|
ONESIGNAL_APP_ID = '3b4b666a-d557-4b92-acdf-e2c8c4b95357'
|
||||||
|
@ -702,7 +704,8 @@ class ANDROIDAPP(Notifier):
|
||||||
return
|
return
|
||||||
|
|
||||||
plaintext_data = {'subject': subject.encode("utf-8"),
|
plaintext_data = {'subject': subject.encode("utf-8"),
|
||||||
'body': body.encode("utf-8")}
|
'body': body.encode("utf-8"),
|
||||||
|
'priority': self.config['priority']}
|
||||||
|
|
||||||
logger.debug("Plaintext data: {}".format(plaintext_data))
|
logger.debug("Plaintext data: {}".format(plaintext_data))
|
||||||
|
|
||||||
|
@ -733,7 +736,7 @@ class ANDROIDAPP(Notifier):
|
||||||
'data': {'cipher_text': base64.b64encode(encrypted_data),
|
'data': {'cipher_text': base64.b64encode(encrypted_data),
|
||||||
'gcm_tag': base64.b64encode(gcm_tag),
|
'gcm_tag': base64.b64encode(gcm_tag),
|
||||||
'nonce': base64.b64encode(nonce),
|
'nonce': base64.b64encode(nonce),
|
||||||
'salt': base64.b64encode(salt)},
|
'salt': base64.b64encode(salt)}
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
logger.warn(u"PlexPy Notifiers :: PyCryptodome library is missing. "
|
logger.warn(u"PlexPy Notifiers :: PyCryptodome library is missing. "
|
||||||
|
@ -743,7 +746,7 @@ class ANDROIDAPP(Notifier):
|
||||||
payload = {'app_id': self.ONESIGNAL_APP_ID,
|
payload = {'app_id': self.ONESIGNAL_APP_ID,
|
||||||
'include_player_ids': [self.config['device_id']],
|
'include_player_ids': [self.config['device_id']],
|
||||||
'contents': {'en': 'PlexPy Notification'},
|
'contents': {'en': 'PlexPy Notification'},
|
||||||
'data': plaintext_data,
|
'data': plaintext_data
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("OneSignal payload: {}".format(payload))
|
logger.debug("OneSignal payload: {}".format(payload))
|
||||||
|
@ -836,6 +839,15 @@ class ANDROIDAPP(Notifier):
|
||||||
'select_options': devices
|
'select_options': devices
|
||||||
})
|
})
|
||||||
|
|
||||||
|
config_option.append({
|
||||||
|
'label': 'Priority',
|
||||||
|
'value': self.config['priority'],
|
||||||
|
'name': 'androidapp_priority',
|
||||||
|
'description': 'Set the notification priority.',
|
||||||
|
'input_type': 'select',
|
||||||
|
'select_options': {1: 'Minimum', 2: 'Low', 3: 'Normal', 4: 'High'}
|
||||||
|
})
|
||||||
|
|
||||||
return config_option
|
return config_option
|
||||||
|
|
||||||
|
|
||||||
|
@ -1928,7 +1940,7 @@ class NMA(Notifier):
|
||||||
{'label': 'Priority',
|
{'label': 'Priority',
|
||||||
'value': self.config['priority'],
|
'value': self.config['priority'],
|
||||||
'name': 'nma_priority',
|
'name': 'nma_priority',
|
||||||
'description': 'Set the priority.',
|
'description': 'Set the notification priority.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': {-2: -2, -1: -1, 0: 0, 1: 1, 2: 2}
|
'select_options': {-2: -2, -1: -1, 0: 0, 1: 1, 2: 2}
|
||||||
}
|
}
|
||||||
|
@ -2189,7 +2201,7 @@ class PROWL(Notifier):
|
||||||
{'label': 'Priority',
|
{'label': 'Priority',
|
||||||
'value': self.config['priority'],
|
'value': self.config['priority'],
|
||||||
'name': 'prowl_priority',
|
'name': 'prowl_priority',
|
||||||
'description': 'Set the priority.',
|
'description': 'Set the notification priority.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': {-2: -2, -1: -1, 0: 0, 1: 1, 2: 2}
|
'select_options': {-2: -2, -1: -1, 0: 0, 1: 1, 2: 2}
|
||||||
}
|
}
|
||||||
|
@ -2439,7 +2451,7 @@ class PUSHOVER(Notifier):
|
||||||
{'label': 'Priority',
|
{'label': 'Priority',
|
||||||
'value': self.config['priority'],
|
'value': self.config['priority'],
|
||||||
'name': 'pushover_priority',
|
'name': 'pushover_priority',
|
||||||
'description': 'Set the priority.',
|
'description': 'Set the notification priority.',
|
||||||
'input_type': 'select',
|
'input_type': 'select',
|
||||||
'select_options': {-2: -2, -1: -1, 0: 0, 1: 1, 2: 2}
|
'select_options': {-2: -2, -1: -1, 0: 0, 1: 1, 2: 2}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue