Update pms_image_proxy with helper function and encode URL params

This commit is contained in:
JonnyWong16 2020-02-19 19:57:56 -08:00
parent 3932409fb4
commit d752d46676
14 changed files with 136 additions and 64 deletions

View file

@ -62,7 +62,7 @@ DOCUMENTATION :: END
% if session is not None: % if session is not None:
<% <%
from collections import defaultdict from collections import defaultdict
from plexpy import helpers from plexpy.helpers import cast_to_int, pms_image_proxy
from plexpy.common import VIDEO_RESOLUTION_OVERRIDES, AUDIO_CODEC_OVERRIDES, EXTRA_TYPES from plexpy.common import VIDEO_RESOLUTION_OVERRIDES, AUDIO_CODEC_OVERRIDES, EXTRA_TYPES
import plexpy import plexpy
%> %>
@ -80,56 +80,56 @@ DOCUMENTATION :: END
<div class="dashboard-activity-container"> <div class="dashboard-activity-container">
<% <%
if data['live']: if data['live']:
background_url = 'pms_image_proxy?img=' + data['art'] + '&rating_key=' + data['rating_key'] + '&width=500&height=280&opacity=40&background=282828&blur=3&fallback=art-live&refresh=true' background_url = pms_image_proxy(data['art'], data['rating_key'], 500, 280, 40, '282828', 3, fallback='art-live', refresh=True)
elif data['channel_stream'] == 0: elif data['channel_stream'] == 0:
background_url = 'pms_image_proxy?img=' + data['art'] + '&rating_key=' + data['rating_key'] + '&width=500&height=280&opacity=40&background=282828&blur=3&fallback=art&refresh=true' background_url = pms_image_proxy(data['art'], data['rating_key'], 500, 280, 40, '282828', 3, fallback='art', refresh=True)
else: else:
background_url = 'pms_image_proxy?img=' + (data['art'] or data['thumb']) + '&rating_key=' + data['rating_key'] + '&width=500&height=280&fallback=art&refresh=true&clip=true' background_url = pms_image_proxy(data['art'] or data['thumb'], data['rating_key'], 500, 280, 40, '282828', 3, fallback='art', refresh=True, clip=True)
%> %>
<div id="background-${sk}" class="dashboard-activity-background" style="background-image: url(${background_url});"> <div id="background-${sk}" class="dashboard-activity-background" style="background-image: url(${background_url});">
<div class="dashboard-activity-poster-container hidden-xs"> <div class="dashboard-activity-poster-container hidden-xs">
% if data['media_type'] == 'track': % if data['media_type'] == 'track':
<div id="poster-${sk}-bg" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['parent_thumb']}&rating_key=${data['parent_rating_key']}&width=300&height=300&opacity=60&background=282828&blur=3&fallback=cover&refresh=true);"></div> <div id="poster-${sk}-bg" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['parent_thumb'], data['parent_rating_key'], 300, 300, 60, '282828', 3, fallback='cover', refresh=True)});"></div>
% endif % endif
% if data['live']: % if data['live']:
% if data['media_type'] == 'movie': % if data['media_type'] == 'movie':
<a id="poster-url-${sk}" href="${href}" title="${data['title']}"> <a id="poster-url-${sk}" href="${href}" title="${data['title']}">
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['thumb']}&rating_key=${data['rating_key']}&width=300&height=450&fallback=poster-live&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['thumb'], data['rating_key'], 300, 450, fallback='poster-live', refresh=True)});"></div>
</a> </a>
% elif data['media_type'] == 'episode': % elif data['media_type'] == 'episode':
<a id="poster-url-${sk}" href="${href}" title="${data['grandparent_title']}"> <a id="poster-url-${sk}" href="${href}" title="${data['grandparent_title']}">
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['grandparent_thumb']}&rating_key=${data['rating_key']}&width=300&height=450&fallback=poster-live&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['grandparent_thumb'], data['rating_key'], 300, 450, fallback='poster-live', refresh=True)});"></div>
</a> </a>
% else: % else:
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['grandparent_thumb'] or data['thumb']}&rating_key=${data['rating_key']}&width=300&height=450&fallback=poster-live&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['grandparent_thumb'] or data['thumb'], data['rating_key'], 300, 450, fallback='poster-live', refresh=True)});"></div>
% endif % endif
% elif data['channel_stream'] == 0: % elif data['channel_stream'] == 0:
% if data['media_type'] == 'movie': % if data['media_type'] == 'movie':
<a id="poster-url-${sk}" href="${href}" title="${data['title']}"> <a id="poster-url-${sk}" href="${href}" title="${data['title']}">
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['thumb']}&rating_key=${data['rating_key']}&width=300&height=450&fallback=poster&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['thumb'], data['rating_key'], 300, 450, fallback='poster', refresh=True)});"></div>
</a> </a>
% elif data['media_type'] == 'episode': % elif data['media_type'] == 'episode':
<a id="poster-url-${sk}" href="${grandparent_href}" title="${data['grandparent_title']}"> <a id="poster-url-${sk}" href="${grandparent_href}" title="${data['grandparent_title']}">
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['grandparent_thumb']}&rating_key=${data['grandparent_rating_key']}&width=300&height=450&fallback=poster&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['grandparent_thumb'], data['grandparent_rating_key'], 300, 450, fallback='poster', refresh=True)});"></div>
</a> </a>
% elif data['media_type'] == 'track': % elif data['media_type'] == 'track':
<a id="poster-url-${sk}" href="${parent_href}" title="${data['parent_title']}"> <a id="poster-url-${sk}" href="${parent_href}" title="${data['parent_title']}">
<div id="poster-${sk}" class="dashboard-activity-cover" style="background-image: url(pms_image_proxy?img=${data['parent_thumb']}&rating_key=${data['parent_rating_key']}&width=300&height=300&fallback=cover&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-cover" style="background-image: url(${pms_image_proxy(data['parent_thumb'], data['parent_rating_key'], 300, 300, fallback='cover', refresh=True)});"></div>
</a> </a>
% elif data['media_type'] in ('photo', 'clip'): % elif data['media_type'] in ('photo', 'clip'):
% if data['extra_type']: % if data['extra_type']:
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['art'].replace('/art', '/thumb') or data['thumb']}&rating_key=${data['rating_key']}&width=300&height=450&fallback=poster&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['art'].replace('/art', '/thumb') or data['thumb'], data['rating_key'], 300, 450, fallback='poster', refresh=True)});"></div>
% elif data['parent_thumb']: % elif data['parent_thumb']:
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['parent_thumb']}&rating_key=${data['parent_rating_key']}&width=300&height=450&fallback=poster&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['parent_thumb'], data['parent_rating_key'], 300, 450, fallback='poster', refresh=True)});"></div>
% else: % else:
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['thumb']}&rating_key=${data['rating_key']}&width=300&height=450&fallback=poster&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['thumb'], data['rating_key'], 300, 450, fallback='poster', refresh=True)});"></div>
% endif % endif
% else: % else:
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(images/poster.png);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(images/poster.png);"></div>
% endif % endif
% else: % else:
<div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(pms_image_proxy?img=${data['channel_icon']}&rating_key=${data['rating_key']}&width=300&height=300&opacity=60&background=282828&blur=3&fallback=cover&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-poster" style="background-image: url(${pms_image_proxy(data['channel_icon'], data['rating_key'], 300, 300, 60, '282828', 3, fallback='cover', refresh=True)});"></div>
<div id="poster-${sk}" class="dashboard-activity-cover" style="background-image: url(pms_image_proxy?img=${data['channel_icon']}&rating_key=${data['rating_key']}&width=300&height=300&fallback=cover&refresh=true);"></div> <div id="poster-${sk}" class="dashboard-activity-cover" style="background-image: url(${pms_image_proxy(data['channel_icon'], data['rating_key'], 300, 300, fallback='cover', refresh=True)});"></div>
% endif % endif
</div> </div>
<div class="dashboard-activity-info-icon"> <div class="dashboard-activity-info-icon">
@ -163,7 +163,7 @@ DOCUMENTATION :: END
<div class="sub-value platform-right" id="stream_quality-${sk}"> <div class="sub-value platform-right" id="stream_quality-${sk}">
% if data['media_type'] != 'photo' and data['quality_profile'] != 'Unknown': % if data['media_type'] != 'photo' and data['quality_profile'] != 'Unknown':
<% <%
br = helpers.cast_to_int(data['stream_bitrate']) or '' br = cast_to_int(data['stream_bitrate']) or ''
if br: if br:
if br > 1000: if br > 1000:
br = '(' + str(round(br / 1000.0, 1)) + ' Mbps)' br = '(' + str(round(br / 1000.0, 1)) + ' Mbps)'
@ -329,7 +329,7 @@ DOCUMENTATION :: END
<div class="sub-value time-right"> <div class="sub-value time-right">
% if data['media_type'] != 'photo' and data['bandwidth'] != 'Unknown': % if data['media_type'] != 'photo' and data['bandwidth'] != 'Unknown':
<% <%
bw = helpers.cast_to_int(data['bandwidth']) bw = cast_to_int(data['bandwidth'])
if bw > 1000000: if bw > 1000000:
bw = str(round(bw / 1000000.0, 1)) + ' Gbps' bw = str(round(bw / 1000000.0, 1)) + ' Gbps'
elif bw > 1000: elif bw > 1000:

View file

@ -53,11 +53,11 @@ DOCUMENTATION :: END
</%doc> </%doc>
<%! <%!
from plexpy import helpers from plexpy.helpers import cast_to_int, pms_image_proxy
# Human readable duration # Human readable duration
def hd(seconds): def hd(seconds):
m, s = divmod(helpers.cast_to_int(seconds), 60) m, s = divmod(cast_to_int(seconds), 60)
h, m = divmod(m, 60) h, m = divmod(m, 60)
return str(h).zfill(1) + ':' + str(m).zfill(2) return str(h).zfill(1) + ':' + str(m).zfill(2)
%> %>
@ -73,7 +73,7 @@ DOCUMENTATION :: END
<div class="dashboard-stats-container"> <div class="dashboard-stats-container">
% if stat_id in ('top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music', 'popular_music', 'last_watched'): % if stat_id in ('top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music', 'popular_music', 'last_watched'):
<% fallback = 'art-live' if row0['live'] else 'art' %> <% fallback = 'art-live' if row0['live'] else 'art' %>
<div id="stats-background-${stat_id}" class="dashboard-stats-background" style="background-image: url(pms_image_proxy?img=${row0['art']}&rating_key=${row0['rating_key']}&width=500&height=280&opacity=40&background=282828&blur=3&fallback=${fallback});"> <div id="stats-background-${stat_id}" class="dashboard-stats-background" style="background-image: url(${pms_image_proxy(row0['art'], row0['rating_key'], 500, 280, 40, '282828', 3, fallback=fallback)});">
% elif stat_id == 'top_platforms': % elif stat_id == 'top_platforms':
<div id="stats-background-${stat_id}" class="dashboard-stats-background platform-${row0['platform_name']}-rgba no-image"> <div id="stats-background-${stat_id}" class="dashboard-stats-background platform-${row0['platform_name']}-rgba no-image">
% else: % else:
@ -82,7 +82,7 @@ DOCUMENTATION :: END
% if stat_id in ('top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music', 'popular_music', 'last_watched'): % if stat_id in ('top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music', 'popular_music', 'last_watched'):
<div class="dashboard-stats-poster-container hidden-xs"> <div class="dashboard-stats-poster-container hidden-xs">
% if stat_id in ('top_music', 'popular_music'): % if stat_id in ('top_music', 'popular_music'):
<div id="stats-thumb-${stat_id}-bg" class="dashboard-stats-poster" style="background-image: url(pms_image_proxy?img=${row0['thumb']}&rating_key=${row0['rating_key']}&width=300&height=300&opacity=60&background=282828&blur=3&fallback=cover);"></div> <div id="stats-thumb-${stat_id}-bg" class="dashboard-stats-poster" style="background-image: url(${pms_image_proxy(row0['thumb'], row0['rating_key'], 300, 300, 60, '282828', 3, fallback='cover')});"></div>
% endif % endif
<% <%
height, fallback = ('450', 'poster') height, fallback = ('450', 'poster')
@ -98,7 +98,7 @@ DOCUMENTATION :: END
href += '&source=history' href += '&source=history'
%> %>
<a id="stats-thumb-url-${stat_id}" href="${href}" title="${row0['title']}"> <a id="stats-thumb-url-${stat_id}" href="${href}" title="${row0['title']}">
<div id="stats-thumb-${stat_id}" class="dashboard-stats-${fallback.split('-')[0]}" style="background-image: url(pms_image_proxy?img=${row0['thumb']}&rating_key=${row0['rating_key']}&width=300&height=${height}&fallback=${fallback});"></div> <div id="stats-thumb-${stat_id}" class="dashboard-stats-${fallback.split('-')[0]}" style="background-image: url(${pms_image_proxy(row0['thumb'], row0['rating_key'], 300, height, fallback=fallback)});"></div>
</a> </a>
</div> </div>
% elif stat_id == 'top_users': % elif stat_id == 'top_users':
@ -222,9 +222,9 @@ DOCUMENTATION :: END
} }
} }
$('#stats-thumb-url-' + stat_id).attr('href', href).prop('title', $(elem).data('title')); $('#stats-thumb-url-' + stat_id).attr('href', href).prop('title', $(elem).data('title'));
$('#stats-background-' + stat_id).css('background-image', 'url(pms_image_proxy?img=' + art + '&rating_key=' + rating_key + '&width=500&height=280&opacity=40&background=282828&blur=3&fallback=' + fallback_art + ')'); $('#stats-background-' + stat_id).css('background-image', 'url(' + pms_image_proxy(art, rating_key, 500, 280, 40, '282828', 3, fallback_art) + ')');
$('#stats-thumb-' + stat_id).css('background-image', 'url(pms_image_proxy?img=' + thumb + '&rating_key=' + rating_key + '&width=300&height=' + height + '&fallback=' + fallback_poster + ')'); $('#stats-thumb-' + stat_id).css('background-image', 'url(' + pms_image_proxy(thumb, rating_key, 300, height, null, null, null, fallback_poster) + ')');
$('#stats-thumb-' + stat_id + '-bg').css('background-image', 'url(pms_image_proxy?img=' + thumb + '&rating_key=' + rating_key + '&width=300&height=' + height + '&opacity=60&background=282828&blur=3&fallback=' + fallback_poster + ')'); $('#stats-thumb-' + stat_id + '-bg').css('background-image', 'url(' + pms_image_proxy(thumb, rating_key, 300, height, 60, '282828', 3, fallback_poster) + ')');
} }
} }

View file

@ -384,7 +384,7 @@
if (s.media_type === 'track') { if (s.media_type === 'track') {
// Update if artist changed // Update if artist changed
if (s.grandparent_rating_key !== instance.data('grandparent_rating_key').toString()) { if (s.grandparent_rating_key !== instance.data('grandparent_rating_key').toString()) {
$('#background-' + key).css('background-image', 'url(pms_image_proxy?img=' + s.art + '&rating_key=' + s.rating_key + '&width=500&height=280&opacity=40&background=282828&blur=3&fallback=art&refresh=true)'); $('#background-' + key).css('background-image', 'url(' + pms_image_proxy(s.art, s.rating_key, 500, 280, 40, '282828', 3, 'art', true) + ')');
$('#metadata-grandparent_title-' + key) $('#metadata-grandparent_title-' + key)
.attr('href', 'info?rating_key=' + s.grandparent_rating_key) .attr('href', 'info?rating_key=' + s.grandparent_rating_key)
.attr('title', s.original_title || s.grandparent_title) .attr('title', s.original_title || s.grandparent_title)
@ -392,8 +392,8 @@
} }
// Update cover if album changed // Update cover if album changed
if (s.parent_rating_key !== instance.data('parent_rating_key').toString()) { if (s.parent_rating_key !== instance.data('parent_rating_key').toString()) {
$('#poster-' + key).css('background-image', 'url(pms_image_proxy?img=' + s.parent_thumb + '&rating_key=' + s.parent_rating_key + '&width=300&height=300&fallback=poster&refresh=true)'); $('#poster-' + key).css('background-image', 'url(' + pms_image_proxy(s.parent_thumb, s.parent_rating_key, 300, 300, null, null, null, 'poster', true) + ')');
$('#poster-' + key + '-bg').css('background-image', 'url(pms_image_proxy?img=' + s.parent_thumb + '&rating_key=' + s.parent_rating_key + '&width=300&height=300&opacity=60&background=282828&blur=3&fallback=poster&refresh=true)'); $('#poster-' + key + '-bg').css('background-image', 'url(' + pms_image_proxy(s.parent_thumb, s.parent_rating_key, 300, 300, 60, '282828', 3, 'poster', true) + ')');
$('#poster-url-' + key) $('#poster-url-' + key)
.attr('href', 'info?rating_key=' + s.parent_rating_key) .attr('href', 'info?rating_key=' + s.parent_rating_key)
.attr('title', s.parent_title); .attr('title', s.parent_title);

View file

@ -41,6 +41,7 @@ DOCUMENTATION :: END
from plexpy import notifiers from plexpy import notifiers
from plexpy.common import MEDIA_TYPE_HEADERS, MEDIA_FLAGS_AUDIO, MEDIA_FLAGS_VIDEO from plexpy.common import MEDIA_TYPE_HEADERS, MEDIA_FLAGS_AUDIO, MEDIA_FLAGS_VIDEO
from plexpy.helpers import pms_image_proxy
# Get audio codec file # Get audio codec file
def af(codec): def af(codec):
@ -76,7 +77,7 @@ DOCUMENTATION :: END
%> %>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="art-face" style="background-image:url(pms_image_proxy?img=${data['art']}&rating_key=${data['rating_key']}&width=1920&height=1080)"></div> <div class="art-face" style="background-image:url(${pms_image_proxy(data['art'], data['rating_key'], 1920, 1080)})"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image info-art" title="Refresh background image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image info-art" title="Refresh background image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -155,14 +156,14 @@ DOCUMENTATION :: END
<a href="${config['pms_web_url']}#!/server/${config['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${data['rating_key']}" target="_blank" title="View on Plex Web"> <a href="${config['pms_web_url']}#!/server/${config['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${data['rating_key']}" target="_blank" title="View on Plex Web">
% endif % endif
% if data['live']: % if data['live']:
<div class="summary-poster-face" style="background-image: url(pms_image_proxy?img=${data['grandparent_thumb'] or data['thumb']}&rating_key=${data['rating_key']}&width=300&height=450&fallback=poster-live);"> <div class="summary-poster-face" style="background-image: url(${pms_image_proxy(data['grandparent_thumb'] or data['thumb'], data['rating_key'], 300, 450, fallback='poster-live')});">
<div class="summary-poster-face-overlay"> <div class="summary-poster-face-overlay">
<span></span> <span></span>
</div> </div>
</div> </div>
% else: % else:
% if data['media_type'] == 'episode': % if data['media_type'] == 'episode':
<div class="summary-poster-face-episode" style="background-image: url(pms_image_proxy?img=${data['thumb']}&rating_key=${data['rating_key']}&width=500&height=280&fallback=art);"> <div class="summary-poster-face-episode" style="background-image: url(${pms_image_proxy(data['thumb'], data['rating_key'], 500, 280, fallback='art')});">
<div class="summary-poster-face-overlay"> <div class="summary-poster-face-overlay">
<span></span> <span></span>
</div> </div>
@ -171,7 +172,7 @@ DOCUMENTATION :: END
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
% elif data['media_type'] == 'artist' or data['media_type'] == 'album' or data['media_type'] == 'track': % elif data['media_type'] == 'artist' or data['media_type'] == 'album' or data['media_type'] == 'track':
<div class="summary-poster-face-track" style="background-image: url(pms_image_proxy?img=${data['thumb']}&rating_key=${data['rating_key']}&width=500&height=500&fallback=cover);"> <div class="summary-poster-face-track" style="background-image: url(${pms_image_proxy(data['thumb'], data['rating_key'], 500, 500, fallback='cover')});">
<div class="summary-poster-face-overlay"> <div class="summary-poster-face-overlay">
<span></span> <span></span>
</div> </div>
@ -180,7 +181,7 @@ DOCUMENTATION :: END
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
% else: % else:
<div class="summary-poster-face" style="background-image: url(pms_image_proxy?img=${data['thumb']}&rating_key=${data['rating_key']}&width=300&height=450&fallback=poster);"> <div class="summary-poster-face" style="background-image: url(${pms_image_proxy(data['thumb'], data['rating_key'], 300, 450, fallback='poster')});">
<div class="summary-poster-face-overlay"> <div class="summary-poster-face-overlay">
<span></span> <span></span>
</div> </div>

View file

@ -27,6 +27,9 @@ DOCUMENTATION :: END
</%doc> </%doc>
% if data != None: % if data != None:
<%
from plexpy.helpers import pms_image_proxy
%>
% if data['children_count'] > 0: % if data['children_count'] > 0:
<div class="item-children-wrapper"> <div class="item-children-wrapper">
<ul class="item-children-instance list-unstyled"> <ul class="item-children-instance list-unstyled">
@ -40,7 +43,7 @@ DOCUMENTATION :: END
% if data['children_type'] == 'movie': % if data['children_type'] == 'movie':
<a href="info?rating_key=${child['rating_key']}" title="${child['title']}"> <a href="info?rating_key=${child['rating_key']}" title="${child['title']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face poster-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}width=300&height=450&fallback=poster);"></div> <div class="item-children-poster-face poster-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 450, fallback='poster')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -55,7 +58,7 @@ DOCUMENTATION :: END
% elif data['children_type'] == 'show': % elif data['children_type'] == 'show':
<a href="info?rating_key=${child['rating_key']}" title="${child['title']}"> <a href="info?rating_key=${child['rating_key']}" title="${child['title']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face poster-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=450&fallback=poster);"></div> <div class="item-children-poster-face poster-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 450, fallback='poster')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -70,9 +73,9 @@ DOCUMENTATION :: END
<a href="info?rating_key=${child['rating_key']}" title="Season ${child['media_index']}"> <a href="info?rating_key=${child['rating_key']}" title="Season ${child['media_index']}">
<div class="item-children-poster"> <div class="item-children-poster">
% if child['thumb']: % if child['thumb']:
<div class="item-children-poster-face poster-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=450&fallback=poster);"> <div class="item-children-poster-face poster-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 450, fallback='poster')});">
% else: % else:
<div class="item-children-poster-face poster-item" style="background-image: url(pms_image_proxy?img=${child['parent_thumb']}&rating_key=${child['parent_rating_key']}&width=300&height=450&fallback=poster);"> <div class="item-children-poster-face poster-item" style="background-image: url(${pms_image_proxy(child['parent_thumb'], child['parent_rating_key'], 300, 450, fallback='poster')});">
% endif % endif
<div class="item-children-card-overlay"> <div class="item-children-card-overlay">
<div class="item-children-overlay-text"> <div class="item-children-overlay-text">
@ -88,7 +91,7 @@ DOCUMENTATION :: END
% elif data['children_type'] == 'episode': % elif data['children_type'] == 'episode':
<a href="info?rating_key=${child['rating_key']}" title="Episode ${child['media_index']}"> <a href="info?rating_key=${child['rating_key']}" title="Episode ${child['media_index']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face episode-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=500&height=250&fallback=art);"> <div class="item-children-poster-face episode-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 500, 280, fallback='art')});">
<div class="item-children-card-overlay"> <div class="item-children-card-overlay">
<div class="item-children-overlay-text"> <div class="item-children-overlay-text">
Episode ${child['media_index'] or child['originally_available_at']} Episode ${child['media_index'] or child['originally_available_at']}
@ -108,7 +111,7 @@ DOCUMENTATION :: END
% elif data['children_type'] == 'album': % elif data['children_type'] == 'album':
<a href="info?rating_key=${child['rating_key']}" title="${child['title']}"> <a href="info?rating_key=${child['rating_key']}" title="${child['title']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face cover-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=300&fallback=cover);"></div> <div class="item-children-poster-face cover-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 300, fallback='cover')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif

View file

@ -29,6 +29,7 @@ DOCUMENTATION :: END
% if data != None: % if data != None:
<% <%
from plexpy.common import MEDIA_TYPE_HEADERS from plexpy.common import MEDIA_TYPE_HEADERS
from plexpy.helpers import pms_image_proxy
types = ('movie', 'show', 'artist', 'album') types = ('movie', 'show', 'artist', 'album')
%> %>
% for media_type in types: % for media_type in types:
@ -48,9 +49,9 @@ DOCUMENTATION :: END
<a href="info?rating_key=${child['rating_key']}" title="${child['title']}"> <a href="info?rating_key=${child['rating_key']}" title="${child['title']}">
<div class="item-children-poster"> <div class="item-children-poster">
% if media_type in ('artist', 'album'): % if media_type in ('artist', 'album'):
<div class="item-children-poster-face cover-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=300&fallback=cover);"></div> <div class="item-children-poster-face cover-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 300, fallback='cover')});"></div>
% else: % else:
<div class="item-children-poster-face poster-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=450&fallback=poster);"></div> <div class="item-children-poster-face poster-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 450, fallback='poster')});"></div>
% endif % endif
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>

View file

@ -53,6 +53,9 @@ DOCUMENTATION :: END
</%doc> </%doc>
% if data != None: % if data != None:
<%
from plexpy.helpers import pms_image_proxy
%>
% if data['results_count'] > 0: % if data['results_count'] > 0:
% if 'collection' in data['results_list'] and data['results_list']['collection']: % if 'collection' in data['results_list'] and data['results_list']['collection']:
<div class="item-children-wrapper"> <div class="item-children-wrapper">
@ -64,7 +67,7 @@ DOCUMENTATION :: END
<li> <li>
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}"> <a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face poster-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=450&fallback=poster);"></div> <div class="item-children-poster-face poster-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 450, fallback='poster')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -89,7 +92,7 @@ DOCUMENTATION :: END
<li> <li>
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}"> <a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face poster-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=450&fallback=poster);"></div> <div class="item-children-poster-face poster-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 450, fallback='poster')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -114,7 +117,7 @@ DOCUMENTATION :: END
<li> <li>
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}"> <a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face poster-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=450&fallback=poster);"></div> <div class="item-children-poster-face poster-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 450, fallback='poster')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -139,7 +142,7 @@ DOCUMENTATION :: END
<li> <li>
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}"> <a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face poster-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=450&fallback=poster);"></div> <div class="item-children-poster-face poster-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 450, fallback='poster')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -164,7 +167,7 @@ DOCUMENTATION :: END
<li> <li>
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}"> <a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face episode-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=500&height=250&fallback=art);"></div> <div class="item-children-poster-face episode-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 500, 280, fallback='art')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -190,7 +193,7 @@ DOCUMENTATION :: END
<li> <li>
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}"> <a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face cover-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=300&fallback=cover);"></div> <div class="item-children-poster-face cover-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 300, fallback='cover')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -214,7 +217,7 @@ DOCUMENTATION :: END
<li> <li>
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}"> <a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face cover-item" style="background-image: url(pms_image_proxy?img=${child['thumb']}&rating_key=${child['rating_key']}&width=300&height=300&fallback=cover);"></div> <div class="item-children-poster-face cover-item" style="background-image: url(${pms_image_proxy(child['thumb'], child['rating_key'], 300, 300, fallback='cover')});"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image" title="Refresh image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif
@ -239,7 +242,7 @@ DOCUMENTATION :: END
<li> <li>
<a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}"> <a href="info?rating_key=${child['rating_key']}" id="${child['rating_key']}">
<div class="item-children-poster"> <div class="item-children-poster">
<div class="item-children-poster-face cover-item" style="background-image: url(pms_image_proxy?img=${child['parent_thumb']}&rating_key=${child['parent_rating_key']}&width=300&height=300&fallback=cover);"> <div class="item-children-poster-face cover-item" style="background-image: url(${pms_image_proxy(child['parent_thumb'], child['parent_rating_key'], 300, 300, fallback='cover')});">
<div class="item-children-card-overlay"> <div class="item-children-card-overlay">
<div class="item-children-overlay-text"> <div class="item-children-overlay-text">
Track ${child['media_index']} Track ${child['media_index']}

View file

@ -717,3 +717,21 @@ function encodeData(data) {
return [key, data[key]].map(encodeURIComponent).join("="); return [key, data[key]].map(encodeURIComponent).join("=");
}).join("&"); }).join("&");
} }
function pms_image_proxy(img, rating_key, width, height, opacity, background, blur, fallback, refresh, clip, img_format) {
var img_info = {};
if (img != null) { img_info.img = img; }
if (rating_key != null) { img_info.rating_key = rating_key; }
if (width != null) { img_info.width = width; }
if (height != null) { img_info.height = height; }
if (opacity != null) { img_info.opacity = opacity; }
if (background != null) { img_info.background = background; }
if (blur != null) { img_info.blur = blur; }
if (fallback != null) { img_info.fallback = fallback; }
if (refresh != null) { img_info.refresh = true; }
if (clip != null) { img_info.clip = true; }
if (img_format != null) { img_format.img_format = img_format; }
return 'pms_image_proxy?' + $.param(img_info);
}

View file

@ -35,10 +35,13 @@ DOCUMENTATION :: END
<%def name="body()"> <%def name="body()">
% if data: % if data:
<%
from plexpy.helpers import pms_image_proxy
%>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
% if data['library_art']: % if data['library_art']:
<div class="art-face" style="background-image:url(pms_image_proxy?img=${data['library_art']}&width=1920&height=1080)"></div> <div class="art-face" style="background-image:url(${pms_image_proxy(data['library_art'], None, 1920, 1080)})"></div>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
<span class="overlay-refresh-image info-art" title="Refresh background image"><i class="fa fa-refresh refresh_pms_image"></i></span> <span class="overlay-refresh-image info-art" title="Refresh background image"><i class="fa fa-refresh refresh_pms_image"></i></span>
% endif % endif

