mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 04:49:36 -07:00
Fix updating activity card when rating key changes for the same session key (Fixes Tautulli/Tautulli-Issues#96)
This commit is contained in:
parent
cb92d159c1
commit
2fb12ccf65
1 changed files with 14 additions and 6 deletions
|
@ -355,8 +355,9 @@
|
||||||
var session_id = s.session_id;
|
var session_id = s.session_id;
|
||||||
var instance = $('#activity-instance-' + key);
|
var instance = $('#activity-instance-' + key);
|
||||||
|
|
||||||
// Create a new instance if it doesn't exist
|
// Create a new instance if it doesn't exist or recreate the entire instance
|
||||||
if (!(instance.length)) {
|
// if the rating key changed (for movies or episodes) with the same session key
|
||||||
|
if (!(instance.length) || (s.media_type !== 'track' && s.rating_key !== instance.data('rating_key').toString())) {
|
||||||
create_instances.push(key);
|
create_instances.push(key);
|
||||||
getActivityInstance(key);
|
getActivityInstance(key);
|
||||||
return;
|
return;
|
||||||
|
@ -382,7 +383,7 @@
|
||||||
// Switching tracks can be under the same session key, so need to update the info.
|
// Switching tracks can be under the same session key, so need to update the info.
|
||||||
if (s.media_type === 'track') {
|
if (s.media_type === 'track') {
|
||||||
// Update if artist changed
|
// Update if artist changed
|
||||||
if (s.grandparent_rating_key !== instance.data('grandparent_rating_key')) {
|
if (s.grandparent_rating_key !== instance.data('grandparent_rating_key').toString()) {
|
||||||
$('#background-' + key).css('background-image', 'url(pms_image_proxy?img=' + s.art + '&width=500&height=280&opacity=40&background=282828&blur=3&fallback=art&refresh=true)');
|
$('#background-' + key).css('background-image', 'url(pms_image_proxy?img=' + s.art + '&width=500&height=280&opacity=40&background=282828&blur=3&fallback=art&refresh=true)');
|
||||||
$('#metadata-grandparent_title-' + key)
|
$('#metadata-grandparent_title-' + key)
|
||||||
.attr('href', 'info?rating_key=' + s.grandparent_rating_key)
|
.attr('href', 'info?rating_key=' + s.grandparent_rating_key)
|
||||||
|
@ -390,7 +391,7 @@
|
||||||
.text(s.original_title || s.grandparent_title);
|
.text(s.original_title || s.grandparent_title);
|
||||||
}
|
}
|
||||||
// Update cover if album changed
|
// Update cover if album changed
|
||||||
if (s.parent_rating_key !== instance.data('parent_rating_key')) {
|
if (s.parent_rating_key !== instance.data('parent_rating_key').toString()) {
|
||||||
$('#poster-' + key).css('background-image', 'url(pms_image_proxy?img=' + s.parent_thumb + '&width=300&height=300&fallback=poster&refresh=true)');
|
$('#poster-' + key).css('background-image', 'url(pms_image_proxy?img=' + s.parent_thumb + '&width=300&height=300&fallback=poster&refresh=true)');
|
||||||
$('#poster-' + key + '-bg').css('background-image', 'url(pms_image_proxy?img=' + s.parent_thumb + '&width=300&height=300&opacity=60&background=282828&blur=3&fallback=poster&refresh=true)');
|
$('#poster-' + key + '-bg').css('background-image', 'url(pms_image_proxy?img=' + s.parent_thumb + '&width=300&height=300&opacity=60&background=282828&blur=3&fallback=poster&refresh=true)');
|
||||||
$('#poster-url-' + key)
|
$('#poster-url-' + key)
|
||||||
|
@ -402,7 +403,7 @@
|
||||||
.text(s.parent_title);
|
.text(s.parent_title);
|
||||||
}
|
}
|
||||||
// Update cover if track changed
|
// Update cover if track changed
|
||||||
if (s.rating_key !== instance.data('rating_key')) {
|
if (s.rating_key !== instance.data('rating_key').toString()) {
|
||||||
$('#metadata-grandparent_title-' + key)
|
$('#metadata-grandparent_title-' + key)
|
||||||
.attr('href', 'info?rating_key=' + s.grandparent_rating_key)
|
.attr('href', 'info?rating_key=' + s.grandparent_rating_key)
|
||||||
.attr('title', s.original_title || s.grandparent_title)
|
.attr('title', s.original_title || s.grandparent_title)
|
||||||
|
@ -580,7 +581,14 @@
|
||||||
session_key: session_key
|
session_key: session_key
|
||||||
},
|
},
|
||||||
complete: function(xhr, status) {
|
complete: function(xhr, status) {
|
||||||
$('#currentActivity').append(xhr.responseText);
|
var instance = $('#activity-instance-' + session_key);
|
||||||
|
|
||||||
|
if (instance.length) {
|
||||||
|
instance.replaceWith(xhr.responseText);
|
||||||
|
} else {
|
||||||
|
$('#currentActivity').append(xhr.responseText);
|
||||||
|
}
|
||||||
|
|
||||||
$('#activity-instance-' + session_key + ' .dashboard-activity-info-scroller').scrollbar();
|
$('#activity-instance-' + session_key + ' .dashboard-activity-info-scroller').scrollbar();
|
||||||
$('#activity-instance-' + session_key + ' [data-toggle=tooltip]').tooltip({ container: 'body', placement: 'right', delay: 50 });
|
$('#activity-instance-' + session_key + ' [data-toggle=tooltip]').tooltip({ container: 'body', placement: 'right', delay: 50 });
|
||||||
$('#terminate-button-' + session_key).tooltip('destroy').tooltip({ container: 'body', placement: 'left', delay: 50 });
|
$('#terminate-button-' + session_key).tooltip('destroy').tooltip({ container: 'body', placement: 'left', delay: 50 });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue