Fix watch statistic links for Live TV

This commit is contained in:
JonnyWong16 2020-02-17 12:42:00 -08:00
parent 075f9f8cbd
commit 2e42663832

View file

@ -89,18 +89,23 @@ DOCUMENTATION :: END
<div id="stats-thumb-${stat_id}-bg" class="dashboard-stats-poster" style="background-image: url(pms_image_proxy?img=${row0['thumb']}&rating_key=${row0['rating_key']}&width=300&height=300&opacity=60&background=282828&blur=3&fallback=cover);"></div> <div id="stats-thumb-${stat_id}-bg" class="dashboard-stats-poster" style="background-image: url(pms_image_proxy?img=${row0['thumb']}&rating_key=${row0['rating_key']}&width=300&height=300&opacity=60&background=282828&blur=3&fallback=cover);"></div>
% endif % endif
<% <%
height, type = ('450', 'poster') height, fallback = ('450', 'poster')
if stat_id in ('top_music', 'popular_music'): if stat_id in ('top_music', 'popular_music'):
height, type = ('300', 'cover') height, fallback = ('300', 'cover')
elif row0['live']: elif row0['live']:
height, type = ('450', 'poster-live') height, fallback = ('450', 'poster-live')
href = '#'
if row0['rating_key']:
href = 'info?rating_key={}'.format(row0['rating_key'])
if row0['live']:
href += '&source=history'
%> %>
<% href = 'info?rating_key={}'.format(row0['rating_key']) if row0['rating_key'] else '#' %>
<a id="stats-thumb-url-${stat_id}" href="${href}" title="${row0['title']}"> <a id="stats-thumb-url-${stat_id}" href="${href}" title="${row0['title']}">
% if row0['thumb']: % if row0['thumb']:
<div id="stats-thumb-${stat_id}" class="dashboard-stats-${type}" style="background-image: url(pms_image_proxy?img=${row0['thumb']}&rating_key=${row0['rating_key']}&width=300&height=${height}&fallback=${type});"></div> <div id="stats-thumb-${stat_id}" class="dashboard-stats-${fallback}" style="background-image: url(pms_image_proxy?img=${row0['thumb']}&rating_key=${row0['rating_key']}&width=300&height=${height}&fallback=${fallback});"></div>
% else: % else:
<div id="stats-thumb-${stat_id}" class="dashboard-stats-${type}" style="background-image: url(images/${type}.png);"></div> <div id="stats-thumb-${stat_id}" class="dashboard-stats-${fallback}" style="background-image: url(images/${fallback}.png);"></div>
% endif % endif
</a> </a>
</div> </div>
@ -140,7 +145,13 @@ DOCUMENTATION :: END
<div class="sub-list">${loop.index + 1}</div> <div class="sub-list">${loop.index + 1}</div>
<div class="sub-value"> <div class="sub-value">
% if stat_id in ('top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music', 'popular_music', 'last_watched'): % if stat_id in ('top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music', 'popular_music', 'last_watched'):
<% href = 'info?rating_key={}'.format(row['rating_key']) if row['rating_key'] else '#' %> <%
href = '#'
if row['rating_key']:
href = 'info?rating_key={}'.format(row['rating_key'])
if row0['live']:
href += '&source=history'
%>
<a href="${href}" title="${row['title']}"> <a href="${href}" title="${row['title']}">
${row['title']} ${row['title']}
</a> </a>
@ -194,7 +205,7 @@ DOCUMENTATION :: END
} else if (live) { } else if (live) {
[height, fallback_poster, fallback_art] = [450, 'poster-live', 'art-live']; [height, fallback_poster, fallback_art] = [450, 'poster-live', 'art-live'];
} }
var href; var href = '#';
if (stat_id === 'most_concurrent') { if (stat_id === 'most_concurrent') {
return return
@ -202,8 +213,6 @@ DOCUMENTATION :: END
$('#stats-thumb-' + stat_id).css('background-image', 'url(' + (user_thumb || 'images/gravatar-default.png') + ')'); $('#stats-thumb-' + stat_id).css('background-image', 'url(' + (user_thumb || 'images/gravatar-default.png') + ')');
if (user_id) { if (user_id) {
href = 'user?user_id=' + user_id; href = 'user?user_id=' + user_id;
} else {
href = '#';
} }
$('#stats-thumb-url-' + stat_id).attr('href', href).prop('title', $(elem).data('friendly_name')); $('#stats-thumb-url-' + stat_id).attr('href', href).prop('title', $(elem).data('friendly_name'));
} else if (stat_id === 'top_platforms') { } else if (stat_id === 'top_platforms') {
@ -216,8 +225,9 @@ DOCUMENTATION :: END
} else { } else {
if (rating_key) { if (rating_key) {
href = 'info?rating_key=' + rating_key; href = 'info?rating_key=' + rating_key;
} else { if (live) {
href = '#'; href += '&source=history';
}
} }
$('#stats-thumb-url-' + stat_id).attr('href', href).prop('title', $(elem).data('title')); $('#stats-thumb-url-' + stat_id).attr('href', href).prop('title', $(elem).data('title'));
if (art) { if (art) {