diff --git a/data/interfaces/default/current_activity_instance.html b/data/interfaces/default/current_activity_instance.html index 47ab1695..3f0730c3 100644 --- a/data/interfaces/default/current_activity_instance.html +++ b/data/interfaces/default/current_activity_instance.html @@ -152,15 +152,15 @@ DOCUMENTATION :: END
% if data['media_type'] in ('movie', 'episode', 'clip'): % if data['video_decision'] == 'transcode': - Video  Transcode (${data['video_codec'].upper()} ${data['video_resolution'].rstrip('p') + ('p' if data['video_resolution'].lower() != 'sd' else '')} → ${data['stream_video_codec'].upper()} ${data['stream_video_resolution'].rstrip('p') + ('p' if data['stream_video_resolution'].lower() != 'sd' else '')}) + Video  Transcode (${data['video_codec'].upper()} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['video_resolution'], data['video_resolution'])} → ${data['stream_video_codec'].upper()} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['stream_video_resolution'], data['stream_video_resolution'])}) % elif data['video_decision'] == 'copy': - Video  Direct Stream (${data['stream_video_codec'].upper()} ${data['stream_video_resolution'].rstrip('p') + ('p' if data['stream_video_resolution'].lower() != 'sd' else '')}) + Video  Direct Stream (${data['stream_video_codec'].upper()} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['stream_video_resolution'], data['stream_video_resolution'])}) % else: - Video  Direct Play (${data['video_codec'].upper()} ${data['video_resolution'].rstrip('p') + ('p' if data['video_resolution'].lower() != 'sd' else '')}) + Video  Direct Play (${data['video_codec'].upper()} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['video_resolution'], data['video_resolution'])}) % endif
% endif - % if data['media_type'] in ('movie', 'episode', 'clip', 'track'): + % if data['media_type'] in ('movie', 'episode', 'clip', 'track') and data['audio_codec']: % if data['audio_decision'] == 'transcode': Audio  Transcode (${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout']} → ${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': @@ -169,6 +169,9 @@ DOCUMENTATION :: END Audio  Direct Play (${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout']}) % endif
+ % else: + Audio  None +
% endif % if data['media_type'] in ('movie', 'episode', 'clip') and data['subtitles'] == '1': % if data['subtitle_decision'] == 'transcode': diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html index f359d726..492df1a6 100644 --- a/data/interfaces/default/index.html +++ b/data/interfaces/default/index.html @@ -205,8 +205,26 @@ ts += 'Stream  Direct Play
'; } if (s.video_decision != '' && s.media_type != 'photo') { - var v_res = s.video_resolution.replace(/p$/, '') + ((s.video_resolution.toLowerCase() == 'sd') ? '' : 'p'); - var sv_res = s.stream_video_resolution.replace(/p$/, '') + ((s.stream_video_resolution.toLowerCase() == 'sd') ? '' : 'p'); + switch (s.video_resolution.toLowerCase()) { + case 'sd': + var v_res = 'SD'; + break; + case '4k': + var v_res = '4k'; + break; + default: + var v_res = s.video_resolution + 'p' + } + switch (s.stream_video_resolution.toLowerCase()) { + case 'sd': + var sv_res = 'SD'; + break; + case '4k': + var sv_res = '4k'; + break; + default: + var sv_res = s.stream_video_resolution + 'p' + } if (s.video_decision == 'transcode') { ts += 'Video  Transcode (' + s.video_codec.toUpperCase() + ' ' + v_res + ' → ' + s.stream_video_codec.toUpperCase() + ' ' + sv_res + ')
'; } else if (s.video_decision == 'copy') { @@ -215,15 +233,20 @@ ts += 'Video  Direct Play (' + s.video_codec.toUpperCase() + ' ' + v_res + ')
'; } } - if (s.audio_decision != '') { + if (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') { - ts += 'Audio  Transcode (' + s.audio_codec.toUpperCase() + ' ' + s.audio_channel_layout + ' → ' + s.stream_audio_codec.toUpperCase() + ' ' + s.stream_audio_channel_layout + ')
'; + ts += 'Audio  Transcode (' + a_codec + ' ' + s.audio_channel_layout + ' → ' + sa_codec + ' ' + s.stream_audio_channel_layout + ')
'; } else if (s.audio_decision == 'copy') { - ts += 'Audio  Direct Stream (' + s.stream_audio_codec.toUpperCase() + ' ' + s.stream_audio_channel_layout + ')
'; + ts += 'Audio  Direct Stream (' + sa_codec + ' ' + s.stream_audio_channel_layout + ')
'; } else { - ts += 'Audio  Direct Play (' + s.audio_codec.toUpperCase() + ' ' + s.audio_channel_layout + ')
'; + ts += 'Audio  Direct Play (' + a_codec + ' ' + s.audio_channel_layout + ')
'; } } + else { + ts += 'Audio  None
'; + } if (s.subtitles) { if (s.subtitle_decision == 'transcode') { ts += 'Subtitle  Transcode (' + s.subtitle_codec.toUpperCase() + ' → ' + s.stream_subtitle_codec.toUpperCase() + ')'; diff --git a/plexpy/common.py b/plexpy/common.py index 916972aa..73e40adf 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -58,6 +58,14 @@ MEDIA_FLAGS_VIDEO = {'avc1': 'h264', AUDIO_CODEC_OVERRIDES = {'truehd': 'TrueHD'} +VIDEO_RESOLUTION_OVERRIDES = {'sd': 'SD', + '480': '480p', + '576': '576p', + '720': '720p', + '1080': '1080p', + '4k': '4k' + } + AUDIO_CHANNELS = {'1': 'Mono', '2': 'Stereo', '3': '2.1', diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py index 3b516373..fea9a7a3 100644 --- a/plexpy/pmsconnect.py +++ b/plexpy/pmsconnect.py @@ -1279,7 +1279,7 @@ class PmsConnect(object): else: transcode_throttled = 0 - if helpers.get_xml_attr(transcode_info, 'transcodeHwRequested') == '1': + if helpers.get_xml_attr(transcode_info, 'transcodeHwFullPipeline') == '1': transcode_hardware = 1 else: transcode_hardware = 0 @@ -1404,6 +1404,13 @@ class PmsConnect(object): else: transcode_decision = 'direct play' + stream_video_width = helpers.get_xml_attr(stream_media_info, 'width') + if helpers.cast_to_int(stream_video_width) >= 3840: + stream_video_resolution = '4k' + else: + stream_video_resolution = helpers.get_xml_attr(stream_media_info, 'videoResolution').rstrip('p') + + stream_details = {'stream_container': helpers.get_xml_attr(stream_media_info, 'container'), 'stream_bitrate': helpers.get_xml_attr(stream_media_info, 'bitrate'), 'stream_aspect_ratio': helpers.get_xml_attr(stream_media_info, 'aspectRatio'), @@ -1412,7 +1419,7 @@ class PmsConnect(object): 'stream_audio_channel_layout': common.AUDIO_CHANNELS.get(stream_audio_channels, stream_audio_channels), 'stream_video_codec': helpers.get_xml_attr(stream_media_info, 'videoCodec'), 'stream_video_framerate': helpers.get_xml_attr(stream_media_info, 'videoFrameRate'), - 'stream_video_resolution': helpers.get_xml_attr(stream_media_info, 'videoResolution'), + 'stream_video_resolution': stream_video_resolution, 'stream_video_height': helpers.get_xml_attr(stream_media_info, 'height'), 'stream_video_width': helpers.get_xml_attr(stream_media_info, 'width'), 'stream_duration': helpers.get_xml_attr(stream_media_info, 'duration'),