mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-13 18:16:57 -07:00
using new API call for getting library media stats
This commit is contained in:
parent
7bc94cd95d
commit
8c1248ed1b
2 changed files with 19 additions and 10 deletions
|
@ -279,16 +279,14 @@ DOCUMENTATION :: END
|
||||||
</strong>
|
</strong>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
% if config['get_file_sizes'] and not data['section_id'] in config['get_file_sizes_hold']['section_ids']:
|
|
||||||
<div class="info-bar">
|
<div class="info-bar">
|
||||||
<div class="info-element">
|
<div class="info-element">
|
||||||
<span>Total File Size: <strong><span id="info-element-total-file-size" /></strong></span>
|
<span>Total File Size: <strong><span id="info-element-total-storage" /></strong></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-element">
|
<div class="info-element">
|
||||||
<span>Total Media Runtime: <strong><span id="info-element-total-media-runtime" /></strong></span>
|
<span>Total Media Runtime: <strong><span id="info-element-total-runtime" /></strong></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
% endif
|
|
||||||
<div class="button-bar">
|
<div class="button-bar">
|
||||||
% if _session['user_group'] == 'admin':
|
% if _session['user_group'] == 'admin':
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
@ -852,10 +850,6 @@ DOCUMENTATION :: END
|
||||||
section_id: section_id,
|
section_id: section_id,
|
||||||
refresh: refresh_table
|
refresh: refresh_table
|
||||||
};
|
};
|
||||||
},
|
|
||||||
complete: function(xhr, status) {
|
|
||||||
$("#info-element-total-media-runtime").html(humanDuration(xhr.responseJSON.total_media_duration));
|
|
||||||
$("#info-element-total-file-size").html(humanFileSize(xhr.responseJSON.total_file_size));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
media_info_table = $('#media_info_table-SID-${data["section_id"]}').DataTable(media_info_table_options);
|
media_info_table = $('#media_info_table-SID-${data["section_id"]}').DataTable(media_info_table_options);
|
||||||
|
@ -866,6 +860,18 @@ DOCUMENTATION :: END
|
||||||
clearSearchButton('media_info_table-SID-${data["section_id"]}', media_info_table);
|
clearSearchButton('media_info_table-SID-${data["section_id"]}', media_info_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
// Populate media stats
|
||||||
|
$.ajax({
|
||||||
|
url: 'get_library_media_stats',
|
||||||
|
data: { section_id: section_id },
|
||||||
|
complete: function(xhr, status) {
|
||||||
|
$("#info-element-total-runtime").html(humanDuration(xhr.responseJSON.total_duration));
|
||||||
|
$("#info-element-total-storage").html(humanFileSize(xhr.responseJSON.total_storage));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('#nav-tabs-mediainfo').on('shown.bs.tab', function() {
|
$('#nav-tabs-mediainfo').on('shown.bs.tab', function() {
|
||||||
if (typeof(media_info_table) === 'undefined') {
|
if (typeof(media_info_table) === 'undefined') {
|
||||||
loadMediaInfoTable();
|
loadMediaInfoTable();
|
||||||
|
|
|
@ -701,6 +701,7 @@ class WebInterface(object):
|
||||||
return "Failed to update library."
|
return "Failed to update library."
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_library_media_stats(self, section_id=None):
|
def get_library_media_stats(self, section_id=None):
|
||||||
|
@ -723,8 +724,10 @@ class WebInterface(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger.info("Getting library media stats for section %s.", section_id)
|
logger.info("Getting library media stats for section %s.", section_id)
|
||||||
|
result = libraries.get_library_media_stats(section_id)
|
||||||
return libraries.get_library_media_stats(section_id)
|
logger.debug("test")
|
||||||
|
logger.debug(result)
|
||||||
|
return result
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue