diff --git a/data/interfaces/default/current_activity_instance.html b/data/interfaces/default/current_activity_instance.html index e64f2dd7..6cd017e3 100644 --- a/data/interfaces/default/current_activity_instance.html +++ b/data/interfaces/default/current_activity_instance.html @@ -62,7 +62,7 @@ DOCUMENTATION :: END % if session is not None: <% from collections import defaultdict - from plexpy.helpers import cast_to_int, page, short_season + from plexpy.helpers import cast_to_int, get_percent, page, short_season from plexpy.common import VIDEO_RESOLUTION_OVERRIDES, AUDIO_CODEC_OVERRIDES, EXTRA_TYPES import plexpy %> @@ -392,7 +392,8 @@ DOCUMENTATION :: END % if data['live']:
% else: - + <% transcode_progress = get_percent(data['transcode_max_offset_available'] * 1000, data['duration']) or data['transcode_progress'] %> + % endif diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html index 11f9ddf3..652af7c6 100644 --- a/data/interfaces/default/index.html +++ b/data/interfaces/default/index.html @@ -590,8 +590,10 @@ } // Update the progress bars - $('#buffer-bar-' + key).css({width: parseInt(s.transcode_progress) + '%'}).html(s.transcode_progress + '%') - .attr('data-original-title', 'Transcoder Progress ' + s.transcode_progress + '%'); + var duration = parseInt(s.duration); + var transcode_progress = duration ? Math.round(s.transcode_max_offset_available * 1000 / duration * 100) : s.transcode_progress; + $('#buffer-bar-' + key).css({width: parseInt(transcode_progress) + '%'}).html(transcode_progress + '%') + .attr('data-original-title', 'Transcoder Progress ' + transcode_progress + '%'); if (s.live !== 1) { var progress_bar = $('#progress-bar-' + key); progress_bar.data('state', s.state); diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py index fc89def6..94b0fdeb 100644 --- a/plexpy/pmsconnect.py +++ b/plexpy/pmsconnect.py @@ -1734,6 +1734,8 @@ class PmsConnect(object): transcode_progress = helpers.get_xml_attr(transcode_info, 'progress') transcode_speed = helpers.get_xml_attr(transcode_info, 'speed') + transcode_min_offset = helpers.get_xml_attr(transcode_info, 'minOffsetAvailable') + transcode_max_offset = helpers.get_xml_attr(transcode_info, 'maxOffsetAvailable') transcode_details = {'transcode_key': helpers.get_xml_attr(transcode_info, 'key'), 'transcode_throttled': int(helpers.get_xml_attr(transcode_info, 'throttled') == '1'), @@ -1746,6 +1748,8 @@ class PmsConnect(object): 'transcode_height': helpers.get_xml_attr(transcode_info, 'height'), # Blank but keep backwards compatibility 'transcode_container': helpers.get_xml_attr(transcode_info, 'container'), 'transcode_protocol': helpers.get_xml_attr(transcode_info, 'protocol'), + 'transcode_min_offset_available': int(round(helpers.cast_to_float(transcode_min_offset), 0)), + 'transcode_max_offset_available': int(round(helpers.cast_to_float(transcode_max_offset), 0)), 'transcode_hw_requested': int(helpers.get_xml_attr(transcode_info, 'transcodeHwRequested') == '1'), 'transcode_hw_decode': helpers.get_xml_attr(transcode_info, 'transcodeHwDecoding'), 'transcode_hw_decode_title': helpers.get_xml_attr(transcode_info, 'transcodeHwDecodingTitle'), @@ -1771,6 +1775,8 @@ class PmsConnect(object): 'transcode_height': '', 'transcode_container': '', 'transcode_protocol': '', + 'transcode_min_offset_available': 0, + 'transcode_max_offset_available': 0, 'transcode_hw_requested': 0, 'transcode_hw_decode': '', 'transcode_hw_decode_title': '',