<%doc> USAGE DOCUMENTATION :: PLEASE LEAVE THIS AT THE TOP OF THIS FILE For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/ Filename: current_activity_instance.html Version: 0.1 Variable names: data {dict} data :: Usable parameters == Global keys == session_key Returns a unique session id for the active stream rating_key Returns the unique identifier for the media item. media_index Returns the index of the media item. parent_media_index Returns the index of the media item's parent. media_type Returns the type of session. Either 'track', 'episode' or 'movie'. thumb Returns the location of the item's thumbnail. Use with pms_image_proxy. bif_thumb Returns the location of the item's bif thumbnail. Use with pms_image_proxy. art Returns the location of the item's artwork progress_percent Returns the current progress of the item. 0 to 100. user Returns the name of the user owning the session. user_id Returns the Plex user id if available. machine_id Returns the machine id of the players being used. friendly_name Returns the friendlly name of the user owning the session. user_thumb Returns the profile picture of the user owning the session. state Returns the state of the current session. Either 'playing', 'paused' or 'buffering'. title Returns the name of the episode, movie or music track. year Returns the year of the episode, movie, or clip. ip_address Returns the ip address of the stream. player Returns the name of the platform used to play the stream. platform Returns the type of platform used to play the stream. transcode_throttled Returns true if the transcode session is throttled. transcode_progress Returns the current transcode progress of the item. 0 to 100. transcode_speed Returns the current transcode speed of the item. audio_decision Returns the audio transcode decision. Either 'transcode', 'copy' or 'direct play'. audio_codec Returns the name of the audio codec. audio_channels Returns the number of audio channels. grandparent_title Returns the title of the item's grandparent. parent_title Returns the title of the item's parent. video_decision Returns the video transcode decision. Either 'transcode', 'copy' or 'direct play'. video_codec Returns the name of the video codec. height Returns the value of the video height. width Returns the value of the video width. container Returns the value of the media container. bitrate Returns the value of the media bitrate. video_resolution Returns the value of the video resolution. video_framerate Returns the value of the video framerate. video_aspect_ratio Returns the value of the video aspect ratio. transcode_audio_channels Returns the amount of audio channels if there is a transcode session. transcode_audio_codec Returns the name of the audio codec if there is a transcode session. transcode_video_codec Returns the name of the video codec if there is a transcode session. transcode_width Returns the video width if there is a transcode session. transcode_height Returns the video height if there is a transcode session. transcode_container Returns the value of media container if there is a transcode session. transcode_protocol Returns the value of media protocol if there is a transcode session. indexes Returns true if the media has media indexes and are enabled DOCUMENTATION :: END % if session is not None: <% from collections import defaultdict from urllib import quote from plexpy import helpers from plexpy.common import VIDEO_RESOLUTION_OVERRIDES, AUDIO_CODEC_OVERRIDES, EXTRA_TYPES import plexpy %> <% data = defaultdict(lambda: 'Unknown', **session) sk = data['session_key'] href = 'info?rating_key={}'.format(data['rating_key']) if data['rating_key'] else '#' parent_href = 'info?rating_key={}'.format(data['parent_rating_key']) if data['parent_rating_key'] else '#' grandparent_href = 'info?rating_key={}'.format(data['grandparent_rating_key']) if data['grandparent_rating_key'] else '#' user_href = 'user?user_id={}'.format(data['user_id']) if data['user_id'] else '#' %>
<% if data['live'] == 1: background_url = 'images/art-live.png' elif data['channel_stream'] == 0: background_url = 'pms_image_proxy?img=' + data['art'] + '&width=500&height=280&opacity=40&background=282828&blur=3&fallback=art&refresh=true' else: if (data['art'] and data['art'].startswith('http')) or (data['thumb'] and data['thumb'].startswith('http')): background_url = data['art'] else: background_url = 'pms_image_proxy?img=' + quote(data['art'] or data['thumb']) + '&width=500&height=280&fallback=art&refresh=true&clip=true' %>
% if data['media_type'] == 'track':
% endif % if data['live'] == 1:
% elif 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'): % if data['extra_type']:
% else:
% endif % else:
% endif % else: % if data['channel_icon'].startswith('http'):
% else:
% endif % endif
<% if not _session['user_group'] == 'admin' or not data['session_id']: no_terminate = '-no-terminate' else: no_terminate = '' %>
% if _session['user_group'] == 'admin' and plexpy.CONFIG.PMS_PLEXPASS and data['session_id']:
% endif

- Product
  ${data['product']}
- Player
  ${data['player']}
- Quality
  % if data['media_type'] != 'photo' and data['quality_profile'] != 'Unknown': <% br = helpers.cast_to_int(data['stream_bitrate']) or '' if br: if br > 1000: br = '(' + str(round(br / 1000.0, 1)) + ' Mbps)' else: br = '(' + str(br) + ' kbps)' %> ${data['quality_profile']} ${br} % else: ${data['quality_profile']} % endif
% if data['optimized_version'] == 1:
- Optimized
  ${data['optimized_version_profile']} (${data['optimized_version_title']})
% endif % if data['synced_version'] == 1:
- Synced
  ${data['synced_version_profile']}
% endif

- % if _session['user_group'] == 'admin':
  Stream
  % else:
  Stream
  % endif
  % if data['transcode_decision'] == 'transcode': Transcode % if data['transcode_throttled'] == 1: (Throttled) % else: (Speed: ${data['transcode_speed']}) % endif % elif data['transcode_decision'] == 'copy': Direct Stream % else: Direct Play % endif
- Container
  % if data['stream_container_decision'] == 'transcode': Transcode (${data['container'].upper()} ${data['stream_container'].upper()}) % else: Direct Play (${data['container'].upper()}) % endif
% if data['media_type'] in ('movie', 'episode', 'clip', 'photo'):
- Video
  % if data['media_type'] in ('movie', 'episode', 'clip'): % if data['stream_video_decision'] == 'transcode': <% hw_d = ' (HW)' if data['transcode_hw_decoding'] else '' hw_e = ' (HW)' if data['transcode_hw_encoding'] else '' %> Transcode (${data['video_codec'].upper()}${hw_d} ${VIDEO_RESOLUTION_OVERRIDES.get(data['video_resolution'], data['video_resolution'])} ${data['stream_video_codec'].upper()}${hw_e} ${VIDEO_RESOLUTION_OVERRIDES.get(data['stream_video_resolution'], data['stream_video_resolution'])}) % elif data['stream_video_decision'] == 'copy': Direct Stream (${data['stream_video_codec'].upper()} ${VIDEO_RESOLUTION_OVERRIDES.get(data['stream_video_resolution'], data['stream_video_resolution'])}) % else: Direct Play (${data['video_codec'].upper()} ${VIDEO_RESOLUTION_OVERRIDES.get(data['video_resolution'], data['video_resolution'])}) % endif % elif data['media_type'] == 'photo': Direct Play (${data['width']}x${data['height']}) % endif
% endif % if data['media_type'] in ('movie', 'episode', 'clip', 'track'):
- Audio
  % if data['stream_audio_decision'] == 'transcode': Transcode (${AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout'].split('(')[0].capitalize()} ${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': Direct Stream (${AUDIO_CODEC_OVERRIDES.get(data['stream_audio_codec'], data['stream_audio_codec'].upper())} ${data['stream_audio_channel_layout'].split('(')[0].capitalize()}) % else: Direct Play (${AUDIO_CODEC_OVERRIDES.get(data['audio_codec'], data['audio_codec'].upper())} ${data['audio_channel_layout'].split('(')[0].capitalize()}) % endif
% endif % if data['media_type'] in ('movie', 'episode', 'clip'):
- Subtitle
  % if data['subtitles'] == 1: % if data['stream_subtitle_decision'] == 'transcode': Transcode (${data['subtitle_codec'].upper()} ${data['stream_subtitle_codec'].upper()}) % elif data['stream_subtitle_decision'] == 'copy': Direct Stream (${data['subtitle_codec'].upper()}) % elif data['stream_subtitle_decision'] == 'burn': Burn (${data['subtitle_codec'].upper()}) % else: Direct Play (${data['stream_subtitle_codec'].upper() if data['synced_version'] else data['subtitle_codec'].upper()}) % endif % else: None % endif
% endif

- Location
  % if data['secure'] is not None: % if data['secure']: % else: % endif % endif ${data['location'].upper()}: % if data['ip_address'] != 'N/A': ${data['ip_address']} % if data['relayed']: % else:
  % endif % else: N/A % endif
- Bandwidth
  % if data['media_type'] != 'photo' and data['bandwidth'] != 'Unknown': <% bw = helpers.cast_to_int(data['bandwidth']) if bw > 1000: bw = str(round(bw / 1000.0, 1)) + ' Mbps' else: bw = str(bw) + ' kbps' %> ${bw} % elif data['synced_version'] == 1 or data['channel_stream'] == 1: None % else: Unknown % endif

% if data['media_type'] != 'photo':
% if data['live'] == 1:
Live % elif data['view_offset']: ETA:
/
% else: ETA: Unknown
0:00 /
% endif
% endif
% if data['live'] == 1:
Live
% else:
${data['transcode_progress']}%
${data['progress_percent']}%
% endif
% if data['state'] == 'playing': % elif data['state'] == 'paused': % elif data['state'] == 'buffering': % endif
% 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'] == 'track': ${data['title']} - ${data['original_title'] or data['grandparent_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' and data['grandparent_title']: ${data['grandparent_title']} - ${data['title']} % else: ${data['title']} % endif
% if data['live'] == 1:
% elif data['channel_stream'] == 0:
% if data['media_type'] == 'movie': % elif data['media_type'] == 'episode': % elif data['media_type'] == 'track': % elif data['media_type'] == 'photo': % elif data['media_type'] == 'clip': % endif
% else:
% endif
% if data['live'] == 1: Plex Live TV % elif data['channel_stream'] == 0: % if data['media_type'] == 'movie': ${data['year']} % elif data['media_type'] == 'episode': S${data['parent_media_index']} · E${data['media_index']} % elif data['media_type'] == 'track': ${data['parent_title']} % elif data['media_type'] == 'photo': ${data['title']} % else: % if data['extra_type']: <% extra_type = EXTRA_TYPES.get(data['extra_type'], data['sub_type'].capitalize()) %> ${data['year']} (${extra_type}) % else: ${data['year']} % endif % endif % elif data['channel_title']: ${data['channel_title']} % if data['media_type'] == 'episode' and data['parent_media_index'] and data['media_index']: (S${data['parent_media_index']} · E${data['media_index']}) % elif data['media_type'] == 'episode' and data['originally_available_at']: (${data['originally_available_at']}) % endif % else: Channel % if data['media_type'] == 'episode' and data['parent_media_index'] and data['media_index']: (S${data['parent_media_index']} · E${data['media_index']}) % elif data['media_type'] == 'episode' and data['originally_available_at']: (${data['originally_available_at']}) % endif % endif
${data['friendly_name']}
% endif