Add transcode progress and speed to dashboard activity

This commit is contained in:
Jonathan Wong 2015-09-06 21:10:47 -07:00
parent 56f601e2a5
commit 56b717b1a1
3 changed files with 33 additions and 2 deletions

View file

@ -683,6 +683,13 @@ a:hover .dashboard-activity-poster {
-webkit-transition: all 0s; -webkit-transition: all 0s;
transition: all 0s; transition: all 0s;
} }
.dashboard-activity-progress .bufferbar {
padding-top: 6px;
background-color: #444;
position: absolute;
height: 6px;
overflow: hidden;
}
.dashboard-activity-progress .bar { .dashboard-activity-progress .bar {
padding-top: 6px; padding-top: 6px;
background-color: #faa732; background-color: #faa732;
@ -693,6 +700,9 @@ a:hover .dashboard-activity-poster {
background-image: linear-gradient(to bottom, #fbb450, #f89406); background-image: linear-gradient(to bottom, #fbb450, #f89406);
background-repeat: repeat-x; background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);
position: absolute;
height: 6px;
overflow: hidden;
} }
.dashboard-activity-metadata-wrapper { .dashboard-activity-metadata-wrapper {
position: relative; position: relative;

View file

@ -117,7 +117,8 @@ DOCUMENTATION :: END
Stream &nbsp;<strong>Direct Play</strong> Stream &nbsp;<strong>Direct Play</strong>
% else: % else:
Stream &nbsp;<strong>Transcoding Stream &nbsp;<strong>Transcoding
% if a['throttled'] == 1: (Speed: ${a['transcode_speed']})
% if a['throttled'] == '1':
(Throttled) (Throttled)
% endif % endif
</strong> </strong>
@ -135,7 +136,8 @@ DOCUMENTATION :: END
Stream &nbsp;<strong>Direct Play</strong> Stream &nbsp;<strong>Direct Play</strong>
% else: % else:
Stream &nbsp;<strong>Transcoding Stream &nbsp;<strong>Transcoding
% if a['throttled']: (Speed: ${a['transcode_speed']})
% if a['throttled'] == '1':
(Throttled) (Throttled)
% endif % endif
</strong> </strong>
@ -171,6 +173,7 @@ DOCUMENTATION :: END
% endif % endif
<div class="dashboard-activity-progress"> <div class="dashboard-activity-progress">
<div class="dashboard-activity-progress-bar"> <div class="dashboard-activity-progress-bar">
<div class="bufferbar" style="width: ${a['transcode_progress']}%">${a['transcode_progress']}%</div>
<div class="bar" style="width: ${a['progress_percent']}%">${a['progress_percent']}%</div> <div class="bar" style="width: ${a['progress_percent']}%">${a['progress_percent']}%</div>
</div> </div>
</div> </div>

View file

@ -579,6 +579,8 @@ class PmsConnect(object):
if session.getElementsByTagName('TranscodeSession'): if session.getElementsByTagName('TranscodeSession'):
transcode_session = session.getElementsByTagName('TranscodeSession')[0] transcode_session = session.getElementsByTagName('TranscodeSession')[0]
throttled = helpers.get_xml_attr(transcode_session, 'throttled') throttled = helpers.get_xml_attr(transcode_session, 'throttled')
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
audio_decision = helpers.get_xml_attr(transcode_session, 'audioDecision') audio_decision = helpers.get_xml_attr(transcode_session, 'audioDecision')
transcode_audio_channels = helpers.get_xml_attr(transcode_session, 'audioChannels') transcode_audio_channels = helpers.get_xml_attr(transcode_session, 'audioChannels')
transcode_audio_codec = helpers.get_xml_attr(transcode_session, 'audioCodec') transcode_audio_codec = helpers.get_xml_attr(transcode_session, 'audioCodec')
@ -586,6 +588,9 @@ class PmsConnect(object):
transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol') transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol')
duration = helpers.get_xml_attr(transcode_session, 'duration') duration = helpers.get_xml_attr(transcode_session, 'duration')
else: else:
throttled = '0'
transcode_progress = '0'
transcode_speed = ''
transcode_audio_channels = '' transcode_audio_channels = ''
transcode_audio_codec = '' transcode_audio_codec = ''
transcode_container = '' transcode_container = ''
@ -622,6 +627,8 @@ class PmsConnect(object):
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'), 'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'), 'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
'throttled': throttled, 'throttled': throttled,
'transcode_progress': transcode_progress,
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
'audio_decision': audio_decision, 'audio_decision': audio_decision,
'audio_channels': audio_channels, 'audio_channels': audio_channels,
'audio_codec': audio_codec, 'audio_codec': audio_codec,
@ -667,6 +674,8 @@ class PmsConnect(object):
if session.getElementsByTagName('TranscodeSession'): if session.getElementsByTagName('TranscodeSession'):
transcode_session = session.getElementsByTagName('TranscodeSession')[0] transcode_session = session.getElementsByTagName('TranscodeSession')[0]
throttled = helpers.get_xml_attr(transcode_session, 'throttled') throttled = helpers.get_xml_attr(transcode_session, 'throttled')
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
audio_decision = helpers.get_xml_attr(transcode_session, 'audioDecision') audio_decision = helpers.get_xml_attr(transcode_session, 'audioDecision')
transcode_audio_channels = helpers.get_xml_attr(transcode_session, 'audioChannels') transcode_audio_channels = helpers.get_xml_attr(transcode_session, 'audioChannels')
transcode_audio_codec = helpers.get_xml_attr(transcode_session, 'audioCodec') transcode_audio_codec = helpers.get_xml_attr(transcode_session, 'audioCodec')
@ -677,6 +686,9 @@ class PmsConnect(object):
transcode_container = helpers.get_xml_attr(transcode_session, 'container') transcode_container = helpers.get_xml_attr(transcode_session, 'container')
transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol') transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol')
else: else:
throttled = '0'
transcode_progress = '0'
transcode_speed = ''
transcode_audio_channels = '' transcode_audio_channels = ''
transcode_audio_codec = '' transcode_audio_codec = ''
transcode_video_codec = '' transcode_video_codec = ''
@ -735,6 +747,8 @@ class PmsConnect(object):
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'), 'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'), 'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
'throttled': throttled, 'throttled': throttled,
'transcode_progress': transcode_progress,
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
'audio_decision': audio_decision, 'audio_decision': audio_decision,
'audio_channels': audio_channels, 'audio_channels': audio_channels,
'audio_codec': audio_codec, 'audio_codec': audio_codec,
@ -789,6 +803,8 @@ class PmsConnect(object):
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'), 'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'), 'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
'throttled': throttled, 'throttled': throttled,
'transcode_progress': transcode_progress,
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
'audio_decision': audio_decision, 'audio_decision': audio_decision,
'audio_channels': audio_channels, 'audio_channels': audio_channels,
'audio_codec': audio_codec, 'audio_codec': audio_codec,
@ -843,6 +859,8 @@ class PmsConnect(object):
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'), 'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'), 'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
'throttled': throttled, 'throttled': throttled,
'transcode_progress': transcode_progress,
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
'audio_decision': audio_decision, 'audio_decision': audio_decision,
'audio_channels': audio_channels, 'audio_channels': audio_channels,
'audio_codec': audio_codec, 'audio_codec': audio_codec,