mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 23:42:37 -07:00
Change get_users API command to pull from database instead of Plex.tv
This commit is contained in:
parent
9355d31a27
commit
5cf1cac7e9
4 changed files with 44 additions and 13 deletions
14
API.md
14
API.md
|
@ -2293,15 +2293,21 @@ Optional parameters:
|
|||
|
||||
Returns:
|
||||
json:
|
||||
[{"email": "Jon.Snow.1337@CastleBlack.com",
|
||||
[{"allow_guest": 1,
|
||||
"do_notify": 1,
|
||||
"email": "Jon.Snow.1337@CastleBlack.com",
|
||||
"filter_all": "",
|
||||
"filter_movies": "",
|
||||
"filter_music": "",
|
||||
"filter_photos": "",
|
||||
"filter_tv": "",
|
||||
"is_allow_sync": null,
|
||||
"is_home_user": "1",
|
||||
"is_restricted": "0",
|
||||
"is_admin": 0,
|
||||
"is_allow_sync": 1,
|
||||
"is_home_user": 1,
|
||||
"is_restricted": 0,
|
||||
"keep_history": 1,
|
||||
"server_token": "PU9cMuQZxJKFBtGqHk68",
|
||||
"shared_libraries": "1;2;3",
|
||||
"thumb": "https://plex.tv/users/k10w42309cynaopq/avatar",
|
||||
"user_id": "133788",
|
||||
"username": "Jon Snow"
|
||||
|
|
|
@ -355,8 +355,8 @@ class PlexTV(object):
|
|||
"username": helpers.get_xml_attr(a, 'username'),
|
||||
"thumb": helpers.get_xml_attr(a, 'thumb'),
|
||||
"email": helpers.get_xml_attr(a, 'email'),
|
||||
"is_home_user": helpers.get_xml_attr(a, 'home'),
|
||||
"is_admin": 1,
|
||||
"is_home_user": helpers.get_xml_attr(a, 'home'),
|
||||
"is_allow_sync": 1,
|
||||
"is_restricted": helpers.get_xml_attr(a, 'restricted'),
|
||||
"filter_all": helpers.get_xml_attr(a, 'filterAll'),
|
||||
|
|
|
@ -579,7 +579,11 @@ class Users(object):
|
|||
monitor_db = database.MonitorDatabase()
|
||||
|
||||
try:
|
||||
query = 'SELECT user_id, username, friendly_name, email FROM users WHERE deleted_user = 0'
|
||||
query = 'SELECT user_id, username, friendly_name, thumb, custom_avatar_url, email, ' \
|
||||
'is_admin, is_home_user, is_allow_sync, is_restricted, ' \
|
||||
'do_notify, keep_history, allow_guest, server_token, shared_libraries, ' \
|
||||
'filter_all, filter_movies, filter_tv, filter_music, filter_photos ' \
|
||||
'FROM users WHERE deleted_user = 0'
|
||||
result = monitor_db.select(query=query)
|
||||
except Exception as e:
|
||||
logger.warn(u"Tautulli Users :: Unable to execute database query for get_users: %s." % e)
|
||||
|
@ -590,7 +594,22 @@ class Users(object):
|
|||
user = {'user_id': item['user_id'],
|
||||
'username': item['username'],
|
||||
'friendly_name': item['friendly_name'] or item['username'],
|
||||
'email': item['email']
|
||||
'thumb': item['custom_avatar_url'] or item['thumb'],
|
||||
'email': item['email'],
|
||||
'is_admin': item['is_admin'],
|
||||
'is_home_user': item['is_home_user'],
|
||||
'is_allow_sync': item['is_allow_sync'],
|
||||
'is_restricted': item['is_restricted'],
|
||||
'do_notify': item['do_notify'],
|
||||
'keep_history': item['keep_history'],
|
||||
'allow_guest': item['allow_guest'],
|
||||
'server_token': item['server_token'],
|
||||
'shared_libraries': item['shared_libraries'],
|
||||
'filter_all': item['filter_all'],
|
||||
'filter_movies': item['filter_movies'],
|
||||
'filter_tv': item['filter_tv'],
|
||||
'filter_music': item['filter_music'],
|
||||
'filter_photos': item['filter_photos'],
|
||||
}
|
||||
users.append(user)
|
||||
|
||||
|
|
|
@ -5214,15 +5214,21 @@ class WebInterface(object):
|
|||
|
||||
Returns:
|
||||
json:
|
||||
[{"email": "Jon.Snow.1337@CastleBlack.com",
|
||||
[{"allow_guest": 1,
|
||||
"do_notify": 1,
|
||||
"email": "Jon.Snow.1337@CastleBlack.com",
|
||||
"filter_all": "",
|
||||
"filter_movies": "",
|
||||
"filter_music": "",
|
||||
"filter_photos": "",
|
||||
"filter_tv": "",
|
||||
"is_allow_sync": null,
|
||||
"is_home_user": "1",
|
||||
"is_restricted": "0",
|
||||
"is_admin": 0,
|
||||
"is_allow_sync": 1,
|
||||
"is_home_user": 1,
|
||||
"is_restricted": 0,
|
||||
"keep_history": 1,
|
||||
"server_token": "PU9cMuQZxJKFBtGqHk68",
|
||||
"shared_libraries": "1;2;3",
|
||||
"thumb": "https://plex.tv/users/k10w42309cynaopq/avatar",
|
||||
"user_id": "133788",
|
||||
"username": "Jon Snow"
|
||||
|
@ -5232,8 +5238,8 @@ class WebInterface(object):
|
|||
]
|
||||
```
|
||||
"""
|
||||
plex_tv = plextv.PlexTV()
|
||||
result = plex_tv.get_full_users_list()
|
||||
user_data = users.Users()
|
||||
result = user_data.get_users()
|
||||
|
||||
if result:
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue