Fix some incorrect codec info displayed

This commit is contained in:
JonnyWong16 2017-10-29 10:23:51 -07:00
parent f07a7fa2cf
commit 8625d3f127
3 changed files with 39 additions and 39 deletions

View file

@ -170,7 +170,7 @@ DOCUMENTATION :: END
<li class="dashboard-activity-info-item">
<div class="sub-heading">Container</div>
<div class="sub-value" id="transcode_container-${data['session_key']}">
% if data['container'] != data['stream_container']:
% if data['stream_container_decision'] == 'transcode':
Transcode (${data['container'].upper()} &rarr; ${data['stream_container'].upper()})
% else:
Direct Play (${data['container'].upper()})
@ -182,13 +182,13 @@ DOCUMENTATION :: END
<div class="sub-heading">Video</div>
<div class="sub-value" id="video_decision-${data['session_key']}">
% if data['media_type'] in ('movie', 'episode', 'clip'):
% if data['video_decision'] == 'transcode':
% if data['stream_video_decision'] == 'transcode':
<%
hw_d = ' (HW)' if data['transcode_hw_requested'] == '1' and data['transcode_hw_decode'] and data['transcode_hw_full_pipeline'] == '0' else ''
hw_e = ' (HW)' if data['transcode_hw_requested'] == '1' and data['transcode_hw_encode'] and data['transcode_hw_full_pipeline'] == '1' else ''
%>
Transcode (${data['video_codec'].upper()}${hw_d} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['video_resolution'], data['video_resolution'])} &rarr; ${data['stream_video_codec'].upper()}${hw_e} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['stream_video_resolution'], data['stream_video_resolution'])})
% elif data['video_decision'] == 'copy':
% elif data['stream_video_decision'] == 'copy':
Direct Stream (${data['stream_video_codec'].upper()} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['stream_video_resolution'], data['stream_video_resolution'])})
% else:
Direct Play (${data['video_codec'].upper()} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['video_resolution'], data['video_resolution'])})
@ -203,12 +203,12 @@ DOCUMENTATION :: END
<li class="dashboard-activity-info-item">
<div class="sub-heading">Audio</div>
<div class="sub-value" id="audio_decision-${data['session_key']}">
% if data['audio_decision'] == 'transcode':
Transcode (${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout']} &rarr; ${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['stream_audio_codec'], data['stream_audio_codec'].upper())} ${data['stream_audio_channel_layout']})
% elif data['audio_decision'] == 'copy':
% if data['stream_audio_decision'] == 'transcode':
Transcode (${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout'].split('(')[0]} &rarr; ${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['stream_audio_codec'], data['stream_audio_codec'].upper())} ${data['stream_audio_channel_layout']})
% elif data['stream_audio_decision'] == 'copy':
Direct Stream (${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['stream_audio_codec'], data['stream_audio_codec'].upper())} ${data['stream_audio_channel_layout']})
% else:
Direct Play (${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout']})
Direct Play (${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout'].split('(')[0]})
% endif
</div>
</li>
@ -218,11 +218,11 @@ DOCUMENTATION :: END
<div class="sub-heading">Subtitle</div>
<div class="sub-value" id="subtitle_decision-${data['session_key']}">
% if data['subtitles'] == '1':
% if data['subtitle_decision'] == 'transcode':
% if data['stream_subtitle_decision'] == 'transcode':
Transcode (${data['subtitle_codec'].upper()} &rarr; ${data['stream_subtitle_codec'].upper()})
% elif data['subtitle_decision'] == 'copy':
% elif data['stream_subtitle_decision'] == 'copy':
Direct Stream (${data['subtitle_codec'].upper()})
% elif data['subtitle_decision'] == 'burn':
% elif data['stream_subtitle_decision'] == 'burn':
Burn (${data['subtitle_codec'].upper()})
% else:
Direct Play (${data['subtitle_codec'].upper()})

View file

@ -314,7 +314,7 @@
$('#transcode_decision-' + key).html(transcode_decision);
var transcode_container = '';
if (s.container != s.stream_container) {
if (s.stream_container_decision === 'transcode') {
transcode_container = 'Transcode (' + s.container.toUpperCase() + ' &rarr; ' + s.stream_container.toUpperCase() + ')';
} else {
transcode_container = 'Direct Play (' + s.container.toUpperCase() + ')';
@ -343,11 +343,11 @@
default:
var sv_res = s.stream_video_resolution + 'p'
}
if (s.video_decision === 'transcode') {
var hw_d = (s.transcode_hw_requested === '1' && s.transcode_hw_decode && s.transcode_hw_full_pipeline === '0') ? ' (HW)' : '';
var hw_e = (s.transcode_hw_requested === '1' && s.transcode_hw_encode && s.transcode_hw_full_pipeline === '1') ? ' (HW)' : '';
if (s.stream_video_decision === 'transcode') {
var hw_d = (s.transcode_hw_requested === '1' && s.transcode_hw_decode && s.transcode_hw_full_pipeline === '0') ? ' (HW)' : ' (HW)';
var hw_e = (s.transcode_hw_requested === '1' && s.transcode_hw_encode && s.transcode_hw_full_pipeline === '1') ? ' (HW)' : ' (HW)';
video_decision = 'Transcode (' + s.video_codec.toUpperCase() + hw_d + ' ' + v_res + ' &rarr; ' + s.stream_video_codec.toUpperCase() + hw_e + ' ' + sv_res + ')';
} else if (s.video_decision === 'copy') {
} else if (s.stream_video_decision === 'copy') {
video_decision = 'Direct Stream (' + s.stream_video_codec.toUpperCase() + ' ' + sv_res + ')';
} else {
video_decision = 'Direct Play (' + s.video_codec.toUpperCase() + ' ' + v_res + ')';
@ -361,23 +361,23 @@
if (['movie', 'episode', 'clip', 'track'].indexOf(s.media_type) > -1 && s.audio_codec) {
var a_codec = (s.audio_codec === 'truehd') ? 'TrueHD' : s.audio_codec.toUpperCase();
var sa_codec = (s.stream_audio_codec === 'truehd') ? 'TrueHD' : s.stream_audio_codec.toUpperCase();
if (s.audio_decision === 'transcode') {
audio_decision = 'Transcode (' + a_codec + ' ' + s.audio_channel_layout + ' &rarr; ' + sa_codec + ' ' + s.stream_audio_channel_layout + ')';
} else if (s.audio_decision === 'copy') {
if (s.stream_audio_decision === 'transcode') {
audio_decision = 'Transcode (' + a_codec + ' ' + s.audio_channel_layout.split('(')[0] + ' &rarr; ' + sa_codec + ' ' + s.stream_audio_channel_layout + ')';
} else if (s.stream_audio_decision === 'copy') {
audio_decision = 'Direct Stream (' + sa_codec + ' ' + s.stream_audio_channel_layout + ')';
} else {
audio_decision = 'Direct Play (' + a_codec + ' ' + s.audio_channel_layout + ')';
audio_decision = 'Direct Play (' + a_codec + ' ' + s.audio_channel_layout.split('(')[0] + ')';
}
}
$('#audio_decision-' + key).html(audio_decision);
var subtitle_decision = 'None';
if (['movie', 'episode', 'clip'].indexOf(s.media_type) > -1 && s.subtitles == '1') {
if (s.subtitle_decision === 'transcode') {
if (s.stream_subtitle_decision === 'transcode') {
subtitle_decision = 'Transcode (' + s.subtitle_codec.toUpperCase() + ' &rarr; ' + s.stream_subtitle_codec.toUpperCase() + ')';
} else if (s.subtitle_decision === 'copy') {
} else if (s.stream_subtitle_decision === 'copy') {
subtitle_decision = 'Direct Stream (' + s.subtitle_codec.toUpperCase() + ')';
} else if (s.subtitle_decision === 'burn') {
} else if (s.stream_subtitle_decision === 'burn') {
subtitle_decision = 'Burn (' + s.subtitle_codec.toUpperCase() + ')';
} else {
subtitle_decision = 'Direct Play (' + s.subtitle_codec.toUpperCase() + ')';

View file

@ -1081,22 +1081,31 @@ class PmsConnect(object):
if helpers.get_xml_attr(stream, 'streamType') == '1':
streams.append({'id': helpers.get_xml_attr(stream, 'id'),
'type': helpers.get_xml_attr(stream, 'streamType'),
'video_codec': helpers.get_xml_attr(stream, 'codec'),
'video_codec_level': helpers.get_xml_attr(stream, 'level'),
'video_bitrate': helpers.get_xml_attr(stream, 'bitrate'),
'video_bit_depth': helpers.get_xml_attr(stream, 'bitDepth'),
'video_codec_level': helpers.get_xml_attr(stream, 'level'),
'video_frame_rate': helpers.get_xml_attr(stream, 'frameRate'),
'video_ref_frames': helpers.get_xml_attr(stream, 'refFrames'),
'video_height': helpers.get_xml_attr(stream, 'height'),
'video_width': helpers.get_xml_attr(stream, 'width'),
'video_language': helpers.get_xml_attr(stream, 'language'),
'video_language_code': helpers.get_xml_attr(stream, 'languageCode')
'video_language_code': helpers.get_xml_attr(stream, 'languageCode'),
'video_profile': helpers.get_xml_attr(stream, 'profile')
})
elif helpers.get_xml_attr(stream, 'streamType') == '2':
streams.append({'id': helpers.get_xml_attr(stream, 'id'),
'type': helpers.get_xml_attr(stream, 'streamType'),
'audio_codec': helpers.get_xml_attr(stream, 'codec'),
'audio_bitrate': helpers.get_xml_attr(stream, 'bitrate'),
'audio_bitrate_mode': helpers.get_xml_attr(stream, 'bitrateMode'),
'audio_channels': helpers.get_xml_attr(stream, 'channels'),
'audio_channel_layout': helpers.get_xml_attr(stream, 'audioChannelLayout'),
'audio_sample_rate': helpers.get_xml_attr(stream, 'samplingRate'),
'audio_language': helpers.get_xml_attr(stream, 'language'),
'audio_language_code': helpers.get_xml_attr(stream, 'languageCode'),
'audio_profile': helpers.get_xml_attr(stream, 'profile')
})
elif helpers.get_xml_attr(stream, 'streamType') == '3':
@ -1129,9 +1138,11 @@ class PmsConnect(object):
'video_codec': helpers.get_xml_attr(media, 'videoCodec'),
'video_resolution': helpers.get_xml_attr(media, 'videoResolution'),
'video_framerate': helpers.get_xml_attr(media, 'videoFrameRate'),
'video_profile': helpers.get_xml_attr(media, 'videoProfile'),
'audio_codec': helpers.get_xml_attr(media, 'audioCodec'),
'audio_channels': audio_channels,
'audio_channel_layout': common.AUDIO_CHANNELS.get(audio_channels, audio_channels),
'audio_profile': helpers.get_xml_attr(media, 'audioProfile'),
'optimized_version': 1 if helpers.get_xml_attr(media, 'proxyType') == '42' else 0,
'parts': parts
})
@ -1397,22 +1408,12 @@ class PmsConnect(object):
# Figure out which version is being played
media_info_all = session.getElementsByTagName('Media')
media_parts_stream_info = []
for stream_media_info in media_info_all:
media_part_info_all = stream_media_info.getElementsByTagName('Part')
for stream_media_parts_info in media_part_info_all:
if stream_media_parts_info.getElementsByTagName('Stream'):
media_parts_stream_info = stream_media_parts_info.getElementsByTagName('Stream')
break
if media_parts_stream_info:
break
stream_media_info = next((m for m in media_info_all if helpers.get_xml_attr(m, 'selected') == '1'), media_info_all[0])
stream_media_parts_info = stream_media_info.getElementsByTagName('Part')[0]
# Get the stream details
video_stream_info = audio_stream_info = subtitle_stream_info = None
for stream in media_parts_stream_info:
for stream in stream_media_parts_info.getElementsByTagName('Stream'):
if helpers.get_xml_attr(stream, 'streamType') == '1':
video_stream_info = stream
@ -1466,8 +1467,6 @@ class PmsConnect(object):
else:
bif_thumb = ''
stream_audio_channels = helpers.get_xml_attr(stream_media_info, 'audioChannels')
# Generate a combined transcode decision value
if transcode_details['video_decision'] == 'transcode' or transcode_details['audio_decision'] == 'transcode':
transcode_decision = 'transcode'
@ -1482,6 +1481,7 @@ class PmsConnect(object):
else:
stream_video_resolution = helpers.get_xml_attr(stream_media_info, 'videoResolution').rstrip('p')
stream_audio_channels = helpers.get_xml_attr(stream_media_info, 'audioChannels')
stream_details = {'stream_container': helpers.get_xml_attr(stream_media_info, 'container'),
'stream_bitrate': helpers.get_xml_attr(stream_media_info, 'bitrate'),