Skip to content

Commit

Permalink
Update UI to support season titles
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyWong16 committed Mar 5, 2021
1 parent 8444860 commit f92ba45
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 32 deletions.
11 changes: 6 additions & 5 deletions data/interfaces/default/current_activity_instance.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
% if session is not None:
<%
from collections import defaultdict
from plexpy.helpers import cast_to_int, page
from plexpy.helpers import cast_to_int, page, short_season
from plexpy.common import VIDEO_RESOLUTION_OVERRIDES, AUDIO_CODEC_OVERRIDES, EXTRA_TYPES
import plexpy
%>
Expand All @@ -74,6 +74,7 @@
parent_href = page('info', data['parent_rating_key'])
grandparent_href = page('info', data['grandparent_rating_key'])
user_href = page('user', data['user_id']) if data['user_id'] else '#'
season = short_season(data['parent_title'])
%>
<div class="dashboard-activity-instance" id="activity-instance-${sk}" data-key="${sk}" data-id="${data['session_id']}"
data-rating_key="${data['rating_key']}" data-parent_rating_key="${data['parent_rating_key']}" data-grandparent_rating_key="${data['grandparent_rating_key']}"
Expand Down Expand Up @@ -478,7 +479,7 @@
<span title="${data['year']}" class="sub-heading">${data['year']}</span>
% elif data['media_type'] == 'episode':
% if data['media_index']:
<a href="${href}" title="Season ${data['parent_media_index']}" class="sub-heading">S${data['parent_media_index']}</a>
<a href="${href}" title="${data['parent_title']}" class="sub-heading">${season}</a>
&middot; <a href="${href}" title="Episode ${data['media_index']}" class="sub-heading">E${data['media_index']}</a>
% else:
<a href="${href}" title="${data['originally_available_at']}" class="sub-heading">${data['originally_available_at']}</a>
Expand All @@ -490,7 +491,7 @@
% if data['media_type'] == 'movie':
<span title="${data['year']}" class="sub-heading">${data['year']}</span>
% elif data['media_type'] == 'episode':
<a href="${parent_href}" title="Season ${data['parent_media_index']}" class="sub-heading">S${data['parent_media_index']}</a>
<a href="${parent_href}" title="${data['parent_title']}" class="sub-heading">${season}</a>
&middot; <a href="${href}" title="Episode ${data['media_index']}" class="sub-heading">E${data['media_index']}</a>
% elif data['media_type'] == 'track':
<a id="metadata-parent_title-${sk}" href="${parent_href}" title="${data['parent_title']}" class="sub-heading">${data['parent_title']}</a>
Expand All @@ -507,15 +508,15 @@
% elif data['channel_title']:
<span title="${data['channel_title']}" class="sub-heading">${data['channel_title']}</span>
% if data['media_type'] == 'episode' and data['parent_media_index'] and data['media_index']:
(<span title="Season ${data['parent_media_index']}" class="sub-heading">S${data['parent_media_index']}</span>
(<span title="${data['parent_title']}" class="sub-heading">${season}</span>
&middot; <span title="Episode ${data['media_index']}" class="sub-heading">E${data['media_index']}</span>)
% elif data['media_type'] == 'episode' and data['originally_available_at']:
(<span title="${data['originally_available_at']}" class="sub-heading">${data['originally_available_at']}</span>)
% endif
% else:
<span title="Channel" class="sub-heading">Channel</span>
% if data['media_type'] == 'episode' and data['parent_media_index'] and data['media_index']:
(<span title="Season ${data['parent_media_index']}" class="sub-heading">S${data['parent_media_index']}</span>
(<span title="${data['parent_title']}" class="sub-heading">${season}</span>
&middot; <span title="Episode ${data['media_index']}" class="sub-heading">E${data['media_index']}</span>)
% elif data['media_type'] == 'episode' and data['originally_available_at']:
(<span title="${data['originally_available_at']}" class="sub-heading">${data['originally_available_at']}</span>)
Expand Down
28 changes: 19 additions & 9 deletions data/interfaces/default/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

from plexpy import notifiers
from plexpy.common import MEDIA_TYPE_HEADERS, MEDIA_FLAGS_AUDIO, MEDIA_FLAGS_VIDEO
from plexpy.helpers import page, get_percent, cast_to_int
from plexpy.helpers import page, get_percent, cast_to_int, short_season

# Get audio codec file
def af(codec):
Expand Down Expand Up @@ -81,6 +81,11 @@
<%
data = defaultdict(lambda: None, **metadata)
media_info = defaultdict(lambda: None, **(data['media_info'][0] if data['media_info'] else {}))
season = ''
if data['media_type'] == 'episode':
season = short_season(data['parent_title'])
elif data['media_type'] == 'season':
season = short_season(data['title'])
%>
<div class="container-fluid">
<div class="row">
Expand All @@ -105,7 +110,7 @@
<li class="hidden-xs hidden-sm">${data['grandparent_title']}</li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
% if data['media_index']:
<li>Season ${data['parent_media_index']}</li>
<li> ${data['parent_title']}</li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li class="active metadata-xml">Episode ${data['media_index']} - ${data['title']}</li>
% else:
Expand All @@ -125,13 +130,13 @@
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li><a href="${page('info', data['parent_rating_key'])}">${data['parent_title']}</a></li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li class="active metadata-xml">Season ${data['media_index']}</li>
<li class="active metadata-xml">${data['title']}</li>
% elif data['media_type'] == 'episode':
<li class="hidden-xs hidden-sm"><a href="${page('library', data['section_id'])}">${data['library_name']}</a></li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li class="hidden-xs hidden-sm"><a href="${page('info', data['grandparent_rating_key'])}">${data['grandparent_title']}</a></li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li><a href="${page('info', data['parent_rating_key'])}">Season ${data['parent_media_index']}</a></li>
<li><a href="${page('info', data['parent_rating_key'])}">${data['parent_title']}</a></li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li class="active metadata-xml">Episode ${data['media_index']} - ${data['title']}</li>
% elif data['media_type'] == 'artist':
Expand Down Expand Up @@ -242,18 +247,18 @@ <h1>&nbsp;</h1><h1>${data['title']}</h1>
<h1>${data['grandparent_title']}</h1>
<h2>${data['title']}</h2>
% if data['media_index']:
<h3 class="hidden-xs">S${data['parent_media_index']} &middot; E${data['media_index']}</h3>
<h3 class="hidden-xs">${season} &middot; E${data['media_index']}</h3>
% endif
% endif
% elif data['media_type'] in ('movie', 'show', 'artist', 'collection', 'playlist', 'photo_album'):
<h1>&nbsp;</h1><h1>${data['title']}</h1>
% elif data['media_type'] == 'season':
<h1>&nbsp;</h1><h1><a href="${page('info', data['parent_rating_key'])}">${data['parent_title']}</a></h1>
<h3 class="hidden-xs">S${data['media_index']}</h3>
<h3 class="hidden-xs">${season}</h3>
% elif data['media_type'] == 'episode':
<h1><a href="${page('info', data['grandparent_rating_key'])}">${data['grandparent_title']}</a></h1>
<h2>${data['title']}</h2>
<h3 class="hidden-xs">S${data['parent_media_index']} &middot; E${data['media_index']}</h3>
<h3 class="hidden-xs">${season} &middot; E${data['media_index']}</h3>
% elif data['media_type'] == 'album':
<h1><a href="${page('info', data['parent_rating_key'])}">${data['parent_title']}</a></h1>
<h2>${data['title']}</h2>
Expand Down Expand Up @@ -705,6 +710,11 @@ <h2>${data['title']}</h2>
% if metadata:
<%
data = defaultdict(None, **metadata)
season = ''
if data['media_type'] == 'episode':
season = short_season(data['parent_title'])
elif data['media_type'] == 'season':
season = short_season(data['title'])
%>
<div class="modal fade" id="info-modal" tabindex="-1" role="dialog" aria-labelledby="info-modal">
</div>
Expand Down Expand Up @@ -744,9 +754,9 @@ <h4 class="modal-title">Recently Added Notification</h4>
% elif data['media_type'] == 'show':
${data['title']}
% elif data['media_type'] == 'season':
${data['parent_title']}<br />S${data['media_index']}
${data['parent_title']}<br />${data['title']}
% elif data['media_type'] == 'episode':
${data['grandparent_title']}<br />${data['title']}<br />S${data['parent_media_index']} &middot; E${data['media_index']}
${data['grandparent_title']}<br />${data['title']}<br />${season} &middot; E${data['media_index']}
% elif data['media_type'] == 'artist':
${data['title']}
% elif data['media_type'] == 'album':
Expand Down
8 changes: 4 additions & 4 deletions data/interfaces/default/info_children_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

% if data != None:
<%
from plexpy.helpers import cast_to_int, page
from plexpy.helpers import cast_to_int, page, short_season
%>
% if data['children_count'] > 0:
<div class="item-children-wrapper">
Expand Down Expand Up @@ -71,7 +71,7 @@ <h3>
</h3>
</div>
% elif data['children_type'] == 'season':
<a href="${page('info', child['rating_key'])}" title="Season ${child['media_index']}">
<a href="${page('info', child['rating_key'])}" title="${child['title']}">
<div class="item-children-poster">
% if child['thumb']:
<div class="item-children-poster-face poster-item" style="background-image: url(${page('pms_image_proxy', child['thumb'], child['rating_key'], 300, 450, fallback='poster')});">
Expand All @@ -80,7 +80,7 @@ <h3>
% endif
<div class="item-children-card-overlay">
<div class="item-children-overlay-text">
Season ${child['media_index']}
${child['title']}
</div>
</div>
</div>
Expand Down Expand Up @@ -193,7 +193,7 @@ <h3>
${child['title']}
</span>
</a>
<span class="text-muted"> (<a class="no-highlight" href="${page('info', child['parent_rating_key'])}" title="${child['parent_title']}">S${child['parent_media_index']}</a> &middot; <a class="no-highlight" href="${page('info', child['rating_key'])}" title="${child['title']}">E${child['media_index']}</a>)</span>
<span class="text-muted"> (<a class="no-highlight" href="${page('info', child['parent_rating_key'])}" title="${child['parent_title']}">${short_season(child['parent_title'])}</a> &middot; <a class="no-highlight" href="${page('info', child['rating_key'])}" title="${child['title']}">E${child['media_index']}</a>)</span>
% elif child['media_type'] == 'track':
<span class="media-type-tooltip" data-toggle="tooltip" title="Track"><i class="fa fa-music fa-fw"></i></span>
<a href="${page('info', child['rating_key'])}" title="${child['title']}">
Expand Down
6 changes: 3 additions & 3 deletions data/interfaces/default/info_search_results_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

% if data != None:
<%
from plexpy.helpers import page
from plexpy.helpers import page, short_season
%>
% if data['results_count'] > 0:
% if 'collection' in data['results_list'] and data['results_list']['collection']:
Expand Down Expand Up @@ -149,7 +149,7 @@ <h4>Seasons</h4>
</div>
<div class="item-children-instance-text-wrapper poster-item">
<h3 title="${child['parent_title']}">${child['parent_title']}</h3>
<h3 class="text-muted">S${child['media_index']}</h3>
<h3 class="text-muted">${short_season(child['title'])}</h3>
</div>
</a>
</li>
Expand All @@ -175,7 +175,7 @@ <h4>Episodes</h4>
<div class="item-children-instance-text-wrapper episode-item">
<h3 title="${child['grandparent_title']}">${child['grandparent_title']}</h3>
<h3 title="${child['title']}">${child['title']}</h3>
<h3 class="text-muted">S${child['parent_media_index']} &middot; E${child['media_index']}</h3>
<h3 class="text-muted">${short_season(child['parent_title'])} &middot; E${child['media_index']}</h3>
</div>
</a>
</li>
Expand Down
5 changes: 3 additions & 2 deletions data/interfaces/default/library_recently_added.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@

% if data:
<%
from plexpy.helpers import page
from plexpy.helpers import page, short_season

%>
<div class="dashboard-recent-media-row">
<div id="recently-added-row-scroller" style="left: 0;">
Expand Down Expand Up @@ -77,7 +78,7 @@ <h3 class="text-muted">
<a href="${page('info', item['rating_key'])}" title="${item['title']}">${item['title']}</a>
</h3>
<h3 class="text-muted">
<a href="${page('info', item['parent_rating_key'])}" title="Season ${item['parent_media_index']}">S${item['parent_media_index']}</a>
<a href="${page('info', item['parent_rating_key'])}" title="${item['parent_title']}">${short_season(item['parent_title'])}</a>
&middot; <a href="${page('info', item['rating_key'])}" title="Episode ${item['media_index']}">E${item['media_index']}</a>
</h3>
% elif item['media_type'] == 'movie':
Expand Down
4 changes: 2 additions & 2 deletions data/interfaces/default/recently_added.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

% if data != None:
<%
from plexpy.helpers import cast_to_int, page
from plexpy.helpers import cast_to_int, page, short_season
%>
% if data:
<div class="dashboard-recent-media-row">
Expand Down Expand Up @@ -146,7 +146,7 @@ <h3 class="text-muted">
<a href="${page('info', item['rating_key'])}" title="${item['title']}">${item['title']}</a>
</h3>
<h3 class="text-muted">
<a href="${page('info', item['parent_rating_key'])}" title="Season ${item['parent_media_index']}">S${item['parent_media_index']}</a>
<a href="${page('info', item['parent_rating_key'])}" title="${item['parent_title']}">${short_season(item['parent_title'])}</a>
&middot;
<a href="${page('info', item['rating_key'])}" title="Episode ${item['media_index']}">E${item['media_index']}</a>
</h3>
Expand Down
11 changes: 7 additions & 4 deletions data/interfaces/default/update_metadata.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li class="hidden-xs hidden-sm">${query['grandparent_title']}</li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li class="active">Season ${query['parent_media_index']}</li>
<li class="active">${query['parent_title']}</li>
% elif query['media_type'] == 'episode':
<li class="hidden-xs hidden-sm">TV Shows</li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li class="hidden-xs hidden-sm">${query['grandparent_title']}</li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li>Season ${query['parent_media_index']}</li>
<li>${query['parent_title']}</li>
<span class="breadcrumb-arrow"><i class="fa fa-chevron-right"></i></span>
<li class="active">Episode ${query['media_index']} - ${query['title']}</li>
% elif query['media_type'] == 'artist':
Expand Down Expand Up @@ -141,6 +141,9 @@

<%def name="modalIncludes()">
% if query:
<%
from plexpy.helpers import short_season
%>
<div class="modal fade" id="confirm-modal-update" tabindex="-1" role="dialog" aria-labelledby="confirm-modal-update">
<div class="modal-dialog">
<div class="modal-content">
Expand All @@ -157,9 +160,9 @@ <h4 class="modal-title" id="myModalLabel">Confirm Update</h4>
% elif query['media_type'] == 'show':
${query['grandparent_title']}
% elif query['media_type'] == 'season':
${query['grandparent_title']}<br />S${query['parent_media_index']}
${query['grandparent_title']}<br />${query['parent_title']}
% elif query['media_type'] == 'episode':
${query['grandparent_title']}<br />${query['title']}<br />S${query['parent_media_index']} &middot; E${query['media_index']}
${query['grandparent_title']}<br />${query['title']}<br />${short_season(query['parent_title'])} &middot; E${query['media_index']}
% elif query['media_type'] == 'artist':
${query['grandparent_title']}
% elif query['media_type'] == 'album':
Expand Down
6 changes: 3 additions & 3 deletions data/interfaces/default/user_recently_watched.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

% if data:
<%
from plexpy.helpers import page
from plexpy.helpers import page, short_season
%>
<div class="dashboard-recent-media-row">
<div id="recently-watched-row-scroller" style="left: 0;">
Expand Down Expand Up @@ -68,7 +68,7 @@ <h3 class="text-muted" title="${item['title']}">
</h3>
% if item['media_index']:
<h3 class="text-muted">
<a href="${page('info', item['rating_key'], history=True, live=item['live'])}" title="Season ${item['parent_media_index']}">S${item['parent_media_index']}</a>
<a href="${page('info', item['rating_key'], history=True, live=item['live'])}" title="${item['parent_title']}">${short_season(item['parent_title'])}</a>
&middot; <a href="${page('info', item['rating_key'], history=True, live=item['live'])}" title="Episode ${item['media_index']}">E${item['media_index']}</a>
</h3>
% else:
Expand All @@ -84,7 +84,7 @@ <h3 class="text-muted" title="${item['title']}">
<a href="${page('info', item['rating_key'], history=True, live=item['live'])}" title="${item['title']}">${item['title']}</a>
</h3>
<h3 class="text-muted">
<a href="${page('info', item['parent_rating_key'])}" title="Season ${item['parent_media_index']}">S${item['parent_media_index']}</a>
<a href="${page('info', item['parent_rating_key'])}" title="${item['parent_title']}">${short_season(item['parent_title'])}</a>
&middot; <a href="${page('info', item['rating_key'], history=True, live=item['live'])}" title="Episode ${item['media_index']}">E${item['media_index']}</a>
</h3>
% endif
Expand Down

0 comments on commit f92ba45

Please sign in to comment.