Update stream info modal

This commit is contained in:
JonnyWong16 2017-12-22 22:04:40 -08:00
parent 19695c220b
commit 0a42cb4135
3 changed files with 218 additions and 98 deletions

View file

@ -428,7 +428,7 @@ DOCUMENTATION :: END
</%def>
<%def name="modalIncludes()">
<div id="info-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="info-modal">
<div class="modal fade" id="info-modal" tabindex="-1" role="dialog" aria-labelledby="info-modal">
</div>
<div class="modal fade" id="ip-info-modal" tabindex="-1" role="dialog" aria-labelledby="ip-info-modal">
</div>

View file

@ -38,6 +38,9 @@ DOCUMENTATION :: END
</%doc>
% if data:
<%
import plexpy
%>
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@ -51,86 +54,177 @@ DOCUMENTATION :: END
</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<h4><strong>Stream Details</strong></h4>
</div>
<div class="col-sm-4">
<h5>Media</h5>
<ul class="list-unstyled">
<li>Container: <strong>${data['transcode_container'] if data['transcode_container'] else data['container']}</strong></li>
% if data['media_type'] != 'track':
<li>Resolution: <strong>${data['transcode_height'] if data['transcode_height'] else data['height']}p</strong></li>
% endif
</ul>
</div>
<table class="stream-info" style="margin-top: 0;">
<thead>
<tr>
<th>
</th>
<th class="heading">
Stream Details
</th>
<th class="heading">
Source Details
</th>
</tr>
</thead>
</table>
<table class="stream-info">
<thead>
<tr>
<th>
Media
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Bitrate</td>
<td>${data['stream_bitrate']} kbps</td>
<td>${data['bitrate']} kbps</td>
</tr>
% if data['media_type'] != 'track':
<div class="col-sm-4">
<h5>Video</h5>
<ul class="list-unstyled">
<li>Stream: <strong>${data['transcode_video_dec']}</strong></li>
% if data['transcode_video_dec'] != 'direct play':
<li>Width: <strong>${data['transcode_width']}</strong></li>
<li>Height: <strong>${data['transcode_height']}</strong></li>
<li>Codec: <strong>${data['transcode_video_codec']}</strong></li>
% else:
<li>Width: <strong>${data['width']}</strong></li>
<li>Height: <strong>${data['height']}</strong></li>
<li>Codec: <strong>${data['video_codec']}</strong></li>
% endif
</ul>
</div>
<tr>
<td>Resolution</td>
<td>${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['stream_video_resolution'], data['stream_video_resolution'])}</td>
<td>${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['video_resolution'], data['video_resolution'])}</td>
</tr>
% endif
<div class="col-sm-4">
<h5>Audio</h5>
<ul class="list-unstyled">
<li>Stream: <strong>${data['transcode_audio_dec']}</strong></li>
% if data['transcode_audio_dec'] != 'direct play':
<li>Codec: <strong>${data['transcode_audio_codec']}</strong></li>
<li>Channels: <strong>${data['transcode_audio_channels']}</strong></li>
% else:
<li>Codec: <strong>${data['audio_codec']}</strong></li>
<li>Channels: <strong>${data['audio_channels']}</strong></li>
% endif
</ul>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<h4><strong>Source Details</strong></h4>
</div>
<div class="col-sm-4">
<h5>Media</h5>
<ul class="list-unstyled">
<li>Container: <strong>${data['container']}</strong></li>
% if data['media_type'] != 'track':
<li>Resolution: <strong>${data['video_resolution'] + 'p' if data['video_resolution'] != 'sd' else data['video_resolution']}</strong></li>
% endif
<li>Bitrate: <strong>${data['bitrate']} kbps</strong></li>
</ul>
</div>
% if data['media_type'] != 'track':
<div class="col-sm-4">
<h5>Video</h5>
<ul class="list-unstyled">
<li>Width: <strong>${data['width']}</strong></li>
<li>Height: <strong>${data['height']}</strong></li>
<li>Codec: <strong>${data['video_codec']}</strong></li>
<li>Aspect Ratio: <strong>${data['aspect_ratio']}</strong></li>
<li>Frame Rate: <strong>${data['video_framerate']}</strong></li>
</ul>
</div>
<tr>
<td>Quality</td>
<td>${data['quality_profile']}</td>
<td>-</td>
</tr>
% if data['optimized_version'] == 1:
<tr>
<td>Optimized Version</td>
<td>-</td>
<td>${data['optimized_version_profile']}</td>
</tr>
% endif
<div class="col-sm-4">
<h5>Audio</h5>
<ul class="list-unstyled">
<li>Codec: <strong>${data['audio_codec']}</strong></li>
<li>Channels: <strong>${data['audio_channels']}</strong></li>
</ul>
</div>
</div>
</div>
% if data['synced_version'] == 1:
<tr>
<td>Synced Version</td>
<td>-</td>
<td>yes</td>
</tr>
% endif
</tbody>
</table>
<table class="stream-info">
<thead>
<tr>
<th>
Container
</th>
<th>
${data['stream_container_decision']}
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Container</td>
<td>${data['stream_container']}</td>
<td>${data['container']}</td>
</tr>
</tbody>
</table>
% if data['media_type'] != 'track':
<table class="stream-info">
<thead>
<tr>
<th>
Video
</th>
<th>
${data['stream_video_decision']}
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Codec</td>
<td>${data['stream_video_codec']}</td>
<td>${data['video_codec']}</td>
</tr>
<tr>
<td>Bitrate</td>
<td>${data['stream_video_bitrate']} kbps</td>
<td>${data['video_bitrate']} kbps</td>
</tr>
<tr>
<td>Width</td>
<td>${data['stream_video_width']}</td>
<td>${data['video_width']}</td>
</tr>
<tr>
<td>Height</td>
<td>${data['stream_video_height']}</td>
<td>${data['video_height']}</td>
</tr>
<tr>
<td>Framerate</td>
<td>${data['stream_video_framerate']}</td>
<td>${data['video_framerate']}</td>
</tr>
<tr>
<td>Aspect Ratio</td>
<td>-</td>
<td>${data['aspect_ratio']}</td>
</tr>
</tbody>
</table>
% endif
<table class="stream-info">
<thead>
<tr>
<th>
Audio
</th>
<th>
${data['stream_audio_decision']}
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Codec</td>
<td>${data['stream_audio_codec']}</td>
<td>${data['audio_codec']}</td>
</tr>
<tr>
<td>Bitrate</td>
<td>${data['stream_audio_bitrate']} kbps</td>
<td>${data['audio_bitrate']} kbps</td>
</tr>
<tr>
<td>Channels</td>
<td>${data['stream_audio_channels']}</td>
<td>${data['audio_channels']}</td>
</tr>
</tbody>
</table>
% if data['subtitles'] == 1:
<table class="stream-info">
<thead>
<tr>
<th>
Subtitles
</th>
<th>
${data['stream_subtitle_decision']}
</th>
</tr>
</thead>
<tbody>
<tr>
<td>Codec</td>
<td>${data['stream_subtitle_codec']}</td>
<td>${data['subtitle_codec']}</td>
</tr>
</tbody>
</table>
% endif
</div>
<div class="modal-footer">
</div>

