Merge pull request #1374 from dotsam/ip-first-streamed

Add first_seen to user IP Table
This commit is contained in:
JonnyWong16 2020-07-12 12:41:46 -07:00 committed by GitHub
commit 50e7c0469f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 12 deletions

View file

@ -246,6 +246,7 @@ class Users(object):
columns = ['session_history.id AS history_row_id',
'MAX(session_history.started) AS last_seen',
'MIN(session_history.started) AS first_seen',
'session_history.ip_address',
'COUNT(session_history.id) AS play_count',
'session_history.platform',
@ -306,6 +307,7 @@ class Users(object):
row = {'history_row_id': item['history_row_id'],
'last_seen': item['last_seen'],
'first_seen': item['first_seen'],
'ip_address': item['ip_address'],
'play_count': item['play_count'],
'platform': platform,

View file

@ -1378,8 +1378,8 @@ class WebInterface(object):
user_id (str): The id of the Plex user
Optional parameters:
order_column (str): "last_seen", "ip_address", "platform", "player",
"last_played", "play_count"
order_column (str): "last_seen", "first_seen", "ip_address", "platform",
"player", "last_played", "play_count"
order_dir (str): "desc" or "asc"
start (int): Row to start from, 0
length (int): Number of items to return, 25
@ -1397,6 +1397,7 @@ class WebInterface(object):
"ip_address": "xxx.xxx.xxx.xxx",
"last_played": "Game of Thrones - The Red Woman",
"last_seen": 1462591869,
"first_seen": 1583968210,
"live": 0,
"media_index": 1,
"media_type": "episode",
@ -1423,6 +1424,7 @@ class WebInterface(object):
if not kwargs.get('json_data'):
# TODO: Find some one way to automatically get the columns
dt_columns = [("last_seen", True, False),
("first_seen", True, False),
("ip_address", True, True),
("platform", True, True),
("player", True, True),