Checking for activity...
@@ -238,6 +246,8 @@
var create_instances = [];
var activity_ready = true;
+ $('#currentActivityHeader-bandwidth-tooltip').tooltip({ container: 'body', placement: 'right', delay: 50 });
+
function getCurrentActivity() {
activity_ready = false;
@@ -266,7 +276,7 @@
% else:
var msg_settings = ''
% endif
- $('#currentActivityHeader').text('');
+ $('#currentActivityHeader').hide();
$('#currentActivity').html('
There was an error communicating with your Plex Server.' + msg_settings + '
');
return
}
@@ -280,20 +290,25 @@
// Update the header stream counts
var sc_dp = current_activity.stream_count_direct_play,
sc_ds = current_activity.stream_count_direct_stream,
- sc_tc = current_activity.stream_count_transcode;
- var header_count = stream_count + ' stream' + (stream_count > 1 ? 's' : '') + ' (';
+ sc_tc = current_activity.stream_count_transcode,
+ total_bw = current_activity.total_bandwidth;
+ var streams_header = stream_count + ' stream' + (stream_count > 1 ? 's' : '') + ' (';
if (sc_dp) {
- header_count += sc_dp + ' direct play' + (sc_dp > 1 ? 's' : '') + ', ';
+ streams_header += sc_dp + ' direct play' + (sc_dp > 1 ? 's' : '') + ', ';
}
if (sc_ds) {
- header_count += sc_ds + ' direct stream' + (sc_ds > 1 ? 's' : '') + ', ';
+ streams_header += sc_ds + ' direct stream' + (sc_ds > 1 ? 's' : '') + ', ';
}
if (sc_tc) {
- header_count += sc_tc + ' transcode' + (sc_tc > 1 ? 's' : '') + ', ';
+ streams_header += sc_tc + ' transcode' + (sc_tc > 1 ? 's' : '') + ', ';
}
- header_count = header_count.replace(/, $/, '');
- header_count += ')';
- $('#currentActivityHeader').text(header_count);
+ streams_header = streams_header.replace(/, $/, '') + ')';
+ $('#currentActivityHeader-streams').text(streams_header);
+
+ var bandwidth_header = (total_bw > 1000) ? ((total_bw / 1000).toFixed(1) + ' Mbps') : (total_bw + ' kbps');
+ $('#currentActivityHeader-bandwidth').text(bandwidth_header);
+
+ $('#currentActivityHeader').show();
sessions.forEach(function (session) {
var s = new Proxy(session, defaultHandler);
@@ -504,7 +519,7 @@
});
} else {
- $('#currentActivityHeader').text('');
+ $('#currentActivityHeader').hide();
$('#currentActivity').html('
Nothing is currently being played.
');
}
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index 21dddd66..aac67777 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -4434,7 +4434,8 @@ class WebInterface(object):
counts = {'stream_count_direct_play': 0,
'stream_count_direct_stream': 0,
- 'stream_count_transcode': 0}
+ 'stream_count_transcode': 0,
+ 'total_bandwidth': 0}
for s in result['sessions']:
if s['transcode_decision'] == 'transcode':
@@ -4444,6 +4445,8 @@ class WebInterface(object):
else:
counts['stream_count_direct_play'] += 1
+ counts['total_bandwidth'] += helpers.cast_to_int(s['bandwidth'])
+
result.update(counts)
return result