mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Merge pull request #105 from JonnyWong16/history-tooltips
History tooltips
This commit is contained in:
commit
8bdd40f011
8 changed files with 226 additions and 53 deletions
|
@ -1,4 +1,4 @@
|
|||
# This file is part of PlexPy.
|
||||
# This file is part of PlexPy.
|
||||
#
|
||||
# PlexPy is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -36,6 +36,13 @@ class DataFactory(object):
|
|||
'session_history.player',
|
||||
'session_history.ip_address',
|
||||
'session_history_metadata.full_title as full_title',
|
||||
'session_history_metadata.thumb',
|
||||
'session_history_metadata.parent_thumb',
|
||||
'session_history_metadata.grandparent_thumb',
|
||||
'session_history_metadata.media_index',
|
||||
'session_history_metadata.parent_media_index',
|
||||
'session_history_metadata.parent_title',
|
||||
'session_history_metadata.year',
|
||||
'session_history.started',
|
||||
'session_history.paused_counter',
|
||||
'session_history.stopped',
|
||||
|
@ -81,12 +88,24 @@ class DataFactory(object):
|
|||
|
||||
rows = []
|
||||
for item in history:
|
||||
if item["media_type"] == 'episode' and item["parent_thumb"]:
|
||||
thumb = item["parent_thumb"]
|
||||
elif item["media_type"] == 'episode':
|
||||
thumb = item["grandparent_thumb"]
|
||||
else:
|
||||
thumb = item["thumb"]
|
||||
|
||||
row = {"id": item['id'],
|
||||
"date": item['date'],
|
||||
"friendly_name": item['friendly_name'],
|
||||
"player": item["player"],
|
||||
"ip_address": item["ip_address"],
|
||||
"full_title": item["full_title"],
|
||||
"thumb": thumb,
|
||||
"media_index": item["media_index"],
|
||||
"parent_media_index": item["parent_media_index"],
|
||||
"parent_title": item["parent_title"],
|
||||
"year": item["year"],
|
||||
"started": item["started"],
|
||||
"paused_counter": item["paused_counter"],
|
||||
"stopped": item["stopped"],
|
||||
|
@ -411,7 +430,6 @@ class DataFactory(object):
|
|||
else:
|
||||
return None
|
||||
|
||||
print result
|
||||
stream_output = {}
|
||||
|
||||
for item in result:
|
||||
|
@ -512,13 +530,15 @@ class DataFactory(object):
|
|||
|
||||
metadata = {}
|
||||
for item in result:
|
||||
directors = item['directors'].split(';')
|
||||
writers = item['writers'].split(';')
|
||||
actors = item['actors'].split(';')
|
||||
genres = item['genres'].split(';')
|
||||
directors = item['directors'].split(';') if item['directors'] else []
|
||||
writers = item['writers'].split(';') if item['writers'] else []
|
||||
actors = item['actors'].split(';') if item['actors'] else []
|
||||
genres = item['genres'].split(';') if item['genres'] else []
|
||||
|
||||
metadata = {'type': item['media_type'],
|
||||
'rating_key': item['rating_key'],
|
||||
'parent_rating_key': item['parent_rating_key'],
|
||||
'grandparent_rating_key': item['grandparent_rating_key'],
|
||||
'grandparent_title': item['grandparent_title'],
|
||||
'parent_index': item['parent_media_index'],
|
||||
'parent_title': item['parent_title'],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# This file is part of PlexPy.
|
||||
# This file is part of PlexPy.
|
||||
#
|
||||
# PlexPy is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -26,7 +26,7 @@ class Users(object):
|
|||
|
||||
columns = ['session_history.id',
|
||||
'users.user_id as user_id',
|
||||
'users.custom_avatar_url as thumb',
|
||||
'users.custom_avatar_url as user_thumb',
|
||||
'(case when users.friendly_name is null then users.username else \
|
||||
users.friendly_name end) as friendly_name',
|
||||
'MAX(session_history.started) as last_seen',
|
||||
|
@ -34,6 +34,9 @@ class Users(object):
|
|||
'COUNT(session_history.id) as plays',
|
||||
'session_history.player as platform',
|
||||
'session_history_metadata.full_title as last_watched',
|
||||
'session_history_metadata.thumb',
|
||||
'session_history_metadata.parent_thumb',
|
||||
'session_history_metadata.grandparent_thumb',
|
||||
'session_history_metadata.media_type',
|
||||
'session_history.rating_key as rating_key',
|
||||
'session_history_media_info.video_decision',
|
||||
|
@ -66,10 +69,17 @@ class Users(object):
|
|||
|
||||
rows = []
|
||||
for item in users:
|
||||
if not item['thumb'] or item['thumb'] == '':
|
||||
if item["media_type"] == 'episode' and item["parent_thumb"]:
|
||||
thumb = item["parent_thumb"]
|
||||
elif item["media_type"] == 'episode':
|
||||
thumb = item["grandparent_thumb"]
|
||||
else:
|
||||
thumb = item["thumb"]
|
||||
|
||||
if not item['user_thumb'] or item['user_thumb'] == '':
|
||||
user_thumb = common.DEFAULT_USER_THUMB
|
||||
else:
|
||||
user_thumb = item['thumb']
|
||||
user_thumb = item['user_thumb']
|
||||
|
||||
row = {"id": item['id'],
|
||||
"plays": item['plays'],
|
||||
|
@ -78,10 +88,11 @@ class Users(object):
|
|||
"ip_address": item['ip_address'],
|
||||
"platform": item['platform'],
|
||||
"last_watched": item['last_watched'],
|
||||
"thumb": thumb,
|
||||
"media_type": item['media_type'],
|
||||
"rating_key": item['rating_key'],
|
||||
"video_decision": item['video_decision'],
|
||||
"thumb": user_thumb,
|
||||
"user_thumb": user_thumb,
|
||||
"user": item["user"],
|
||||
"user_id": item['user_id']
|
||||
}
|
||||
|
@ -108,6 +119,9 @@ class Users(object):
|
|||
'COUNT(session_history.id) as play_count',
|
||||
'session_history.player as platform',
|
||||
'session_history_metadata.full_title as last_watched',
|
||||
'session_history_metadata.thumb',
|
||||
'session_history_metadata.parent_thumb',
|
||||
'session_history_metadata.grandparent_thumb',
|
||||
'session_history_metadata.media_type',
|
||||
'session_history.rating_key as rating_key',
|
||||
'session_history_media_info.video_decision',
|
||||
|
@ -144,12 +158,20 @@ class Users(object):
|
|||
|
||||
rows = []
|
||||
for item in results:
|
||||
if item["media_type"] == 'episode' and item["parent_thumb"]:
|
||||
thumb = item["parent_thumb"]
|
||||
elif item["media_type"] == 'episode':
|
||||
thumb = item["grandparent_thumb"]
|
||||
else:
|
||||
thumb = item["thumb"]
|
||||
|
||||
row = {"id": item['id'],
|
||||
"last_seen": item['last_seen'],
|
||||
"ip_address": item['ip_address'],
|
||||
"play_count": item['play_count'],
|
||||
"platform": item['platform'],
|
||||
"last_watched": item['last_watched'],
|
||||
"thumb": thumb,
|
||||
"media_type": item['media_type'],
|
||||
"rating_key": item['rating_key'],
|
||||
"video_decision": item['video_decision'],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue