Add "player" to tables

* Also rename user platforms to user players
* Fix other platform vs. player ambiguities
This commit is contained in:
Jonathan Wong 2015-09-29 22:43:23 -07:00
parent f1c4bf6249
commit 2616e14c83
15 changed files with 128 additions and 61 deletions

View file

@ -1565,19 +1565,19 @@ a:hover .item-children-poster {
top: 3px; top: 3px;
left: 3px; left: 3px;
} }
.user-platforms ul { .user-player ul {
list-style: none; list-style: none;
margin: 0; margin: 0;
} }
.user-platforms-instance { .user-player-instance {
float: left; float: left;
width: 240px; width: 240px;
height: 80px; height: 80px;
margin-bottom: 25px; margin-bottom: 25px;
} }
.user-platforms-instance li { .user-player-instance li {
} }
.user-platforms-instance-box { .user-player-instance-box {
float: left; float: left;
width: 75px; width: 75px;
border-radius: 3px; border-radius: 3px;
@ -1589,7 +1589,7 @@ a:hover .item-children-poster {
height: 80px; height: 80px;
width: 80px; width: 80px;
} }
.user-platforms-instance-name { .user-player-instance-name {
float: left; float: left;
padding-top: 14px; padding-top: 14px;
color: #fff; color: #fff;
@ -1602,7 +1602,7 @@ a:hover .item-children-poster {
width: 140px; width: 140px;
margin-left: 10px; margin-left: 10px;
} }
.user-platforms-instance-playcount h3 { .user-player-instance-playcount h3 {
font-size: 30px; font-size: 30px;
font-weight: bold; font-weight: bold;
color: #F9AA03; color: #F9AA03;
@ -1612,7 +1612,7 @@ a:hover .item-children-poster {
margin: 0 5px 0 10px; margin: 0 5px 0 10px;
float: left; float: left;
} }
.user-platforms-instance-playcount p { .user-player-instance-playcount p {
color: #aaa; color: #aaa;
font-size: 12px; font-size: 12px;
float: left; float: left;

View file

@ -30,6 +30,7 @@
<th align='left' id="friendly_name">User</th> <th align='left' id="friendly_name">User</th>
<th align='left' id="ip_address">IP Address</th> <th align='left' id="ip_address">IP Address</th>
<th align='left' id="platform">Platform</th> <th align='left' id="platform">Platform</th>
<th align='left' id="device">Player</th>
<th align='left' id="title">Title</th> <th align='left' id="title">Title</th>
<th align='left' id="started">Started</th> <th align='left' id="started">Started</th>
<th align='left' id="paused_counter">Paused</th> <th align='left' id="paused_counter">Paused</th>
@ -84,7 +85,7 @@
} }
} }
history_table = $('#history_table').DataTable(history_table_options); history_table = $('#history_table').DataTable(history_table_options);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 10] }); var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 11] });
$(colvis.button()).appendTo('div.colvis-button-bar'); $(colvis.button()).appendTo('div.colvis-button-bar');
clearSearchButton('history_table', history_table); clearSearchButton('history_table', history_table);

View file

@ -16,7 +16,7 @@
<th align='left' id="started">Started</th> <th align='left' id="started">Started</th>
<th align='left' id="stopped">Stopped</th> <th align='left' id="stopped">Stopped</th>
<th align='left' id="friendly_name">User</th> <th align='left' id="friendly_name">User</th>
<th align='left' id="platform">Platform</th> <th align='left' id="player">Player</th>
<th align='left' id="title">Title</th> <th align='left' id="title">Title</th>
</tr> </tr>
</thead> </thead>

View file

@ -333,6 +333,7 @@ DOCUMENTATION :: END
<th align='left' id="friendly_name">User</th> <th align='left' id="friendly_name">User</th>
<th align='left' id="ip_address">IP Address</th> <th align='left' id="ip_address">IP Address</th>
<th align='left' id="platform">Platform</th> <th align='left' id="platform">Platform</th>
<th align='left' id="player">Player</th>
<th align='left' id="title">Title</th> <th align='left' id="title">Title</th>
<th align='left' id="started">Started</th> <th align='left' id="started">Started</th>
<th align='left' id="paused_counter">Paused</th> <th align='left' id="paused_counter">Paused</th>
@ -550,7 +551,7 @@ DOCUMENTATION :: END
$(document).ready(function () { $(document).ready(function () {
get_history(); get_history();
history_table = $('#history_table').DataTable(history_table_options); history_table = $('#history_table').DataTable(history_table_options);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 10] }); var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 11] });
$(colvis.button()).appendTo('div.colvis-button-bar'); $(colvis.button()).appendTo('div.colvis-button-bar');
clearSearchButton('history_table', history_table); clearSearchButton('history_table', history_table);