View file

@ -31,6 +31,9 @@ DOCUMENTATION :: END
</%doc> </%doc>
% if data: % if data:
<%
from plexpy.helpers import pms_image_proxy
%>
<div class="dashboard-recent-media-row"> <div class="dashboard-recent-media-row">
<div id="recently-added-row-scroller" style="left: 0;"> <div id="recently-added-row-scroller" style="left: 0;">
<ul class="dashboard-recent-media list-unstyled"> <ul class="dashboard-recent-media list-unstyled">
@ -45,12 +48,12 @@ DOCUMENTATION :: END
<div class="dashboard-recent-media-poster"> <div class="dashboard-recent-media-poster">
% if item['media_type'] == 'episode': % if item['media_type'] == 'episode':
% if item['parent_thumb']: % if item['parent_thumb']:
<div class="dashboard-recent-media-poster-face" style="background-image: url(pms_image_proxy?img=${item['parent_thumb']}&rating_key=${item['parent_rating_key']}&width=300&height=450&fallback=poster);"> <div class="dashboard-recent-media-poster-face" style="background-image: url(${pms_image_proxy(item['parent_thumb'], item['parent_rating_key'], 300, 450, fallback='poster')});">
% else: % else:
<div class="dashboard-recent-media-poster-face" style="background-image: url(pms_image_proxy?img=${item['grandparent_thumb']}&rating_key=${item['grandparent_rating_key']}&width=300&height=450&fallback=poster);"> <div class="dashboard-recent-media-poster-face" style="background-image: url(${pms_image_proxy(item['grandparent_thumb'], item['grandparent_rating_key'], 300, 450, fallback='poster')});">
% endif % endif
% elif item['media_type'] == 'movie': % elif item['media_type'] == 'movie':
<div class="dashboard-recent-media-poster-face" style="background-image: url(pms_image_proxy?img=${item['thumb']}&rating_key=${item['rating_key']}&width=300&height=450&fallback=poster);"> <div class="dashboard-recent-media-poster-face" style="background-image: url(${pms_image_proxy(item['thumb'], item['rating_key'], 300, 450, fallback='poster')});">
% endif % endif
<div class="dashboard-recent-media-overlay"> <div class="dashboard-recent-media-overlay">
<div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}"> <div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}">
@ -88,7 +91,7 @@ DOCUMENTATION :: END
% elif item['media_type'] == 'album': % elif item['media_type'] == 'album':
<a href="info?rating_key=${item['rating_key']}" title="${item['title']}"> <a href="info?rating_key=${item['rating_key']}" title="${item['title']}">
<div class="dashboard-recent-media-cover"> <div class="dashboard-recent-media-cover">
<div class="dashboard-recent-media-cover-face" style="background-image: url(pms_image_proxy?img=${item['thumb']}&rating_key=${item['rating_key']}&width=300&height=300&fallback=cover);"> <div class="dashboard-recent-media-cover-face" style="background-image: url(${pms_image_proxy(item['thumb'], item['rating_key'], 300, 300, fallback='cover')});">
<div class="dashboard-recent-media-overlay"> <div class="dashboard-recent-media-overlay">
<div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}"> <div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}">
<script> <script>

