From 67bac92849f067033d4c3b3aab5bc1ac5007d23b Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Fri, 3 Nov 2017 19:46:41 -0700 Subject: [PATCH] Add channels to activity --- data/interfaces/default/css/plexpy.css | 3 +- .../default/current_activity_instance.html | 120 ++++++++++-------- data/interfaces/default/index.html | 8 +- plexpy/common.py | 1 + plexpy/pmsconnect.py | 18 ++- 5 files changed, 88 insertions(+), 62 deletions(-) diff --git a/data/interfaces/default/css/plexpy.css b/data/interfaces/default/css/plexpy.css index 9d453040..b48099fc 100644 --- a/data/interfaces/default/css/plexpy.css +++ b/data/interfaces/default/css/plexpy.css @@ -749,8 +749,7 @@ a .users-poster-face:hover { .dashboard-activity-terminate-session { width: 100%; height: 100%; - padding-top: 3px; - font-size: 30px; + font-size: 31px; color: #eee; text-align: center; opacity: 0; diff --git a/data/interfaces/default/current_activity_instance.html b/data/interfaces/default/current_activity_instance.html index f71f6c6a..aa898538 100644 --- a/data/interfaces/default/current_activity_instance.html +++ b/data/interfaces/default/current_activity_instance.html @@ -69,46 +69,44 @@ DOCUMENTATION :: END data-rating_key="${data['rating_key']}" data-parent_rating_key="${data['parent_rating_key']}" data-grandparent_rating_key="${data['grandparent_rating_key']}">
- % if data['media_type'] != 'clip': + % if data['channel_stream'] == '0':
% else: - % if data['art'].startswith('http'): + % if (data['art'] and data['art'].startswith('http')) or (data['thumb'] and data['thumb'].startswith('http')):
% else: -
+
% endif % endif - <% - if data['media_type'] in ('movie', 'clip'): - rating_key = data['rating_key'] - title = data['title'] - thumb = data['thumb'] - elif data['media_type'] in ('track', 'photo'): - rating_key = data['parent_rating_key'] - title = data['parent_title'] - thumb = data['parent_thumb'] - elif data['media_type'] in ('episode'): - rating_key = data['grandparent_rating_key'] - title = data['grandparent_title'] - thumb = data['grandparent_thumb'] - else: - rating_key = '' - title = '' - thumb = '' - %> - % if data['rating_key'] and data['media_type'] not in ('photo', 'clip'): - - % elif data['media_type']: -
+ % if data['channel_stream'] == '0': + % if data['media_type'] == 'movie': + + % elif data['media_type'] == 'episode': + + % elif data['media_type'] == 'track': + + % elif data['media_type'] in ('photo', 'clip'): +
+ % else: +
+ % endif % else: -
+ % if data['channel_icon'].startswith('http'): +
+ % else: +
+ % endif % endif
<% - if not _session['user_group'] == 'admin' or data['synced_version'] == '1': + if not _session['user_group'] == 'admin' or not data['session_id']: no_terminate = '-no-terminate' else: no_terminate = '' @@ -120,7 +118,7 @@ DOCUMENTATION :: END
% if _session['user_group'] == 'admin' and plexpy.CONFIG.PMS_PLEXPASS and data['session_id']:
- +
% endif
@@ -180,14 +178,14 @@ DOCUMENTATION :: END % elif data['transcode_decision'] == 'copy': Direct Stream % else: - Direct Play ${'(Synced)' if data['synced_version'] else ''} + Direct Play ${'(Synced)' if data['synced_version'] == '1' else ''} % endif
  • Container
    - % if data['stream_container_decision'] == 'transcode': + % if data.get('stream_container_decision') == 'transcode': Transcode (${data['container'].upper()} → ${data['stream_container'].upper()}) % else: Direct Play (${data['container'].upper()}) @@ -199,7 +197,7 @@ DOCUMENTATION :: END
    Video
    % if data['media_type'] in ('movie', 'episode', 'clip'): - % if data['stream_video_decision'] == 'transcode': + % if data.get('stream_video_decision') == 'transcode': <% hw_d = hw_e = '' if data['transcode_hw_requested'] == '1' and data['transcode_hw_full_pipeline'] == '0': @@ -208,7 +206,7 @@ DOCUMENTATION :: END hw_d = hw_e = ' (HW)' %> Transcode (${data['video_codec'].upper()}${hw_d} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['video_resolution'], data['video_resolution'])} → ${data['stream_video_codec'].upper()}${hw_e} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['stream_video_resolution'], data['stream_video_resolution'])}) - % elif data['stream_video_decision'] == 'copy': + % elif data.get('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'])}) @@ -223,9 +221,9 @@ DOCUMENTATION :: END
  • Audio
    - % if data['stream_audio_decision'] == 'transcode': + % if data.get('stream_audio_decision') == 'transcode': Transcode (${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout'].split('(')[0].capitalize()} → ${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['stream_audio_codec'], data['stream_audio_codec'].upper())} ${data['stream_audio_channel_layout'].split('(')[0].capitalize()}) - % elif data['stream_audio_decision'] == 'copy': + % elif data.get('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'].split('(')[0].capitalize()}) % else: Direct Play (${plexpy.common.AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout'].split('(')[0].capitalize()}) @@ -278,9 +276,9 @@ DOCUMENTATION :: END
  • Bandwidth
    - % if data['media_type'] != 'photo' and data['bandwidth']: + % if data['media_type'] != 'photo' and helpers.cast_to_int(data['bandwidth']): <% - bw = helpers.cast_to_int(data['bandwidth']) or "Unknown" + bw = helpers.cast_to_int(data['bandwidth']) if bw != "Unknown": if bw > 1000: bw = str(round(bw / 1000.0, 1)) + ' Mbps' @@ -289,7 +287,7 @@ DOCUMENTATION :: END %> ${bw} - % elif data['synced_version'] == '1': + % elif data['synced_version'] == '1' or data['channel_stream'] == '1': None % else: Unknown @@ -301,6 +299,7 @@ DOCUMENTATION :: END
    % if data['media_type'] != 'photo':
    + % if data['view_offset']: ETA: + % else: + ETA: Unknown
    0:00 / + + + % endif
    % endif @@ -343,28 +349,31 @@ DOCUMENTATION :: END   % endif - % if data['rating_key']: - % if data['media_type'] == 'episode': + % if data['channel_stream'] == '0': + % if data['media_type'] == 'movie': + ${data['title']} + % elif data['media_type'] == 'episode': ${data['grandparent_title']} - ${data['title']} - % elif data['media_type'] == 'movie': - ${data['title']} - % elif data['media_type'] == 'clip': - ${data['title']} % elif data['media_type'] == 'track': ${data['grandparent_title']} - ${data['title']} % elif data['media_type'] == 'photo': ${data['parent_title']} + % elif data['media_type'] == 'clip': + ${data['title']} % else: ${data['title']} % endif + % elif data['media_type'] == 'episode': + ${data['channel_title']} + - ${data['title']} % else: - ${data['title']} + ${data['title']} % endif