View file

@ -872,9 +872,14 @@ class DataFactory(object):
user_cond = 'AND %s.user_id = %s ' % (table, session.get_session_user_id())
if row_id:
query = 'SELECT container, bitrate, video_resolution, width, height, aspect_ratio, video_framerate, ' \
'video_codec, audio_codec, audio_channels, video_decision, transcode_video_codec, transcode_height, ' \
'transcode_width, audio_decision, transcode_audio_codec, transcode_audio_channels, transcode_container, ' \
query = 'SELECT bitrate, video_resolution, optimized_version, optimized_version_profile, synced_version, ' \
'container, video_codec, video_Bitrate, video_width, video_height, video_framerate, aspect_ratio, ' \
'audio_codec, audio_bitrate, audio_channels, subtitle_codec, ' \
'stream_bitrate, stream_video_resolution, quality_profile, stream_container_decision, stream_container, ' \
'stream_video_decision, stream_video_codec, stream_video_bitrate, stream_video_width, stream_video_height, ' \
'stream_video_framerate, ' \
'stream_audio_decision, stream_audio_codec, stream_audio_bitrate, stream_audio_channels, ' \
'subtitles, stream_subtitle_decision, stream_subtitle_codec, ' \
'session_history_metadata.media_type, title, grandparent_title ' \
'FROM session_history_media_info ' \
'JOIN session_history ON session_history_media_info.id = session_history.id ' \
@ -882,9 +887,14 @@ class DataFactory(object):
'WHERE session_history_media_info.id = ? %s' % user_cond
result = monitor_db.select(query, args=[row_id])
elif session_key:
query = 'SELECT container, bitrate, video_resolution, width, height, aspect_ratio, video_framerate, ' \
'video_codec, audio_codec, audio_channels, video_decision, transcode_video_codec, transcode_height, ' \
'transcode_width, audio_decision, transcode_audio_codec, transcode_audio_channels, transcode_container, ' \
query = 'SELECT bitrate, video_resolution, optimized_version, optimized_version_profile, synced_version, ' \
'container, video_codec, video_Bitrate, video_width, video_height, video_framerate, aspect_ratio, ' \
'audio_codec, audio_bitrate, audio_channels, subtitle_codec, ' \
'stream_bitrate, stream_video_resolution, quality_profile, stream_container_decision, stream_container, ' \
'stream_video_decision, stream_video_codec, stream_video_bitrate, stream_video_width, stream_video_height, ' \
'stream_video_framerate, ' \
'stream_audio_decision, stream_audio_codec, stream_audio_bitrate, stream_audio_channels, ' \
'subtitles, stream_subtitle_decision, stream_subtitle_codec, ' \
'media_type, title, grandparent_title ' \
'FROM sessions ' \
'WHERE session_key = ? %s' % user_cond
@ -895,24 +905,40 @@ class DataFactory(object):
stream_output = {}
for item in result:
stream_output = {'container': item['container'],
'bitrate': item['bitrate'],
stream_output = {'bitrate': item['bitrate'],
'video_resolution': item['video_resolution'],
'width': item['width'],
'height': item['height'],
'aspect_ratio': item['aspect_ratio'],
'video_framerate': item['video_framerate'],
'optimized_version': item['optimized_version'],
'optimized_version_profile': item['optimized_version_profile'],
'synced_version': item['synced_version'],
'container': item['container'],
'video_codec': item['video_codec'],
'video_bitrate': item['video_bitrate'],
'video_width': item['video_width'],
'video_height': item['video_height'],
'video_framerate': item['video_framerate'],
'aspect_ratio': item['aspect_ratio'],
'audio_codec': item['audio_codec'],
'audio_bitrate': item['audio_bitrate'],
'audio_channels': item['audio_channels'],
'transcode_video_dec': item['video_decision'],
'transcode_video_codec': item['transcode_video_codec'],
'transcode_height': item['transcode_height'],
'transcode_width': item['transcode_width'],
'transcode_audio_dec': item['audio_decision'],
'transcode_audio_codec': item['transcode_audio_codec'],
'transcode_audio_channels': item['transcode_audio_channels'],
'transcode_container': item['transcode_container'],
'subtitle_codec': item['subtitle_codec'],
'stream_bitrate': item['stream_bitrate'],
'stream_video_resolution': item['stream_video_resolution'],
'quality_profile': item['quality_profile'],
'stream_container_decision': item['stream_container_decision'],
'stream_container': item['stream_container'],
'stream_video_decision': item['stream_video_decision'],
'stream_video_codec': item['stream_video_codec'],
'stream_video_bitrate': item['stream_video_bitrate'],
'stream_video_width': item['stream_video_width'],
'stream_video_height': item['stream_video_height'],
'stream_video_framerate': item['stream_video_framerate'],
'stream_audio_decision': item['stream_audio_decision'],
'stream_audio_codec': item['stream_audio_codec'],
'stream_audio_bitrate': item['stream_audio_bitrate'],
'stream_audio_channels': item['stream_audio_channels'],
'subtitles': item['subtitles'],
'stream_subtitle_decision': item['stream_subtitle_decision'],
'stream_subtitle_codec': item['stream_subtitle_codec'],
'media_type': item['media_type'],
'title': item['title'],
'grandparent_title': item['grandparent_title']