View file

@ -25,6 +25,8 @@ DOCUMENTATION :: END
% if data: % if data:
<% <%
from plexpy.helpers import pms_image_proxy
types = ('movie', 'show', 'artist', 'photo') types = ('movie', 'show', 'artist', 'photo')
headers = {'movie': ('Movie Libraries', ('Movies', '', '')), headers = {'movie': ('Movie Libraries', ('Movies', '', '')),
'show': ('TV Show Libraries', ('Shows', 'Seasons', 'Episodes')), 'show': ('TV Show Libraries', ('Shows', 'Seasons', 'Episodes')),
@ -35,7 +37,7 @@ DOCUMENTATION :: END
% if section_type in data: % if section_type in data:
<div class="dashboard-stats-instance" id="library-stats-instance-${section_type}" data-section_type="${section_type}"> <div class="dashboard-stats-instance" id="library-stats-instance-${section_type}" data-section_type="${section_type}">
<div class="dashboard-stats-container"> <div class="dashboard-stats-container">
<div id="library-stats-background-${section_type}" class="dashboard-stats-background" style="background-image: url(pms_image_proxy?img=/:/resources/${section_type}-fanart.jpg&width=500&height=280&opacity=40&background=282828&blur=3&fallback=art);"> <div id="library-stats-background-${section_type}" class="dashboard-stats-background" style="background-image: url(${pms_image_proxy('/:/resources/' + section_type + '-fanart.jpg', None, 500, 280, 40, '282828', 3, fallback='art')});">
<div id="library-stats-thumb-${section_type}" class="dashboard-stats-flat svg-icon library-${section_type} hidden-xs"></div> <div id="library-stats-thumb-${section_type}" class="dashboard-stats-flat svg-icon library-${section_type} hidden-xs"></div>
<div class="dashboard-stats-info-container"> <div class="dashboard-stats-info-container">
<div id="library-stats-title-${section_type}" class="dashboard-stats-info-title"> <div id="library-stats-title-${section_type}" class="dashboard-stats-info-title">

View file

@ -31,6 +31,9 @@ DOCUMENTATION :: END
</%doc> </%doc>
% if data != None: % if data != None:
<%
from plexpy.helpers import pms_image_proxy
%>
% if data: % if data:
<div class="dashboard-recent-media-row"> <div class="dashboard-recent-media-row">
<div id="recently-added-row-scroller" style="left: 0;"> <div id="recently-added-row-scroller" style="left: 0;">
@ -41,7 +44,7 @@ DOCUMENTATION :: END
% if item['media_type'] == 'movie': % if item['media_type'] == 'movie':
<a href="info?rating_key=${item['rating_key']}" title="${item['title']}"> <a href="info?rating_key=${item['rating_key']}" title="${item['title']}">
<div class="dashboard-recent-media-poster"> <div class="dashboard-recent-media-poster">
<div class="dashboard-recent-media-poster-face" style="background-image: url(pms_image_proxy?img=${item['thumb']}&rating_key=${item['rating_key']}&width=300&height=450&fallback=poster);"> <div class="dashboard-recent-media-poster-face" style="background-image: url(${pms_image_proxy(item['thumb'], item['rating_key'], 300, 450, fallback='poster')});">
<div class="dashboard-recent-media-overlay"> <div class="dashboard-recent-media-overlay">
<div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}"> <div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}">
<script> <script>
@ -65,7 +68,7 @@ DOCUMENTATION :: END
% elif item['media_type'] == 'show': % elif item['media_type'] == 'show':
<a href="info?rating_key=${item['rating_key']}" title="${item['title']}"> <a href="info?rating_key=${item['rating_key']}" title="${item['title']}">
<div class="dashboard-recent-media-poster"> <div class="dashboard-recent-media-poster">
<div class="dashboard-recent-media-poster-face" style="background-image: url(pms_image_proxy?img=${item['thumb']}&rating_key=${item['rating_key']}&width=300&height=450&fallback=poster);"> <div class="dashboard-recent-media-poster-face" style="background-image: url(${pms_image_proxy(item['thumb'], item['rating_key'], 300, 450, fallback='poster')});">
<div class="dashboard-recent-media-overlay"> <div class="dashboard-recent-media-overlay">
<div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}"> <div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}">
<script> <script>
@ -92,9 +95,9 @@ DOCUMENTATION :: END
<a href="info?rating_key=${item['rating_key']}" title="${item['parent_title']}"> <a href="info?rating_key=${item['rating_key']}" title="${item['parent_title']}">
<div class="dashboard-recent-media-poster"> <div class="dashboard-recent-media-poster">
% if item['thumb']: % if item['thumb']:
<div class="dashboard-recent-media-poster-face" style="background-image: url(pms_image_proxy?img=${item['thumb']}&rating_key=${item['rating_key']}&width=300&height=450&fallback=poster);"> <div class="dashboard-recent-media-poster-face" style="background-image: url(${pms_image_proxy(item['thumb'], item['rating_key'], 300, 450, fallback='poster')});">
% else: % else:
<div class="dashboard-recent-media-poster-face" style="background-image: url(pms_image_proxy?img=${item['parent_thumb']}&rating_key=${item['parent_rating_key']}&width=300&height=450&fallback=poster);"> <div class="dashboard-recent-media-poster-face" style="background-image: url(${pms_image_proxy(item['parent_thumb'], item['parent_rating_key'], 300, 450, fallback='poster')});">
% endif % endif
<div class="dashboard-recent-media-overlay"> <div class="dashboard-recent-media-overlay">
<div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}"> <div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}">
@ -121,7 +124,7 @@ DOCUMENTATION :: END
% elif item['media_type'] == 'episode': % elif item['media_type'] == 'episode':
<a href="info?rating_key=${item['rating_key']}" title="${item['title']}"> <a href="info?rating_key=${item['rating_key']}" title="${item['title']}">
<div class="dashboard-recent-media-poster"> <div class="dashboard-recent-media-poster">
<div class="dashboard-recent-media-poster-face" style="background-image: url(pms_image_proxy?img=${item['grandparent_thumb']}&rating_key=${item['grandparent_rating_key']}&width=300&height=450&fallback=poster);"> <div class="dashboard-recent-media-poster-face" style="background-image: url(${pms_image_proxy(item['grandparent_thumb'], item['grandparent_rating_key'], 300, 450, fallback='poster')});">
<div class="dashboard-recent-media-overlay"> <div class="dashboard-recent-media-overlay">
<div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}"> <div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}">
<script> <script>
@ -151,7 +154,7 @@ DOCUMENTATION :: END
% elif item['media_type'] == 'album': % elif item['media_type'] == 'album':
<a href="info?rating_key=${item['rating_key']}" title="${item['parent_title']}"> <a href="info?rating_key=${item['rating_key']}" title="${item['parent_title']}">
<div class="dashboard-recent-media-cover"> <div class="dashboard-recent-media-cover">
<div class="dashboard-recent-media-cover-face" style="background-image: url(pms_image_proxy?img=${item['thumb']}&rating_key=${item['rating_key']}&width=300&height=300&fallback=cover);"> <div class="dashboard-recent-media-cover-face" style="background-image: url(${pms_image_proxy(item['thumb'], item['rating_key'], 300, 300, fallback='cover')});">
<div class="dashboard-recent-media-overlay"> <div class="dashboard-recent-media-overlay">
<div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}"> <div class="dashboard-recent-media-overlay-text" id="added_at-${item['rating_key']}">
<script> <script>

