mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 13:41:15 -07:00
Default to 'Unknown' for any missing activity values
This commit is contained in:
parent
976418de0f
commit
fdff9d7454
3 changed files with 13 additions and 4 deletions
|
@ -59,12 +59,14 @@ indexes Returns true if the media has media indexes and are
|
|||
DOCUMENTATION :: END
|
||||
</%doc>
|
||||
|
||||
% if data is not None:
|
||||
% if session is not None:
|
||||
<%
|
||||
from collections import defaultdict
|
||||
from urllib import quote
|
||||
from plexpy import helpers
|
||||
import plexpy
|
||||
%>
|
||||
<% data = defaultdict(lambda: 'Unknown', **session) %>
|
||||
<% sk = data['session_key'] %>
|
||||
<div class="dashboard-activity-instance" id="activity-instance-${sk}" data-key="${sk}" data-id="${data['session_id']}"
|
||||
data-rating_key="${data['rating_key']}" data-parent_rating_key="${data['parent_rating_key']}" data-grandparent_rating_key="${data['grandparent_rating_key']}">
|
||||
|
|
|
@ -229,6 +229,12 @@
|
|||
</script>
|
||||
% if 'current_activity' in config['home_sections']:
|
||||
<script>
|
||||
var defaultHandler = {
|
||||
get: function(target, name) {
|
||||
return target.hasOwnProperty(name) ? target[name] : 'Unknown';
|
||||
}
|
||||
};
|
||||
|
||||
function getCurrentActivity() {
|
||||
$.ajax({
|
||||
url: 'get_activity',
|
||||
|
@ -279,14 +285,15 @@
|
|||
header_count += ')';
|
||||
$('#currentActivityHeader').text(header_count);
|
||||
|
||||
sessions.forEach(function (s) {
|
||||
sessions.forEach(function (session) {
|
||||
var s = new Proxy(session, defaultHandler);
|
||||
var key = s.session_key;
|
||||
var session_id = s.session_id;
|
||||
var instance = $('#activity-instance-' + key);
|
||||
|
||||
// Create a new instance if it doesn't exist
|
||||
if (!(instance.length)) {
|
||||
getActivityInstance(s);
|
||||
getActivityInstance(session);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ class WebInterface(object):
|
|||
@requireAuth()
|
||||
def get_current_activity_instance(self, **kwargs):
|
||||
|
||||
return serve_template(templatename="current_activity_instance.html", data=kwargs)
|
||||
return serve_template(templatename="current_activity_instance.html", session=kwargs)
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue