Check use bif setting

This commit is contained in:
JonnyWong16 2017-02-28 20:58:59 -08:00
parent 9fee0d711a
commit 914e3a3988
3 changed files with 126 additions and 128 deletions

View file

@ -62,147 +62,145 @@ DOCUMENTATION :: END
% if data is not None: % if data is not None:
<% <%
from urllib import quote from urllib import quote
import plexpy
from plexpy import helpers
data['indexes'] = helpers.cast_to_int(data['indexes'])
%> %>
<div class="dashboard-instance" id="instance-${data['session_key']}" data-id="${data['session_key']}"> <div class="dashboard-instance" id="instance-${data['session_key']}" data-id="${data['session_key']}">
<div class="dashboard-hover-container"> <div class="dashboard-hover-container">
% if (data['media_type'] == 'movie' or data['media_type'] == 'episode' or data['media_type'] == 'track') and data['rating_key']: % if (data['media_type'] == 'movie' or data['media_type'] == 'episode' or data['media_type'] == 'track') and data['rating_key']:
<a href="info?rating_key=${data['rating_key']}"> <a href="info?rating_key=${data['rating_key']}">
% else: % else:
<a href="#"> <a href="#">
% endif % endif
<div class="dashboard-activity-poster" id="poster-${data['session_key']}"> <div class="dashboard-activity-poster" id="poster-${data['session_key']}">
% if not data['art'].startswith('interfaces') or not data['thumb'].startswith('interfaces'): % if not data['art'].startswith('interfaces') or not data['thumb'].startswith('interfaces'):
% if (data['media_type'] == 'movie' and not data['indexes']) or (data['indexes'] and not data['view_offset']): % if (data['media_type'] == 'movie' and not plexpy.CONFIG.PMS_USE_BIF) or (plexpy.CONFIG.PMS_USE_BIF and not data['view_offset']):
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['art']}&width=500&height=280&fallback=art);"></div> <div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['art']}&width=500&height=280&fallback=art);"></div>
% elif (data['media_type'] == 'episode' and not data['indexes']) or (data['indexes'] and not data['view_offset']): % elif (data['media_type'] == 'episode' and not plexpy.CONFIG.PMS_USE_BIF) or (plexpy.CONFIG.PMS_USE_BIF and not data['view_offset']):
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['art']}&width=500&height=280&fallback=art);"></div> <div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['art']}&width=500&height=280&fallback=art);"></div>
% elif data['indexes']: % elif plexpy.CONFIG.PMS_USE_BIF:
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['bif_thumb']}&width=500&height=280&fallback=art); display: none;"></div> <div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['bif_thumb']}&width=500&height=280&fallback=art); display: none;"></div>
% else:
% if data['media_type'] == 'track':
<div class="dashboard-activity-cover-face-bg" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
<div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
% elif data['media_type'] == 'clip':
% if data['art'].startswith('http'):
<div class="dashboard-activity-poster-face" style="background-image: url(${data['art']});"></div>
% elif data['thumb'].startswith('http'):
<div class="dashboard-activity-poster-face" style="background-image: url(${data['thumb']});"></div>
% else:
% if data['art']:
<!--Hacky solution to escape the image url until I come up with something better-->
<div class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${quote(data['art'])}&width=500&height=280&fallback=art&clip=true);"></div>
% else:
<!--Hacky solution to escape the image url until I come up with something better-->
<div class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${quote(data['thumb'])}&width=500&height=280&fallback=art&clip=true);"></div>
% endif
% endif
% elif data['media_type'] == 'photo':
<div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=500&height=500&fallback=cover);"></div>
% else:
<div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
% endif
% endif
% else: % else:
<div class="dashboard-activity-poster-face" style="background-image: url(${data['art']});"></div> % if data['media_type'] == 'track':
% endif <div class="dashboard-activity-cover-face-bg" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
% if _session['user_group'] == 'admin': <div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
<span class="overlay-refresh-image left" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> % elif data['media_type'] == 'clip':
% endif % if data['art'].startswith('http'):
<div class="dashboard-activity-button-info"> <div class="dashboard-activity-poster-face" style="background-image: url(${data['art']});"></div>
<button type="button" class="btn btn-activity-info btn-lg" data-target="#stream-${data['session_key']}" data-id="${data['session_key']}"> % elif data['thumb'].startswith('http'):
<i class="fa fa-info-circle"></i> <div class="dashboard-activity-poster-face" style="background-image: url(${data['thumb']});"></div>
</button> % else:
</div> % if data['art']:
<div id="stream-${data['session_key']}" class="dashboard-activity-info-details-overlay"> <!--Hacky solution to escape the image url until I come up with something better-->
<div class="dashboard-activity-info-details-content"> <div class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${quote(data['art'])}&width=500&height=280&fallback=art&clip=true);"></div>
<div id="platform-${data['session_key']}" title="${data['platform']}">
<script>
$("#platform-${data['session_key']}").html("<div class='dashboard-activity-info-platform-box' style='background-image: url(" + getPlatformImagePath('${data['platform']}') + ");'>");
</script>
</div>
<div class="dashboard-activity-info-platform">
<strong>${data['player']}</strong><br />
<span id="overlay-play-state-${data['session_key']}">
% if data['state'] == 'playing':
State &nbsp;<strong>Playing</strong>
% elif data['state'] == 'paused':
State &nbsp;<strong>Paused</strong>
% elif data['state'] == 'buffering':
State &nbsp;<strong>Buffering</strong>
% endif
</span>
</div>
<span id="transcode-state-${data['session_key']}">
% if data['video_decision'] == 'transcode' or data['audio_decision'] == 'transcode':
Stream &nbsp;<strong>Transcode (Speed: ${data['transcode_speed']})
% if data['transcode_throttled'] == '1':
(Throttled)
% endif
</strong>
% elif data['video_decision'] == 'copy' or data['audio_decision'] == 'copy':
Stream &nbsp;<strong>Direct Stream</strong>
% else: % else:
Stream &nbsp;<strong>Direct Play</strong> <!--Hacky solution to escape the image url until I come up with something better-->
<div class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${quote(data['thumb'])}&width=500&height=280&fallback=art&clip=true);"></div>
% endif % endif
<br /> % endif
% if data['media_type'] in ('movie', 'episode', 'clip'): % elif data['media_type'] == 'photo':
% if data['video_decision'] == 'transcode': <div id="bif-${data['session_key']}" class="dashboard-activity-poster-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=500&height=500&fallback=cover);"></div>
Video &nbsp;<strong>Transcode (${data['transcode_video_codec']}) (${data['transcode_width']}x${data['transcode_height']})</strong> % else:
% elif data['video_decision'] == 'copy': <div class="dashboard-activity-cover-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&width=300&height=300&fallback=cover);"></div>
Video &nbsp;<strong>Direct Stream (${data['transcode_video_codec']}) (${data['width']}x${data['height']})</strong> % endif
% else: % endif
Video &nbsp;<strong>Direct Play (${data['video_codec']}) (${data['width']}x${data['height']})</strong> % else:
% endif <div class="dashboard-activity-poster-face" style="background-image: url(${data['art']});"></div>
<br /> % endif
% endif % if _session['user_group'] == 'admin':
% if data['media_type'] in ('movie', 'episode', 'clip', 'track'): <span class="overlay-refresh-image left" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% if data['audio_decision'] == 'transcode': % endif
Audio &nbsp;<strong>Transcode (${data['transcode_audio_codec']}) (${data['transcode_audio_channels']}ch)</strong> <div class="dashboard-activity-button-info">
% elif data['audio_decision'] == 'copy': <button type="button" class="btn btn-activity-info btn-lg" data-target="#stream-${data['session_key']}" data-id="${data['session_key']}">
Audio &nbsp;<strong>Direct Stream (${data['transcode_audio_codec']}) (${data['transcode_audio_channels']}ch)</strong> <i class="fa fa-info-circle"></i>
% else: </button>
Audio &nbsp;<strong>Direct Play (${data['audio_codec']}) (${data['audio_channels']}ch)</strong> </div>
% endif <div id="stream-${data['session_key']}" class="dashboard-activity-info-details-overlay">
<div class="dashboard-activity-info-details-content">
<div id="platform-${data['session_key']}" title="${data['platform']}">
<script>
$("#platform-${data['session_key']}").html("<div class='dashboard-activity-info-platform-box' style='background-image: url(" + getPlatformImagePath('${data['platform']}') + ");'>");
</script>
</div>
<div class="dashboard-activity-info-platform">
<strong>${data['player']}</strong><br />
<span id="overlay-play-state-${data['session_key']}">
% if data['state'] == 'playing':
State &nbsp;<strong>Playing</strong>
% elif data['state'] == 'paused':
State &nbsp;<strong>Paused</strong>
% elif data['state'] == 'buffering':
State &nbsp;<strong>Buffering</strong>
% endif % endif
</span> </span>
</div> </div>
</div> <span id="transcode-state-${data['session_key']}">
% if data['media_type'] != 'photo': % if data['video_decision'] == 'transcode' or data['audio_decision'] == 'transcode':
<div class="dashboard-activity-poster-info-bar"> Stream &nbsp;<strong>Transcode (Speed: ${data['transcode_speed']})
<div class="dashboard-activity-poster-info-ip-address"> % if data['transcode_throttled'] == '1':
% if data['ip_address']: (Throttled)
<span>IP: ${data['ip_address']}</span> % endif
</strong>
% elif data['video_decision'] == 'copy' or data['audio_decision'] == 'copy':
Stream &nbsp;<strong>Direct Stream</strong>
% else: % else:
<span>IP: N/A</span> Stream &nbsp;<strong>Direct Play</strong>
% endif % endif
<br /> <br />
ETA: % if data['media_type'] in ('movie', 'episode', 'clip'):
<span id="stream-eta-${data['session_key']}"> % if data['video_decision'] == 'transcode':
<script> Video &nbsp;<strong>Transcode (${data['transcode_video_codec']}) (${data['transcode_width']}x${data['transcode_height']})</strong>
$("#stream-eta-${data['session_key']}").html(moment().add(parseInt("${data['duration']}") - parseInt("${data['view_offset']}"), 'milliseconds').format(time_format)); % elif data['video_decision'] == 'copy':
</script> Video &nbsp;<strong>Direct Stream (${data['transcode_video_codec']}) (${data['width']}x${data['height']})</strong>
</span> % else:
</div> Video &nbsp;<strong>Direct Play (${data['video_codec']}) (${data['width']}x${data['height']})</strong>
<div class="dashboard-activity-poster-info-time"> % endif
<span class="progress_time" id="stream-view-offset-${data['session_key']}"> <br />
<script> % endif
$("#stream-view-offset-${data['session_key']}").html(millisecondsToMinutes(parseInt("${data['view_offset']}"), false)); % if data['media_type'] in ('movie', 'episode', 'clip', 'track'):
</script> % if data['audio_decision'] == 'transcode':
</span>/<span class="progress_time" id="stream-duration-${data['session_key']}"> Audio &nbsp;<strong>Transcode (${data['transcode_audio_codec']}) (${data['transcode_audio_channels']}ch)</strong>
<script> % elif data['audio_decision'] == 'copy':
$("#stream-duration-${data['session_key']}").html(millisecondsToMinutes(parseInt("${data['duration']}"), false)); Audio &nbsp;<strong>Direct Stream (${data['transcode_audio_codec']}) (${data['transcode_audio_channels']}ch)</strong>
</script> % else:
</span> Audio &nbsp;<strong>Direct Play (${data['audio_codec']}) (${data['audio_channels']}ch)</strong>
</div> % endif
% endif
</span>
</div> </div>
% endif
</div> </div>
% if (data['media_type'] == 'movie' or data['media_type'] == 'episode' or data['media_type'] == 'track') and data['rating_key']: % if data['media_type'] != 'photo':
</a> <div class="dashboard-activity-poster-info-bar">
% else: <div class="dashboard-activity-poster-info-ip-address">
% if data['ip_address']:
<span>IP: ${data['ip_address']}</span>
% else:
<span>IP: N/A</span>
% endif
<br />
ETA:
<span id="stream-eta-${data['session_key']}">
<script>
$("#stream-eta-${data['session_key']}").html(moment().add(parseInt("${data['duration']}") - parseInt("${data['view_offset']}"), 'milliseconds').format(time_format));
</script>
</span>
</div>
<div class="dashboard-activity-poster-info-time">
<span class="progress_time" id="stream-view-offset-${data['session_key']}">
<script>
$("#stream-view-offset-${data['session_key']}").html(millisecondsToMinutes(parseInt("${data['view_offset']}"), false));
</script>
</span>/<span class="progress_time" id="stream-duration-${data['session_key']}">
<script>
$("#stream-duration-${data['session_key']}").html(millisecondsToMinutes(parseInt("${data['duration']}"), false));
</script>
</span>
</div>
</div>
% endif
</div>
% if (data['media_type'] == 'movie' or data['media_type'] == 'episode' or data['media_type'] == 'track') and data['rating_key']:
</a>
% else:
</a> </a>
% endif % endif
<div class="dashboard-activity-progress"> <div class="dashboard-activity-progress">

View file

@ -181,6 +181,7 @@
$('#overlay-play-state-' + key).html(overlay_state); $('#overlay-play-state-' + key).html(overlay_state);
$('#play-state-' + key).html(state_icon); $('#play-state-' + key).html(state_icon);
% if config['pms_use_bif']:
// if using bif indexes, update the bif thumbnail // if using bif indexes, update the bif thumbnail
if (s.indexes) { if (s.indexes) {
var bif_poster = $('#bif-' + key); var bif_poster = $('#bif-' + key);
@ -189,6 +190,7 @@
+ s.bif_thumb + '&width=500&height=280&fallback=art);"></div>').fadeIn(1000, function () { bif_poster.remove() })); + s.bif_thumb + '&width=500&height=280&fallback=art);"></div>').fadeIn(1000, function () { bif_poster.remove() }));
blurArtwork(key); blurArtwork(key);
} }
% endif
// if transcoding, update the transcode state // if transcoding, update the transcode state
var ts = ''; var ts = '';

View file

@ -172,10 +172,8 @@ class WebInterface(object):
config = { config = {
"home_sections": plexpy.CONFIG.HOME_SECTIONS, "home_sections": plexpy.CONFIG.HOME_SECTIONS,
"home_stats_length": plexpy.CONFIG.HOME_STATS_LENGTH, "home_stats_length": plexpy.CONFIG.HOME_STATS_LENGTH,
"home_stats_cards": plexpy.CONFIG.HOME_STATS_CARDS,
"home_library_cards": plexpy.CONFIG.HOME_LIBRARY_CARDS,
"pms_identifier": plexpy.CONFIG.PMS_IDENTIFIER,
"pms_name": plexpy.CONFIG.PMS_NAME, "pms_name": plexpy.CONFIG.PMS_NAME,
"pms_use_bif": plexpy.CONFIG.PMS_USE_BIF,
"update_show_changelog": plexpy.CONFIG.UPDATE_SHOW_CHANGELOG "update_show_changelog": plexpy.CONFIG.UPDATE_SHOW_CHANGELOG
} }
return serve_template(templatename="index.html", title="Home", config=config) return serve_template(templatename="index.html", title="Home", config=config)