View file

@ -27,6 +27,9 @@ DOCUMENTATION :: END
</%doc> </%doc>
% if data: % if data:
<%
from plexpy.helpers import pms_image_proxy
%>
<div class="dashboard-recent-media-row"> <div class="dashboard-recent-media-row">
<div id="recently-watched-row-scroller" style="left: 0;"> <div id="recently-watched-row-scroller" style="left: 0;">
<ul class="dashboard-recent-media list-unstyled"> <ul class="dashboard-recent-media list-unstyled">
@ -40,7 +43,7 @@ DOCUMENTATION :: END
<a href="info?source=history&rating_key=${item['rating_key']}" title="${item['grandparent_title']}"> <a href="info?source=history&rating_key=${item['rating_key']}" title="${item['grandparent_title']}">
% endif % endif
<div class="dashboard-recent-media-poster"> <div class="dashboard-recent-media-poster">
<div class="dashboard-recent-media-poster-face" style="background-image: url(pms_image_proxy?img=${item['thumb']}&rating_key=${item['rating_key']}&width=300&height=450&fallback=poster);"> <div class="dashboard-recent-media-poster-face" style="background-image: url(${pms_image_proxy(item['thumb'], item['rating_key'], 300, 450, fallback='poster')});">
<div class="dashboard-recent-media-overlay"> <div class="dashboard-recent-media-overlay">
<div class="dashboard-recent-media-overlay-text" id="time-${item['time']}"> <div class="dashboard-recent-media-overlay-text" id="time-${item['time']}">
<script> <script>
@ -115,7 +118,7 @@ DOCUMENTATION :: END
% if item['rating_key']: % if item['rating_key']:
<a href="info?source=history&rating_key=${item['rating_key']}" title="${item['parent_title']}"> <a href="info?source=history&rating_key=${item['rating_key']}" title="${item['parent_title']}">
<div class="dashboard-recent-media-cover"> <div class="dashboard-recent-media-cover">
<div class="dashboard-recent-media-cover-face" style="background-image: url(pms_image_proxy?img=${item['thumb']}&rating_key=${item['rating_key']}&width=300&height=300&fallback=cover);"> <div class="dashboard-recent-media-cover-face" style="background-image: url(${pms_image_proxy(item['thumb'], item['rating_key'], 300, 300, fallback='cover')});">
<div class="dashboard-recent-media-overlay"> <div class="dashboard-recent-media-overlay">
<div class="dashboard-recent-media-overlay-text" id="time-${item['time']}"> <div class="dashboard-recent-media-overlay-text" id="time-${item['time']}">
<script> <script>

View file

@ -41,6 +41,7 @@ import sys
import tarfile import tarfile
import time import time
import unicodedata import unicodedata
import urllib
import urllib3 import urllib3
from xml.dom import minidom from xml.dom import minidom
import xmltodict import xmltodict
@ -1257,3 +1258,34 @@ def mask_config_passwords(config):
config[cfg] = ' ' config[cfg] = ' '
return config return config
def pms_image_proxy(img=None, rating_key=None, width=None, height=None,
opacity=None, background=None, blur=None, img_format=None,
fallback=None, refresh=None, clip=None):
img_info = {}
if img is not None:
img_info['img'] = img
if rating_key is not None:
img_info['rating_key'] = rating_key
if width is not None:
img_info['width'] = width
if height is not None:
img_info['height'] = height
if opacity is not None:
img_info['opacity'] = opacity
if background is not None:
img_info['background'] = background
if blur is not None:
img_info['blur'] = blur
if img_format is not None:
img_info['img_format'] = img_format
if fallback is not None:
img_info['fallback'] = fallback
if refresh is not None:
img_info['refresh'] = 'true'
if clip is not None:
img_info['clip'] = 'true'
return 'pms_image_proxy?' + urllib.urlencode(img_info)