add most active libraries and total plays to home

This commit is contained in:
herby2212 2021-03-01 21:54:14 +01:00
commit 4e959be84d
5 changed files with 62 additions and 7 deletions

View file

@ -25,7 +25,7 @@ grandparent_thumb Returns location of the item's thumbnail. Use with pms_i
rating_key Returns the unique identifier for the media item.
title Returns the title for the associated stat.
== Only if 'stat_id' is 'top_tv' or 'top_movies' or 'top_music' or 'top_user' or 'top_platform' ==
== Only if 'stat_id' is 'top_tv' or 'top_movies' or 'top_music' or 'top_user' or 'top_platform' or 'top_libraries' ==
total_plays Returns the count for the associated stat.
total_duration Returns the total duration for the associated stat.
@ -111,6 +111,8 @@ DOCUMENTATION :: END
<div id="stats-thumb-${stat_id}" class="dashboard-stats-flat svg-icon platform-${row0['platform_name']} transparent hidden-xs"></div>
% elif stat_id == 'most_concurrent':
<div id="stats-thumb-${stat_id}" class="dashboard-stats-flat svg-icon stats-${stat_id} transparent hidden-xs"></div>
% elif stat_id == 'top_libraries':
<div id="stats-thumb-${stat_id}" class="dashboard-stats-flat svg-icon library-${row0['type']} hidden-xs"></div>
% endif
<div class="dashboard-stats-info-container">
<div id="stats-title-${stat_id}" class="dashboard-stats-info-title">
@ -133,7 +135,7 @@ DOCUMENTATION :: END
% for row in top_stat['rows']:
<li class="dashboard-stats-info-item ${'expanded' if loop.index == 0 else ''}" data-stat_id="${stat_id}"
data-rating_key="${row.get('rating_key')}" data-guid="${row.get('guid')}" data-title="${row.get('title')}"
data-art="${row.get('art')}" data-thumb="${row.get('thumb')}" data-platform="${row.get('platform_name')}"
data-art="${row.get('art')}" data-thumb="${row.get('thumb')}" data-platform="${row.get('platform_name')}" data-library-type="${row.get('type')}"
data-user_id="${row.get('user_id')}" data-user="${row.get('user')}" data-friendly_name="${row.get('friendly_name')}" data-user_thumb="${row.get('user_thumb')}"
data-last_watch="${row.get('last_watch')}" data-started="${row.get('started')}" data-live="${row.get('live')}">
<div class="sub-list">${loop.index + 1}</div>
@ -159,6 +161,8 @@ DOCUMENTATION :: END
${row['platform']}
% elif stat_id == 'most_concurrent':
${row['title']}
% elif stat_id == 'top_libraries':
${row['library_name']}
% endif
</div>
<div class="sub-count">

View file

@ -810,6 +810,10 @@
$('#stats-background-' + stat_id).removeClass(function (index, className) {
return (className.match (/(^|\s)platform-\S+/g) || []).join(' ');
}).addClass('platform-' + $(elem).data('platform') + '-rgba');
} else if (stat_id == 'top_libraries') {
$('#stats-thumb-' + stat_id).removeClass(function (index, className) {
return (className.match (/(^|\s)library-\S+/g) || []).join(' ');
}).addClass('library-' + $(elem).data('library-type'));
} else {
if (rating_key) {
if (live) {

View file

@ -19,6 +19,7 @@ thumb Returns the thumb of the library.
count Returns the number of top level items in the library.
parent_count Returns the number of parent items in the library.
child_count Returns the number of child items in the library.
total_plays Returns the number of total plays of the library.
DOCUMENTATION :: END
</%doc>
@ -28,9 +29,9 @@ DOCUMENTATION :: END
from plexpy.helpers import page
types = ('movie', 'show', 'artist', 'photo')
headers = {'movie': ('Movie Libraries', ('Movies', '', '')),
'show': ('TV Show Libraries', ('Shows', 'Seasons', 'Episodes')),
'artist': ('Music Libraries', ('Artists', 'Albums', 'Tracks')),
headers = {'movie': ('Movie Libraries', ('Movies', '', '', 'Total Plays')),
'show': ('TV Show Libraries', ('Shows', 'Seasons', 'Episodes', 'Total Plays')),
'artist': ('Music Libraries', ('Artists', 'Albums', 'Tracks', 'Total Plays')),
'photo': ('Photo Libraries', ('Albums', 'Photos', 'Videos'))}
%>
% for section_type in types:
@ -80,6 +81,12 @@ DOCUMENTATION :: END
${section['grandchild_count']}
</div>
% endif
% if headers[section_type][1][3]:
<div class="sub-divider"> / </div>
<div class="sub-count">
${section['total_plays']}
</div>
% endif
</li>
% endfor
</ul>