mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-14 01:02:59 -07:00
Add min_version parameter to register_device API command
This commit is contained in:
parent
7914f56ec3
commit
36aa795c52
3 changed files with 17 additions and 7 deletions
4
API.md
4
API.md
|
@ -2906,12 +2906,12 @@ Required parameters:
|
|||
Optional parameters:
|
||||
friendly_name (str): A friendly name to identify the mobile device
|
||||
onesignal_id (str): The OneSignal id for the mobile device
|
||||
min_version (str): The minimum Tautulli version supported by the mobile device, e.g. v2.5.6
|
||||
|
||||
Returns:
|
||||
json:
|
||||
{"pms_name": "Winterfell-Server",
|
||||
"server_id": "ds48g4r354a8v9byrrtr697g3g79w",
|
||||
"tautulli_version": "v2.5.6"
|
||||
"server_id": "ds48g4r354a8v9byrrtr697g3g79w"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -396,7 +396,8 @@ class API2(object):
|
|||
|
||||
return data
|
||||
|
||||
def register_device(self, device_id='', device_name='', friendly_name='', onesignal_id=None, **kwargs):
|
||||
def register_device(self, device_id='', device_name='', friendly_name='', onesignal_id=None,
|
||||
min_version='', **kwargs):
|
||||
""" Registers the Tautulli Android App for notifications.
|
||||
|
||||
```
|
||||
|
@ -407,12 +408,12 @@ class API2(object):
|
|||
Optional parameters:
|
||||
friendly_name (str): A friendly name to identify the mobile device
|
||||
onesignal_id (str): The OneSignal id for the mobile device
|
||||
min_version (str): The minimum Tautulli version supported by the mobile device, e.g. v2.5.6
|
||||
|
||||
Returns:
|
||||
json:
|
||||
{"pms_name": "Winterfell-Server",
|
||||
"server_id": "ds48g4r354a8v9byrrtr697g3g79w",
|
||||
"tautulli_version": "v2.5.6"
|
||||
"server_id": "ds48g4r354a8v9byrrtr697g3g79w"
|
||||
}
|
||||
```
|
||||
"""
|
||||
|
@ -426,6 +427,12 @@ class API2(object):
|
|||
self._api_result_type = 'error'
|
||||
return
|
||||
|
||||
elif min_version and helpers.version_to_tuple(min_version) > helpers.version_to_tuple(common.RELEASE):
|
||||
self._api_msg = 'Device registration failed: Tautulli version {} ' \
|
||||
'does not meet the minimum requirement of {}.'.format(common.RELEASE, min_version)
|
||||
self._api_result_type = 'error'
|
||||
return
|
||||
|
||||
## TODO: Temporary for backwards compatibility, assume device_id is onesignal_id
|
||||
if device_id and onesignal_id is None:
|
||||
onesignal_id = device_id
|
||||
|
@ -444,8 +451,7 @@ class API2(object):
|
|||
|
||||
data = {
|
||||
"pms_name": plexpy.CONFIG.PMS_NAME,
|
||||
"server_id": plexpy.CONFIG.PMS_UUID,
|
||||
"tautulli_version": common.RELEASE
|
||||
"server_id": plexpy.CONFIG.PMS_UUID
|
||||
}
|
||||
|
||||
return data
|
||||
|
|
|
@ -1470,6 +1470,10 @@ def is_hdr(bit_depth, color_space):
|
|||
return bit_depth > 8 and color_space == 'bt2020nc'
|
||||
|
||||
|
||||
def version_to_tuple(version):
|
||||
return tuple(cast_to_int(v) for v in version.strip('v').split('.'))
|
||||
|
||||
|
||||
def page(endpoint, *args, **kwargs):
|
||||
endpoints = {
|
||||
'pms_image_proxy': pms_image_proxy,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue