Rename server statistics to library statistics

This commit is contained in:
Jonathan Wong 2015-08-30 11:01:52 -07:00
parent d44bd2f35b
commit 389ce97d03
5 changed files with 24 additions and 25 deletions

View file

@ -1665,7 +1665,7 @@ 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); -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); 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 { .home-platforms-instance-poster .home-platforms-library-thumb {
background-position: center; background-position: center;
background-size: cover; background-size: cover;
height: 80px; height: 80px;

View file

@ -29,10 +29,10 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="padded-header" id="server-statistics-header"> <div class="padded-header" id="library-statistics-header">
<h3>Server Statistics</h3> <h3>Library Statistics</h3>
</div> </div>
<div id="server-stats" class="server-platforms"> <div id="library-stats" class="library-platforms">
<div class='text-muted'><i class="fa fa-refresh fa-spin"></i> Loading stats...</div> <div class='text-muted'><i class="fa fa-refresh fa-spin"></i> Loading stats...</div>
<br> <br>
</div> </div>
@ -94,7 +94,7 @@
}); });
} }
function getServerStatsHeader() { function getLibraryStatsHeader() {
$.ajax({ $.ajax({
"url": "get_servers_info", "url": "get_servers_info",
type: "post", type: "post",
@ -110,19 +110,19 @@
break; break;
} }
} }
$('#server-statistics-header h3').append(' <small>' + server_name + '</small>') $('#library-statistics-header h3').append(' <small>' + server_name + '</small>')
} }
}); });
} }
function getServerStats() { function getLibraryStats() {
$.ajax({ $.ajax({
url: 'server_stats', url: 'library_stats',
cache: false, cache: false,
async: true, async: true,
data: { }, data: { },
complete: function(xhr, status) { complete: function(xhr, status) {
$("#server-stats").html(xhr.responseText); $("#library-stats").html(xhr.responseText);
} }
}); });
} }
@ -166,8 +166,8 @@
}); });
getHomeStats(${config['home_stats_length']}, ${config['home_stats_type']}, ${config['home_stats_count']}); getHomeStats(${config['home_stats_length']}, ${config['home_stats_type']}, ${config['home_stats_count']});
getServerStatsHeader(); getLibraryStatsHeader();
getServerStats(); getLibraryStats();
</script> </script>

View file

@ -3,7 +3,7 @@ USAGE DOCUMENTATION :: PLEASE LEAVE THIS AT THE TOP OF THIS FILE
For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/ For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/
Filename: server_stats.html Filename: library_stats.html
Version: 0.1 Version: 0.1
Variable names: data [array] Variable names: data [array]
@ -61,11 +61,11 @@ DOCUMENTATION :: END
</div> </div>
% if library['rows']['thumb']: % if library['rows']['thumb']:
<div class="home-platforms-instance-poster"> <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 class="home-platforms-library-thumb" style="background-image: url(pms_image_proxy?img=${library['rows']['thumb']}&width=300&height=300&fallback=poster);"></div>
</div> </div>
% else: % else:
<div class="home-platforms-instance-poster"> <div class="home-platforms-instance-poster">
<div class="home-platforms-server-thumb" style="background-image: url(interfaces/default/images/poster.png);"></div> <div class="home-platforms-library-thumb" style="background-image: url(interfaces/default/images/poster.png);"></div>
</div> </div>
% endif % endif
</li> </li>

View file

@ -1121,11 +1121,10 @@ class PmsConnect(object):
Output: array Output: array
""" """
def get_server_stats(self): def get_library_stats(self):
server_info = self.get_servers_info()
server_libraries = self.get_server_children() server_libraries = self.get_server_children()
server_stats = [] server_library_stats = []
if server_libraries['libraries_count'] != '0': if server_libraries['libraries_count'] != '0':
libraries_list = server_libraries['libraries_list'] libraries_list = server_libraries['libraries_list']
@ -1152,14 +1151,14 @@ class PmsConnect(object):
if library_type == 'artist': if library_type == 'artist':
album_list = self.get_library_children(library_type='album', section_key=section_key) album_list = self.get_library_children(library_type='album', section_key=section_key)
album_stats = {'album_count': album_list['library_count'], album_stats = {'album_count': album_list['library_count'],
'album_count_type': 'All Albums' 'album_count_type': 'All Albums'
} }
library_stats.update(album_stats) library_stats.update(album_stats)
server_stats.append({'type': library_type, server_library_stats.append({'type': library_type,
'rows': library_stats}) 'rows': library_stats})
return server_stats return server_library_stats
""" """
Return image data as array. Return image data as array.

View file

@ -128,11 +128,11 @@ class WebInterface(object):
return serve_template(templatename="home_stats.html", title="Stats", data=stats_data) return serve_template(templatename="home_stats.html", title="Stats", data=stats_data)
@cherrypy.expose @cherrypy.expose
def server_stats(self, **kwargs): def library_stats(self, **kwargs):
pms_connect = pmsconnect.PmsConnect() pms_connect = pmsconnect.PmsConnect()
stats_data = pms_connect.get_server_stats() stats_data = pms_connect.get_library_stats()
return serve_template(templatename="server_stats.html", title="Server Stats", data=stats_data) return serve_template(templatename="library_stats.html", title="Library Stats", data=stats_data)
@cherrypy.expose @cherrypy.expose
def history(self): def history(self):