From ee1b0eeeff1db0c2121fd3fe725cfa791c1ca952 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Sat, 15 Feb 2020 13:29:25 -0800 Subject: [PATCH] Add Live TV metadata to activity card --- .../default/current_activity_instance.html | 35 +++++++++++++-- data/interfaces/default/index.html | 21 +++++++-- plexpy/pmsconnect.py | 45 +++++++++++-------- 3 files changed, 75 insertions(+), 26 deletions(-) diff --git a/data/interfaces/default/current_activity_instance.html b/data/interfaces/default/current_activity_instance.html index c69b295e..4e0b609a 100644 --- a/data/interfaces/default/current_activity_instance.html +++ b/data/interfaces/default/current_activity_instance.html @@ -96,7 +96,13 @@ DOCUMENTATION :: END
% endif % if data['live'] == 1: + % if data['grandparent_thumb'].startswith('http'): +
+ % elif data['grandparent_thumb']: +
+ % else:
+ % endif % elif data['channel_stream'] == 0: % if data['media_type'] == 'movie': @@ -377,7 +383,7 @@ DOCUMENTATION :: END
% if data['live'] == 1: -
Live
+
Live
% else:
${data['transcode_progress']}%
${data['progress_percent']}%
@@ -400,7 +406,16 @@ DOCUMENTATION :: END % endif
- % if data['live'] == 1: + % if data['live'] == 1 and data['media_type'] == 'clip': @@ -449,8 +464,20 @@ DOCUMENTATION :: END
% endif
- % if data['live'] == 1: + % if data['live']: + % if data['media_type'] == 'movie': + ${data['year']} + % elif data['media_type'] == 'episode': + S${data['parent_media_index']} + · E${data['media_index']} + % else: Plex Live TV + % endif + % if data['channel_identifier']: + + (${data['channel_call_sign']} ${data['channel_identifier']}) + + % endif % elif data['channel_stream'] == 0: % if data['media_type'] == 'movie': ${data['year']} diff --git a/data/interfaces/default/index.html b/data/interfaces/default/index.html index d6b479d5..04f34678 100644 --- a/data/interfaces/default/index.html +++ b/data/interfaces/default/index.html @@ -543,10 +543,12 @@ // Update the progress bars, percent - 3 because of 3px padding-right $('#buffer-bar-' + key).width(parseInt(s.transcode_progress) - 3 + '%').html(s.transcode_progress + '%') .attr('data-original-title', 'Transcoder Progress ' + s.transcode_progress + '%'); - var progress_bar = $('#progress-bar-' + key); - progress_bar.data('state', s.state); - if (progress_bar.data('last_view_offset') !== s.view_offset) { - progress_bar.data('last_view_offset', s.view_offset).data('view_offset', s.view_offset); + if (s.live !== 1) { + var progress_bar = $('#progress-bar-' + key); + progress_bar.data('state', s.state); + if (progress_bar.data('last_view_offset') !== s.view_offset) { + progress_bar.data('last_view_offset', s.view_offset).data('view_offset', s.view_offset); + } } // Add temporary class so we know which instances are still active @@ -593,6 +595,17 @@ $('#activity-instance-' + session_key + ' .dashboard-activity-info-scroller').scrollbar(); $('#activity-instance-' + session_key + ' [data-toggle=tooltip]').tooltip({ container: 'body', placement: 'right', delay: 50 }); + $('#activity-instance-' + session_key + ' [data-toggle=popover]').popover({ + html: true, + container: 'body', + trigger: 'hover', + placement: 'right', + delay: 50, + template: '', + content: function () { + return '
'; + } + }); $('#terminate-button-' + session_key).tooltip('destroy').tooltip({ container: 'body', placement: 'left', delay: 50 }); lockScroll('#activity-instance-' + session_key + ' .dashboard-activity-info-scroller'); diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py index 564eed41..1b295a77 100644 --- a/plexpy/pmsconnect.py +++ b/plexpy/pmsconnect.py @@ -641,6 +641,8 @@ class PmsConnect(object): if metadata_main.nodeName == 'Directory' and metadata_type == 'photo': metadata_type = 'photo_album' + live = int(helpers.get_xml_attr(metadata_main, 'live') == '1') + section_id = helpers.get_xml_attr(a, 'librarySectionID') library_name = helpers.get_xml_attr(a, 'librarySectionTitle') @@ -1323,24 +1325,31 @@ class PmsConnect(object): audio_channels = helpers.get_xml_attr(media, 'audioChannels') - medias.append({'id': helpers.get_xml_attr(media, 'id'), - 'container': helpers.get_xml_attr(media, 'container'), - 'bitrate': helpers.get_xml_attr(media, 'bitrate'), - 'height': helpers.get_xml_attr(media, 'height'), - 'width': helpers.get_xml_attr(media, 'width'), - 'aspect_ratio': helpers.get_xml_attr(media, 'aspectRatio'), - 'video_codec': helpers.get_xml_attr(media, 'videoCodec'), - 'video_resolution': video_resolution, - 'video_full_resolution': video_full_resolution, - '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': int(helpers.get_xml_attr(media, 'proxyType') == '42'), - 'parts': parts - }) + media_info = {'id': helpers.get_xml_attr(media, 'id'), + 'container': helpers.get_xml_attr(media, 'container'), + 'bitrate': helpers.get_xml_attr(media, 'bitrate'), + 'height': helpers.get_xml_attr(media, 'height'), + 'width': helpers.get_xml_attr(media, 'width'), + 'aspect_ratio': helpers.get_xml_attr(media, 'aspectRatio'), + 'video_codec': helpers.get_xml_attr(media, 'videoCodec'), + 'video_resolution': video_resolution, + 'video_full_resolution': video_full_resolution, + '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': int(helpers.get_xml_attr(media, 'proxyType') == '42'), + 'parts': parts + } + + if live: + media_info['channel_call_sign'] = helpers.get_xml_attr(media, 'channelCallSign') or 'WBTV HD' + media_info['channel_identifier'] = helpers.get_xml_attr(media, 'channelIdentifier') or '3.1' + media_info['channel_thumb'] = helpers.get_xml_attr(media, 'channelThumb') or 'http://cps-static.rovicorp.com/2/Open/2400x2400_1578/Source/77752/cbs_2400_color_dark_light.png' + + medias.append(media_info) metadata['media_info'] = medias