mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Initial implementation of server statistics
This commit is contained in:
parent
8138c27242
commit
3436175223
5 changed files with 348 additions and 11 deletions
|
@ -1572,6 +1572,30 @@ a .season-episodes-card-overlay:hover {
|
|||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.home-platforms-instance-name2 {
|
||||
position: absolute;
|
||||
top: 34px;
|
||||
left: 210px;
|
||||
}
|
||||
.home-platforms-instance-name2 h5 {
|
||||
font-size: 14px;
|
||||
line-height: 16px;
|
||||
margin: 15px 0 2px 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.home-platforms-instance-name2 h3 {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
color: #F9AA03;
|
||||
line-height: 22px;
|
||||
position: relative;
|
||||
top: 5px;
|
||||
margin: 0 5px 0 0;
|
||||
padding-top: 6px;
|
||||
float: left;
|
||||
}
|
||||
.home-platforms-instance-playcount {
|
||||
float: left;
|
||||
position: relative;
|
||||
|
@ -1633,6 +1657,13 @@ a .season-episodes-card-overlay:hover {
|
|||
-moz-box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1);
|
||||
box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1);
|
||||
}
|
||||
.home-platforms-instance-poster .home-platforms-server-thumb {
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
height: 80px;
|
||||
width: 80px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.home-platforms-instance-box {
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="padded-header">
|
||||
<h3>Statistics <small>Last ${config['home_stats_length']} days</small></h3>
|
||||
<h3>Watch Statistics <small>Last ${config['home_stats_length']} days</small></h3>
|
||||
</div>
|
||||
<div id="home-stats" class="home-platforms">
|
||||
<div class='text-muted'><i class="fa fa-refresh fa-spin"></i> Loading stats...</div>
|
||||
|
@ -27,6 +27,17 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="padded-header" id="server-statistics-header">
|
||||
<h3>Server Statistics</h3>
|
||||
</div>
|
||||
<div id="server-stats" class="server-platforms">
|
||||
<div class='text-muted'><i class="fa fa-refresh fa-spin"></i> Loading stats...</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class="col-md-12">
|
||||
<div class="padded-header">
|
||||
|
@ -45,17 +56,18 @@
|
|||
<script src="interfaces/default/js/moment-with-locale.js"></script>
|
||||
<script>
|
||||
|
||||
function getHomeStats(days, stat_type, stat_count) {
|
||||
function currentActivityHeader() {
|
||||
$.ajax({
|
||||
url: 'home_stats',
|
||||
url: 'get_current_activity_header',
|
||||
cache: false,
|
||||
async: true,
|
||||
data: {time_range: days, stat_type: stat_type, stat_count: stat_count},
|
||||
complete: function(xhr, status) {
|
||||
$("#home-stats").html(xhr.responseText);
|
||||
$("#current-activity-header").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
currentActivityHeader();
|
||||
setInterval(currentActivityHeader, 15000);
|
||||
|
||||
function currentActivity() {
|
||||
$.ajax({
|
||||
|
@ -70,18 +82,50 @@
|
|||
currentActivity();
|
||||
setInterval(currentActivity, 15000);
|
||||
|
||||
function currentActivityHeader() {
|
||||
function getHomeStats(days, stat_type, stat_count) {
|
||||
$.ajax({
|
||||
url: 'get_current_activity_header',
|
||||
url: 'home_stats',
|
||||
cache: false,
|
||||
async: true,
|
||||
data: {time_range: days, stat_type: stat_type, stat_count: stat_count},
|
||||
complete: function(xhr, status) {
|
||||
$("#current-activity-header").html(xhr.responseText);
|
||||
$("#home-stats").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getServerStatsHeader() {
|
||||
$.ajax({
|
||||
"url": "get_servers_info",
|
||||
type: "post",
|
||||
cache: false,
|
||||
async: true,
|
||||
data: { },
|
||||
complete: function (xhr, status) {
|
||||
server_info = $.parseJSON(xhr.responseText);
|
||||
var server_name = 'Server name not found';
|
||||
for (var i in server_info) {
|
||||
if (server_info[i].machine_identifier == '${config['pms_identifier']}') {
|
||||
server_name = server_info[i].name
|
||||
break;
|
||||
}
|
||||
}
|
||||
$('#server-statistics-header h3').append(' <small>' + server_name + '</small>')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getServerStats() {
|
||||
$.ajax({
|
||||
url: 'server_stats',
|
||||
cache: false,
|
||||
async: true,
|
||||
data: { },
|
||||
complete: function(xhr, status) {
|
||||
$("#server-stats").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
currentActivityHeader();
|
||||
setInterval(currentActivityHeader, 15000);
|
||||
|
||||
function recentlyAdded() {
|
||||
var widthVal = $('body').find(".container-fluid").width();
|
||||
|
@ -122,6 +166,8 @@
|
|||
});
|
||||
|
||||
getHomeStats(${config['home_stats_length']}, ${config['home_stats_type']}, ${config['home_stats_count']});
|
||||
getServerStatsHeader();
|
||||
getServerStats();
|
||||
|
||||
|
||||
</script>
|
||||
|
|
75
data/interfaces/default/server_stats.html
Normal file
75
data/interfaces/default/server_stats.html
Normal file
|
@ -0,0 +1,75 @@
|
|||
<%doc>
|
||||
USAGE DOCUMENTATION :: PLEASE LEAVE THIS AT THE TOP OF THIS FILE
|
||||
|
||||
For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/
|
||||
|
||||
Filename: server_stats.html
|
||||
Version: 0.1
|
||||
Variable names: data [array]
|
||||
|
||||
data[array_index] :: Usable parameters
|
||||
|
||||
data['type'] Returns the type of the library. Either 'movie', 'show', 'photo', or 'artist'.
|
||||
data['rows'] Returns an array containing stat data
|
||||
|
||||
data[array_index]['rows'] :: Usable parameters
|
||||
|
||||
title Returns the title of the library.
|
||||
thumb Returns the thumb of the library.
|
||||
count Returns the number of items in the library.
|
||||
count_type Returns the sorting type for the library
|
||||
|
||||
== Only if 'type' is 'show'
|
||||
episode_count Return the number of episodes in the library.
|
||||
episode_count_type Return the sorting type for the episodes.
|
||||
|
||||
== Only if 'type' is 'artist'
|
||||
album_count Return the number of episodes in the library.
|
||||
album_count_type Return the sorting type for the episodes.
|
||||
|
||||
DOCUMENTATION :: END
|
||||
</%doc>
|
||||
|
||||
% if data:
|
||||
<ul class="list-unstyled">
|
||||
% for library in data:
|
||||
<div class="home-platforms-instance">
|
||||
<li>
|
||||
<div class="home-platforms-instance-info">
|
||||
<div class="home-platforms-instance-name">
|
||||
<h4>${library['rows']['title']}</h4>
|
||||
<h5>${library['rows']['count_type']}</h5>
|
||||
</div>
|
||||
<div class="home-platforms-instance-playcount">
|
||||
<h3>${library['rows']['count']}</h3>
|
||||
</div>
|
||||
% if library['type'] == 'show':
|
||||
<div class="home-platforms-instance-name2">
|
||||
<h5>${library['rows']['episode_count_type']}</h5>
|
||||
<h3>${library['rows']['episode_count']}</h3>
|
||||
</div>
|
||||
% endif
|
||||
% if library['type'] == 'artist':
|
||||
<div class="home-platforms-instance-name2">
|
||||
<h5>${library['rows']['album_count_type']}</h5>
|
||||
<h3>${library['rows']['album_count']}</h3>
|
||||
</div>
|
||||
% endif
|
||||
</div>
|
||||
% if library['rows']['thumb']:
|
||||
<div class="home-platforms-instance-poster">
|
||||
<div class="home-platforms-server-thumb" style="background-image: url(pms_image_proxy?img=${library['rows']['thumb']}&width=300&height=300&fallback=poster);"></div>
|
||||
</div>
|
||||
% else:
|
||||
<div class="home-platforms-instance-poster">
|
||||
<div class="home-platforms-server-thumb" style="background-image: url(interfaces/default/images/poster.png);"></div>
|
||||
</div>
|
||||
% endif
|
||||
</li>
|
||||
</div>
|
||||
% endfor
|
||||
</ul>
|
||||
% else:
|
||||
<div class="text-muted">Unable to retrieve data from database. Please check your <a href="settings">settings</a>.
|
||||
</div><br>
|
||||
% endif
|
Loading…
Add table
Add a link
Reference in a new issue