View file

@ -100,6 +100,17 @@ history_table_options = {
}, },
{ {
"targets": [4], "targets": [4],
"data":"platform",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') {
$(td).html(cellData);
}
},
"width": "8%",
"className": "no-wrap hidden-md hidden-sm hidden-xs modal-control"
},
{
"targets": [5],
"data": "player", "data": "player",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') { if (cellData !== '') {
@ -114,11 +125,11 @@ history_table_options = {
$(td).html('<div><a href="#" data-target="#info-modal" data-toggle="modal"><div style="float: left;">' + transcode_dec + '&nbsp;' + cellData + '</div></a></div>'); $(td).html('<div><a href="#" data-target="#info-modal" data-toggle="modal"><div style="float: left;">' + transcode_dec + '&nbsp;' + cellData + '</div></a></div>');
} }
}, },
"width": "15%", "width": "12%",
"className": "no-wrap hidden-md hidden-sm hidden-xs modal-control" "className": "no-wrap hidden-md hidden-sm hidden-xs modal-control"
}, },
{ {
"targets": [5], "targets": [6],
"data":"full_title", "data":"full_title",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') { if (cellData !== '') {
@ -145,7 +156,7 @@ history_table_options = {
"width": "35%" "width": "35%"
}, },
{ {
"targets": [6], "targets": [7],
"data":"started", "data":"started",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData === null) { if (cellData === null) {
@ -159,7 +170,7 @@ history_table_options = {
"className": "no-wrap hidden-sm hidden-xs" "className": "no-wrap hidden-sm hidden-xs"
}, },
{ {
"targets": [7], "targets": [8],
"data":"paused_counter", "data":"paused_counter",
"render": function (data, type, full) { "render": function (data, type, full) {
if (data !== null) { if (data !== null) {
@ -173,7 +184,7 @@ history_table_options = {
"className": "no-wrap hidden-md hidden-sm hidden-xs" "className": "no-wrap hidden-md hidden-sm hidden-xs"
}, },
{ {
"targets": [8], "targets": [9],
"data":"stopped", "data":"stopped",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData === null) { if (cellData === null) {
@ -187,7 +198,7 @@ history_table_options = {
"className": "no-wrap hidden-sm hidden-xs" "className": "no-wrap hidden-sm hidden-xs"
}, },
{ {
"targets": [9], "targets": [10],
"data":"duration", "data":"duration",
"render": function (data, type, full) { "render": function (data, type, full) {
if (data !== null) { if (data !== null) {
@ -201,7 +212,7 @@ history_table_options = {
"className": "no-wrap hidden-xs" "className": "no-wrap hidden-xs"
}, },
{ {
"targets": [10], "targets": [11],
"data": "watched_status", "data": "watched_status",
"render": function (data, type, full) { "render": function (data, type, full) {
if (data == 1) { if (data == 1) {
@ -462,6 +473,7 @@ function childTableFormat(rowData) {
'<th align="left" id="friendly_name">User</th>' + '<th align="left" id="friendly_name">User</th>' +
'<th align="left" id="ip_address">IP Address</th>' + '<th align="left" id="ip_address">IP Address</th>' +
'<th align="left" id="platform">Platform</th>' + '<th align="left" id="platform">Platform</th>' +
'<th align="left" id="platform">Player</th>' +
'<th align="left" id="title">Title</th>' + '<th align="left" id="title">Title</th>' +
'<th align="left" id="started">Started</th>' + '<th align="left" id="started">Started</th>' +
'<th align="left" id="paused_counter">Paused</th>' + '<th align="left" id="paused_counter">Paused</th>' +

View file

@ -67,13 +67,13 @@ sync_table_options = {
}, },
{ {
"targets": [4], "targets": [4],
"data": "device_name", "data": "platform",
"className": "no-wrap hidden-xs" "className": "no-wrap hidden-sm hidden-xs"
}, },
{ {
"targets": [5], "targets": [5],
"data": "platform", "data": "device_name",
"className": "no-wrap hidden-sm hidden-xs" "className": "no-wrap hidden-xs"
}, },
{ {
"targets": [6], "targets": [6],

View file

@ -50,6 +50,17 @@ user_ip_table_options = {
{ {
"targets": [2], "targets": [2],
"data": "platform", "data": "platform",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') {
$(td).html(cellData);
}
},
"width": "15%",
"className": "no-wrap hidden-md hidden-sm hidden-xs modal-control"
},
{
"targets": [3],
"data":"player",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData) { if (cellData) {
var transcode_dec = ''; var transcode_dec = '';
@ -69,7 +80,7 @@ user_ip_table_options = {
"className": "no-wrap hidden-md hidden-sm hidden-xs modal-control" "className": "no-wrap hidden-md hidden-sm hidden-xs modal-control"
}, },
{ {
"targets": [3], "targets": [4],
"data":"last_watched", "data":"last_watched",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') { if (cellData !== '') {
@ -94,10 +105,11 @@ user_ip_table_options = {
} }
} }
}, },
"width": "30%",
"className": "hidden-sm hidden-xs" "className": "hidden-sm hidden-xs"
}, },
{ {
"targets": [4], "targets": [5],
"data":"play_count", "data":"play_count",
"searchable": false, "searchable": false,
"width": "10%" "width": "10%"

View file

@ -64,7 +64,7 @@ users_list_table_options = {
$(td).html(cellData); $(td).html(cellData);
} }
}, },
"width": "12%", "width": "10%",
"className": "edit-user-control no-wrap" "className": "edit-user-control no-wrap"
}, },
{ {
@ -78,7 +78,7 @@ users_list_table_options = {
} }
}, },
"searchable": false, "searchable": false,
"width": "12%", "width": "10%",
"className": "no-wrap hidden-xs" "className": "no-wrap hidden-xs"
}, },
{ {
@ -99,12 +99,25 @@ users_list_table_options = {
$(td).html('n/a'); $(td).html('n/a');
} }
}, },
"width": "12%", "width": "10%",
"className": "no-wrap hidden-md hidden-sm hidden-xs modal-control-ip" "className": "no-wrap hidden-md hidden-sm hidden-xs modal-control-ip"
}, },
{ {
"targets": [5], "targets": [5],
"data": "platform", "data": "platform",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') {
$(td).html(cellData);
} else {
$(td).html('n/a');
}
},
"width": "10%",
"className": "no-wrap hidden-md hidden-sm hidden-xs modal-control"
},
{
"targets": [6],
"data":"player",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData) { if (cellData) {
var transcode_dec = ''; var transcode_dec = '';
@ -120,11 +133,11 @@ users_list_table_options = {
$(td).html('n/a'); $(td).html('n/a');
} }
}, },
"width": "12%", "width": "15%",
"className": "no-wrap hidden-md hidden-sm hidden-xs modal-control" "className": "no-wrap hidden-md hidden-sm hidden-xs modal-control"
}, },
{ {
"targets": [6], "targets": [7],
"data":"last_watched", "data":"last_watched",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') { if (cellData !== '') {
@ -153,7 +166,7 @@ users_list_table_options = {
"className": "hidden-sm hidden-xs" "className": "hidden-sm hidden-xs"
}, },
{ {
"targets": [7], "targets": [8],
"data": "plays", "data": "plays",
"searchable": false, "searchable": false,
"width": "10%" "width": "10%"

View file

@ -29,8 +29,8 @@
<th align='left' id="username">Username</th> <th align='left' id="username">Username</th>
<th align='left' id="title">Title</th> <th align='left' id="title">Title</th>
<th align='left' id="type">Type</th> <th align='left' id="type">Type</th>
<th align='left' id="device">Device</th>
<th align='left' id="platform">Platform</th> <th align='left' id="platform">Platform</th>
<th align='left' id="device">Device</th>
<th align='left' id="size">Total Size</th> <th align='left' id="size">Total Size</th>
<th align='left' id="items">Total Items</th> <th align='left' id="items">Total Items</th>
<th align='left' id="converted">Converted</th> <th align='left' id="converted">Converted</th>

View file

@ -85,11 +85,11 @@ from plexpy import helpers
<div class="col-md-12"> <div class="col-md-12">
<div class="table-card-header"> <div class="table-card-header">
<div class="header-bar"> <div class="header-bar">
<span><i class="fa fa-television"></i> Platform Stats</span> <span><i class="fa fa-television"></i> Player Stats</span>
</div> </div>
</div> </div>
<div class="table-card-back"> <div class="table-card-back">
<div id="user-platform-stats" class="user-platforms"> <div id="user-player-stats" class="user-player">
<div class='muted'><i class="fa fa-refresh fa-spin"></i> Loading data...</div> <div class='muted'><i class="fa fa-refresh fa-spin"></i> Loading data...</div>
<br> <br>
</div> </div>
@ -133,6 +133,7 @@ from plexpy import helpers
<th align="left">Last Seen</th> <th align="left">Last Seen</th>
<th align="left">IP Address</th> <th align="left">IP Address</th>
<th align="left">Last Platform</th> <th align="left">Last Platform</th>
<th align="left">Last Player</th>
<th align="left">Last Watched</th> <th align="left">Last Watched</th>
<th align="left">Play Count</th> <th align="left">Play Count</th>
</tr> </tr>
@ -170,6 +171,7 @@ from plexpy import helpers
<th align='left' id="friendly_name">User</th> <th align='left' id="friendly_name">User</th>
<th align='left' id="ip_address">IP Address</th> <th align='left' id="ip_address">IP Address</th>
<th align='left' id="platform">Platform</th> <th align='left' id="platform">Platform</th>
<th align='left' id="player">Player</th>
<th align='left' id="title">Title</th> <th align='left' id="title">Title</th>
<th align='left' id="started">Started</th> <th align='left' id="started">Started</th>
<th align='left' id="paused_counter">Paused</th> <th align='left' id="paused_counter">Paused</th>
@ -207,8 +209,8 @@ from plexpy import helpers
<th align='left' id="username">Username</th> <th align='left' id="username">Username</th>
<th align='left' id="sync_title">Title</th> <th align='left' id="sync_title">Title</th>
<th align='left' id="type">Type</th> <th align='left' id="type">Type</th>
<th align='left' id="device">Device</th>
<th align='left' id="sync_platform">Platform</th> <th align='left' id="sync_platform">Platform</th>
<th align='left' id="device">Device</th>
<th align='left' id="size">Total Size</th> <th align='left' id="size">Total Size</th>
<th align='left' id="items">Total Items</th> <th align='left' id="items">Total Items</th>
<th align='left' id="converted">Converted</th> <th align='left' id="converted">Converted</th>
@ -309,11 +311,11 @@ from plexpy import helpers
// Populate platform stats // Populate platform stats
$.ajax({ $.ajax({
url: 'get_user_platform_stats', url: 'get_user_player_stats',
async: true, async: true,
data: { user_id: user_id, user: '${data['username']}' }, data: { user_id: user_id, user: '${data['username']}' },
complete: function(xhr, status) { complete: function(xhr, status) {
$("#user-platform-stats").html(xhr.responseText); $("#user-player-stats").html(xhr.responseText);
} }
}); });
@ -332,7 +334,7 @@ from plexpy import helpers
history_table = $('#history_table').DataTable(history_table_options); history_table = $('#history_table').DataTable(history_table_options);
history_table.column(2).visible(false); history_table.column(2).visible(false);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 10] }); var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 11] });
$(colvis.button()).appendTo('#button-bar-history'); $(colvis.button()).appendTo('#button-bar-history');
clearSearchButton('history_table', history_table); clearSearchButton('history_table', history_table);

View file

@ -11,8 +11,9 @@ data[array_index] :: Usable parameters
== Global keys == == Global keys ==
result_id Returns a unique identifier for the result. result_id Returns a unique identifier for the result.
platform_name Returns the name of the platform. player_name Returns the name of the player.
total_plays Returns the play count for the platform. platform_type Returns the name of the platform
total_plays Returns the play count for the player.
DOCUMENTATION :: END DOCUMENTATION :: END
</%doc> </%doc>
@ -20,13 +21,13 @@ DOCUMENTATION :: END
% if data != None: % if data != None:
% for a in data: % for a in data:
<ul class="list-unstyled"> <ul class="list-unstyled">
<div class="user-platforms-instance"> <div class="user-player-instance">
<li> <li>
<span id="user-platform-image-${a['result_id']}"></span> <span id="user-player-image-${a['result_id']}"></span>
<div class="user-platforms-instance-name"> <div class="user-player-instance-name">
${a['platform_name']} ${a['player_name']}
</div> </div>
<div class="user-platforms-instance-playcount"> <div class="user-player-instance-playcount">
<h3>${a['total_plays']}</h3> <h3>${a['total_plays']}</h3>
<p> plays</p> <p> plays</p>
</div> </div>
@ -34,7 +35,7 @@ DOCUMENTATION :: END
</div> </div>
</ul> </ul>
<script> <script>
$("#user-platform-image-${a['result_id']}").html("<div class='user-platforms-instance-box' style='background-image: url(" + getPlatformImagePath('${a['platform_type']}') + ");'>"); $("#user-player-image-${a['result_id']}").html("<div class='user-player-instance-box' style='background-image: url(" + getPlatformImagePath('${a['platform_type']}') + ");'>");
</script> </script>
% endfor % endfor
% else: % else:

View file

@ -29,6 +29,7 @@
<th align="left" id="last_seen">Last Seen</th> <th align="left" id="last_seen">Last Seen</th>
<th align="left" id="last_known_ip">Last Known IP</th> <th align="left" id="last_known_ip">Last Known IP</th>
<th align="left" id="last_platform">Last Platform</th> <th align="left" id="last_platform">Last Platform</th>
<th align="left" id="last_player">Last Player</th>
<th align="left" id="last_watched">Last Watched</th> <th align="left" id="last_watched">Last Watched</th>
<th align="left" id="total_plays">Total Plays</th> <th align="left" id="total_plays">Total Plays</th>
</tr> </tr>

View file

@ -42,6 +42,7 @@ class DataFactory(object):
'session_history.user_id', 'session_history.user_id',
'session_history.user', 'session_history.user',
'(CASE WHEN users.friendly_name IS NULL THEN user ELSE users.friendly_name END) as friendly_name', '(CASE WHEN users.friendly_name IS NULL THEN user ELSE users.friendly_name END) as friendly_name',
'platform',
'player', 'player',
'ip_address', 'ip_address',
'session_history_metadata.media_type', 'session_history_metadata.media_type',
@ -104,6 +105,12 @@ class DataFactory(object):
else: else:
watched_status = 0 watched_status = 0
# Rename Mystery platform names
platform_names = {'Mystery 3': 'Playstation 3',
'Mystery 4': 'Playstation 4',
'Mystery 5': 'Xbox 360'}
platform = platform_names.get(item["platform"], item["platform"])
row = {"reference_id": item["reference_id"], row = {"reference_id": item["reference_id"],
"id": item["id"], "id": item["id"],
"date": item["date"], "date": item["date"],
@ -114,6 +121,7 @@ class DataFactory(object):
"user_id": item["user_id"], "user_id": item["user_id"],
"user": item["user"], "user": item["user"],
"friendly_name": item["friendly_name"], "friendly_name": item["friendly_name"],
"platform": platform,
"player": item["player"], "player": item["player"],
"ip_address": item["ip_address"], "ip_address": item["ip_address"],
"media_type": item["media_type"], "media_type": item["media_type"],

View file

@ -32,7 +32,8 @@ class Users(object):
'MAX(session_history.started) as last_seen', 'MAX(session_history.started) as last_seen',
'session_history.ip_address as ip_address', 'session_history.ip_address as ip_address',
'COUNT(session_history.id) as plays', 'COUNT(session_history.id) as plays',
'session_history.player as platform', 'session_history.platform as platform',
'session_history.player as player',
'session_history_metadata.full_title as last_watched', 'session_history_metadata.full_title as last_watched',
'session_history_metadata.thumb', 'session_history_metadata.thumb',
'session_history_metadata.parent_thumb', 'session_history_metadata.parent_thumb',
@ -83,12 +84,19 @@ class Users(object):
else: else:
user_thumb = item['user_thumb'] user_thumb = item['user_thumb']
# Rename Mystery platform names
platform_names = {'Mystery 3': 'Playstation 3',
'Mystery 4': 'Playstation 4',
'Mystery 5': 'Xbox 360'}
platform = platform_names.get(item["platform"], item["platform"])
row = {"id": item['id'], row = {"id": item['id'],
"plays": item['plays'], "plays": item['plays'],
"last_seen": item['last_seen'], "last_seen": item['last_seen'],
"friendly_name": item['friendly_name'], "friendly_name": item['friendly_name'],
"ip_address": item['ip_address'], "ip_address": item['ip_address'],
"platform": item['platform'], "platform": platform,
"player": item['player'],
"last_watched": item['last_watched'], "last_watched": item['last_watched'],
"thumb": thumb, "thumb": thumb,
"media_type": item['media_type'], "media_type": item['media_type'],
@ -121,7 +129,8 @@ class Users(object):
'session_history.started as last_seen', 'session_history.started as last_seen',
'session_history.ip_address as ip_address', 'session_history.ip_address as ip_address',
'COUNT(session_history.id) as play_count', 'COUNT(session_history.id) as play_count',
'session_history.player as platform', 'session_history.platform as platform',
'session_history.player as player',
'session_history_metadata.full_title as last_watched', 'session_history_metadata.full_title as last_watched',
'session_history_metadata.thumb', 'session_history_metadata.thumb',
'session_history_metadata.parent_thumb', 'session_history_metadata.parent_thumb',
@ -169,11 +178,18 @@ class Users(object):
else: else:
thumb = item["thumb"] thumb = item["thumb"]
# Rename Mystery platform names
platform_names = {'Mystery 3': 'Playstation 3',
'Mystery 4': 'Playstation 4',
'Mystery 5': 'Xbox 360'}
platform = platform_names.get(item["platform"], item["platform"])
row = {"id": item['id'], row = {"id": item['id'],
"last_seen": item['last_seen'], "last_seen": item['last_seen'],
"ip_address": item['ip_address'], "ip_address": item['ip_address'],
"play_count": item['play_count'], "play_count": item['play_count'],
"platform": item['platform'], "platform": platform,
"player": item['player'],
"last_watched": item['last_watched'], "last_watched": item['last_watched'],
"thumb": thumb, "thumb": thumb,
"media_type": item['media_type'], "media_type": item['media_type'],
@ -490,10 +506,10 @@ class Users(object):
return user_watch_time_stats return user_watch_time_stats
def get_user_platform_stats(self, user=None, user_id=None): def get_user_player_stats(self, user=None, user_id=None):
monitor_db = database.MonitorDatabase() monitor_db = database.MonitorDatabase()
platform_stats = [] player_stats = []
result_id = 0 result_id = 0
try: try:
@ -522,12 +538,12 @@ class Users(object):
'Mystery 5': 'Xbox 360'} 'Mystery 5': 'Xbox 360'}
platform_type = platform_names.get(item[2], item[2]) platform_type = platform_names.get(item[2], item[2])
row = {'platform_name': item[0], row = {'player_name': item[0],
'platform_type': platform_type, 'platform_type': platform_type,
'total_plays': item[1], 'total_plays': item[1],
'result_id': result_id 'result_id': result_id
} }
platform_stats.append(row) player_stats.append(row)
result_id += 1 result_id += 1
return platform_stats return player_stats

View file

@ -813,17 +813,17 @@ class WebInterface(object):
return serve_template(templatename="user_watch_time_stats.html", data=None, title="Watch Stats") return serve_template(templatename="user_watch_time_stats.html", data=None, title="Watch Stats")
@cherrypy.expose @cherrypy.expose
def get_user_platform_stats(self, user=None, user_id=None, **kwargs): def get_user_player_stats(self, user=None, user_id=None, **kwargs):
user_data = users.Users() user_data = users.Users()
result = user_data.get_user_platform_stats(user_id=user_id, user=user) result = user_data.get_user_player_stats(user_id=user_id, user=user)
if result: if result:
return serve_template(templatename="user_platform_stats.html", data=result, return serve_template(templatename="user_player_stats.html", data=result,
title="Platform Stats") title="Player Stats")
else: else:
logger.warn('Unable to retrieve data.') logger.warn('Unable to retrieve data.')
return serve_template(templatename="user_platform_stats.html", data=None, title="Platform Stats") return serve_template(templatename="user_player_stats.html", data=None, title="Player Stats")
@cherrypy.expose @cherrypy.expose
def get_item_children(self, rating_key='', **kwargs): def get_item_children(self, rating_key='', **kwargs):