Fix current activity artwork for tracks

This commit is contained in:
JonnyWong16 2016-05-11 20:59:19 -07:00
commit 150453bff3
3 changed files with 17 additions and 7 deletions

View file

@ -570,6 +570,10 @@ a .users-poster-face:hover {
margin-left: 5px;
float: left;
}
#dashboard-checking-activity,
#dashboard-no-activity {
margin-bottom: 20px;
}
.dashboard-instance {
float: left;
position: relative;

View file

@ -60,6 +60,10 @@ DOCUMENTATION :: END
</%doc>
% if data is not None:
<%
from plexpy import helpers
data['indexes'] = helpers.cast_to_int(data['indexes'])
%>
<div class="dashboard-instance" id="instance-${data['session_key']}" data-id="${data['session_key']}">
<div class="dashboard-hover-container">
% if (data['media_type'] == 'movie' or data['media_type'] == 'episode' or data['media_type'] == 'track') and data['rating_key']:
@ -80,9 +84,9 @@ DOCUMENTATION :: END
<div class="dashboard-activity-cover-face-bg" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
<div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
% elif data['media_type'] == 'clip':
% if data['art'][:4] == 'http':
% if data['art'].startswith('http'):
<div class="dashboard-activity-poster-face" style="background-image: url(${data['art']});"></div>
% elif data['thumb'][:4] == 'http':
% elif data['thumb'].startswith('http'):
<div class="dashboard-activity-poster-face" style="background-image: url(${data['thumb']});"></div>
% else:
% if data['art']:
@ -92,7 +96,7 @@ DOCUMENTATION :: END
% endif
% endif
% elif data['media_type'] == 'photo':
<div class="dashboard-activity-poster-face bif" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=500&height=500&fallback=cover);"></div>
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=500&height=500&fallback=cover);"></div>
% else:
<div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
% endif

View file

@ -14,7 +14,6 @@
</div>
<div id="currentActivity">
<div class="text-muted" id="dashboard-checking-activity"><i class="fa fa-refresh fa-spin"></i> Checking for activity...</div>
<br>
</div>
</div>
</div>
@ -108,7 +107,6 @@
$('#dashboard-checking-activity').remove();
var current_activity = $.parseJSON(xhr.responseText);
console.log(current_activity)
var stream_count = parseInt(current_activity.stream_count);
var sessions = current_activity.sessions;
@ -147,7 +145,7 @@
$('#play-state-' + key).html(state_icon);
// if using bif indexes, update the bif thumbnail
if (s.indexes == 1) {
if (s.indexes) {
var bif_poster = $('#bif-' + key);
bif_poster.animate({ opacity: 0 }, { duration: 1000, queue: false });
bif_poster.after($('<div id="bif-' + key + '"class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img='
@ -184,7 +182,7 @@
});
} else {
$('#currentActivity').html('<div id="dashboard-no-activity" class="text-muted" style="margin-bottom: 20px;">Nothing is currently being played.</div>');
$('#currentActivity').html('<div id="dashboard-no-activity" class="text-muted">Nothing is currently being played.</div>');
}
}
});
@ -216,6 +214,10 @@
$('#currentActivity').on('click', '.btn-activity-info', function (e) {
e.preventDefault();
$($(this).attr('data-target')).toggle();
var id = $(this).closest('.dashboard-instance').data('id');
var filterVal = $('#stream-' + id).is(':visible') ? 'blur(5px)' : '';
$($(this).closest('.dashboard-activity-poster').find('.dashboard-activity-poster-face, .dashboard-activity-cover-face'))
.css('filter',filterVal).css('webkitFilter',filterVal).css('mozFilter',filterVal).css('oFilter',filterVal).css('msFilter',filterVal);
});
// Add hover class to dashboard-instance