mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-22 14:13:40 -07:00
stats for collections of sub media type
This commit is contained in:
parent
1dbe745b1e
commit
9ce72f8df0
2 changed files with 9 additions and 13 deletions
|
@ -543,10 +543,7 @@ DOCUMENTATION :: END
|
|||
</div>
|
||||
</div>
|
||||
% endif
|
||||
<%
|
||||
collection_valid = data['media_type'] == 'collection' and data['sub_media_type'] in ('movie', 'show', 'artist')
|
||||
%>
|
||||
% if data['media_type'] in ('movie', 'show', 'season', 'episode', 'artist', 'album', 'track') or collection_valid:
|
||||
% if data['media_type'] in ('movie', 'show', 'season', 'episode', 'artist', 'album', 'track', 'collection'):
|
||||
<div class="col-md-12">
|
||||
<div class="table-card-header">
|
||||
<div class="header-bar">
|
||||
|
@ -854,7 +851,6 @@ DOCUMENTATION :: END
|
|||
<%
|
||||
data = defaultdict(None, **metadata)
|
||||
history_user_id = '' if _session['user_group'] == 'admin' else _session['user_id']
|
||||
collection_valid = data['media_type'] == 'collection' and data['sub_media_type'] in ('movie', 'show', 'artist')
|
||||
%>
|
||||
<script src="${http_root}js/tables/history_table.js${cache_param}"></script>
|
||||
<script src="${http_root}js/tables/export_table.js${cache_param}"></script>
|
||||
|
@ -930,7 +926,7 @@ DOCUMENTATION :: END
|
|||
});
|
||||
</script>
|
||||
% endif
|
||||
% if data['media_type'] in ('movie', 'show', 'season', 'episode', 'artist', 'album', 'track') or "${collection_valid}":
|
||||
% if data['media_type'] in ('movie', 'show', 'season', 'episode', 'artist', 'album', 'track', 'collection'):
|
||||
<script>
|
||||
// Populate watch time stats
|
||||
$.ajax({
|
||||
|
|
|
@ -1159,7 +1159,7 @@ class DataFactory(object):
|
|||
rating_keys = []
|
||||
if media_type == 'collection':
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
result = pms_connect.get_item_children(rating_key=rating_key)
|
||||
result = pms_connect.get_item_children(rating_key=rating_key, media_type=media_type)
|
||||
|
||||
for child in result['children_list']:
|
||||
rating_keys.append(child['rating_key'])
|
||||
|
@ -1179,14 +1179,14 @@ class DataFactory(object):
|
|||
'COUNT(DISTINCT %s) AS total_plays, section_id ' \
|
||||
'FROM session_history ' \
|
||||
'JOIN session_history_metadata ON session_history_metadata.id = session_history.id ' \
|
||||
'WHERE stopped >= %s ' \
|
||||
'WHERE stopped >= ? ' \
|
||||
'AND (session_history.grandparent_rating_key IN (%s) ' \
|
||||
'OR session_history.parent_rating_key IN (%s) ' \
|
||||
'OR session_history.rating_key IN (%s))' % (
|
||||
group_by, timestamp_query, rating_keys_arg, rating_keys_arg, rating_keys_arg
|
||||
group_by, rating_keys_arg, rating_keys_arg, rating_keys_arg
|
||||
)
|
||||
|
||||
result = monitor_db.select(query, args=rating_keys*3)
|
||||
result = monitor_db.select(query, args=[timestamp_query] + rating_keys * 3)
|
||||
else:
|
||||
result = []
|
||||
else:
|
||||
|
@ -1202,7 +1202,7 @@ class DataFactory(object):
|
|||
group_by, rating_keys_arg, rating_keys_arg, rating_keys_arg
|
||||
)
|
||||
|
||||
result = monitor_db.select(query, args=rating_keys*3)
|
||||
result = monitor_db.select(query, args=rating_keys * 3)
|
||||
else:
|
||||
result = []
|
||||
except Exception as e:
|
||||
|
@ -1246,7 +1246,7 @@ class DataFactory(object):
|
|||
rating_keys = []
|
||||
if media_type == 'collection':
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
result = pms_connect.get_item_children(rating_key=rating_key)
|
||||
result = pms_connect.get_item_children(rating_key=rating_key, media_type=media_type)
|
||||
|
||||
for child in result['children_list']:
|
||||
rating_keys.append(child['rating_key'])
|
||||
|
@ -1274,7 +1274,7 @@ class DataFactory(object):
|
|||
group_by, rating_keys_arg, rating_keys_arg, rating_keys_arg
|
||||
)
|
||||
|
||||
result = monitor_db.select(query, args=rating_keys*3)
|
||||
result = monitor_db.select(query, args=rating_keys * 3)
|
||||
else:
|
||||
result = []
|
||||
except Exception as e:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue