Combine activity header into one activity function

This commit is contained in:
JonnyWong16 2017-11-05 11:06:51 -08:00
parent e80d88c9ff
commit 99f93a8d50
3 changed files with 43 additions and 22 deletions

View file

@ -4424,6 +4424,21 @@ class WebInterface(object):
if session_key:
return next((s for s in result['sessions'] if s['session_key'] == session_key), {})
counts = {'stream_count_direct_play': 0,
'stream_count_direct_stream': 0,
'stream_count_transcode': 0}
for s in result['sessions']:
if s['transcode_decision'] == 'transcode':
counts['stream_count_transcode'] += 1
elif s['transcode_decision'] == 'copy':
counts['stream_count_direct_stream'] += 1
else:
counts['stream_count_direct_play'] += 1
result.update(counts)
return result
else:
logger.warn(u"Unable to retrieve data for get_activity.")