- % for movie in (movie_a, movie_b):
- % if movie:
-
-
+
+
-
-
+ % for movie in (movie_a, movie_b):
+ % if movie:
+ % if not movie_b:
+ |
+ % endif
+
+
-
-
-
-
- |
-
-
-
- |
-
-
-
-
-
- ${movie['title']}
- |
-
-
-
- % if movie['tagline']:
-
- ${movie['tagline']}
-
- % endif
-
- ${movie['summary'][:450] + (movie['summary'][450:] and '...')}
-
- |
-
-
-
+ % if not movie_b:
+ |
+ % endif
+ % endif
+ % endfor
|
- % else:
- |
- % endif
- % endfor
% endfor
@@ -765,108 +784,119 @@
% for show_a, show_b in grouper(recently_added['show'], 2):
- % for show in (show_a, show_b):
- % if show:
- <%
- if show['season_count'] == 1:
- if show['season'][0]['episode_count'] == 1:
- link_rating_key = show['season'][0]['episode'][0]['rating_key']
- else:
- link_rating_key = show['season'][0]['episode'][0]['parent_rating_key']
- else:
- link_rating_key = show['rating_key']
- %>
-
-
+
+
-
-
+ % for show in (show_a, show_b):
+ % if show:
+ % if not show_b:
+ |
+ % endif
+ <%
+ if show['season_count'] == 1:
+ if show['season'][0]['episode_count'] == 1:
+ link_rating_key = show['season'][0]['episode'][0]['rating_key']
+ else:
+ link_rating_key = show['season'][0]['episode'][0]['parent_rating_key']
+ else:
+ link_rating_key = show['rating_key']
+ %>
+
+
-
-
-
-
- |
-
-
-
- |
-
-
-
-
-
- ${show['title']}
- |
-
-
-
-
- % if show['season_count'] > 1:
- ${show['season_count']} seasons /
- % endif
- <% total_show_episodes = sum(s['episode_count'] for s in show['season']) %>
- ${total_show_episodes} episode${'s' if total_show_episodes > 1 else ''}
-
-
- % for i, season in enumerate(show['season'][:8]):
- Season ${season['media_index']} ·
- % if season['episode_count'] == 1:
- Episode ${season['episode'][0]['media_index']} - ${season['episode'][0]['title']}
- % else:
- Episodes ${season['episode_range']}
- % endif
- % if i < min(show['season_count'], 7):
-
- % elif i == 7 and show['season_count'] > 8:
- ...plus ${show['season_count'] - 8} more seasons!
- % endif
- % endfor
-
-
- % if show['season_count'] == 1 and show['season'][0]['episode_count'] == 1:
- ${show['season'][0]['episode'][0]['summary'][:350] + (show['season'][0]['episode'][0]['summary'][350:] and '...')}
- % else:
- <% length = max(0, 350 - 50 * (show['season_count'] - 1)) %>
- % if length:
- ${show['summary'][:length] + (show['summary'][length:] and '...')}
- % endif
- % endif
-
- |
-
-
-
+ % if not show_b:
+ |
+ % endif
+ % endif
+ % endfor
|
- % else:
- |
- % endif
- % endfor
% endfor
@@ -910,71 +941,82 @@
% for album_a, album_b in grouper([a for artist in recently_added['artist'] for a in artist['album']], 2):
- % for album in (album_a, album_b):
- % if album:
-
-
+
+
-
-
+ % for album in (album_a, album_b):
+ % if album:
+ % if not album_b:
+ |
+ % endif
+
+
-
-
-
-
- |
-
-
-
- |
-
-
-
-
-
- ${album['title']}
- |
-
-
-
-
- ${album['parent_title']} · ${album['track_count']} track${'s' if album['track_count'] > 1 else ''}
-
- % if artist['title'].lower() != 'various artists':
-
- ${album['summary'][:200] + (album['summary'][200:] and '...')}
-
- % endif
- |
-
-
-
+ % if not album_b:
+ |
+ % endif
+ % endif
+ % endfor
|
- % else:
- |
- % endif
- % endfor
% endfor
diff --git a/data/interfaces/newsletters/recently_added_master.html b/data/interfaces/newsletters/recently_added_master.html
index 79ec67a1..26b9ad79 100644
--- a/data/interfaces/newsletters/recently_added_master.html
+++ b/data/interfaces/newsletters/recently_added_master.html
@@ -374,6 +374,12 @@
min-width: 502px;
max-width: 502px;
}
+ .card-instance.pad {
+ padding: 0 !important;
+ width: 251px !important;
+ min-width: 251px !important;
+ max-width: 251px !important;
+ }
.card-instance.movie,
.card-instance.show {
height: 233px;
@@ -382,6 +388,7 @@
height: 158px;
}
.card-background {
+ background-color: #282828;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
@@ -653,75 +660,86 @@
% for movie_a, movie_b in grouper(recently_added['movie'], 2):
- % for movie in (movie_a, movie_b):
- % if movie:
-
-
+
+
-
-
+ % for movie in (movie_a, movie_b):
+ % if movie:
+ % if not movie_b:
+ |
+ % endif
+
+
-
-
-
-
- |
-
-
-
- |
-
-
-
-
-
- ${movie['title']}
- |
-
-
-
- % if movie['tagline']:
-
- ${movie['tagline']}
-
- % endif
-
- ${movie['summary'][:450] + (movie['summary'][450:] and '...')}
-
- |
-
-
-
+ % if not movie_b:
+ |
+ % endif
+ % endif
+ % endfor
|
- % else:
- |
- % endif
- % endfor
% endfor
@@ -765,108 +784,119 @@
% for show_a, show_b in grouper(recently_added['show'], 2):
- % for show in (show_a, show_b):
- % if show:
- <%
- if show['season_count'] == 1:
- if show['season'][0]['episode_count'] == 1:
- link_rating_key = show['season'][0]['episode'][0]['rating_key']
- else:
- link_rating_key = show['season'][0]['episode'][0]['parent_rating_key']
- else:
- link_rating_key = show['rating_key']
- %>
-
-
+
+
-
-
+ % for show in (show_a, show_b):
+ % if show:
+ % if not show_b:
+ |
+ % endif
+ <%
+ if show['season_count'] == 1:
+ if show['season'][0]['episode_count'] == 1:
+ link_rating_key = show['season'][0]['episode'][0]['rating_key']
+ else:
+ link_rating_key = show['season'][0]['episode'][0]['parent_rating_key']
+ else:
+ link_rating_key = show['rating_key']
+ %>
+
+
-
-
-
-
- |
-
-
-
- |
-
-
-
-
-
- ${show['title']}
- |
-
-
-
-
- % if show['season_count'] > 1:
- ${show['season_count']} seasons /
- % endif
- <% total_show_episodes = sum(s['episode_count'] for s in show['season']) %>
- ${total_show_episodes} episode${'s' if total_show_episodes > 1 else ''}
-
-
- % for i, season in enumerate(show['season'][:8]):
- Season ${season['media_index']} ·
- % if season['episode_count'] == 1:
- Episode ${season['episode'][0]['media_index']} - ${season['episode'][0]['title']}
- % else:
- Episodes ${season['episode_range']}
- % endif
- % if i < min(show['season_count'], 7):
-
- % elif i == 7 and show['season_count'] > 8:
- ...plus ${show['season_count'] - 8} more seasons!
- % endif
- % endfor
-
-
- % if show['season_count'] == 1 and show['season'][0]['episode_count'] == 1:
- ${show['season'][0]['episode'][0]['summary'][:350] + (show['season'][0]['episode'][0]['summary'][350:] and '...')}
- % else:
- <% length = max(0, 350 - 50 * (show['season_count'] - 1)) %>
- % if length:
- ${show['summary'][:length] + (show['summary'][length:] and '...')}
- % endif
- % endif
-
- |
-
-
-
+ % if not show_b:
+ |
+ % endif
+ % endif
+ % endfor
|
- % else:
- |
- % endif
- % endfor
% endfor
@@ -910,71 +941,82 @@
% for album_a, album_b in grouper([a for artist in recently_added['artist'] for a in artist['album']], 2):
- % for album in (album_a, album_b):
- % if album:
-
-
+
+
-
-
+ % for album in (album_a, album_b):
+ % if album:
+ % if not album_b:
+ |
+ % endif
+
+
-
-
-
-
- |
-
-
-
- |
-
-
-
-
-
- ${album['title']}
- |
-
-
-
-
- ${album['parent_title']} · ${album['track_count']} track${'s' if album['track_count'] > 1 else ''}
-
- % if artist['title'].lower() != 'various artists':
-
- ${album['summary'][:200] + (album['summary'][200:] and '...')}
-
- % endif
- |
-
-
-
+ % if not album_b:
+ |
+ % endif
+ % endif
+ % endfor
|
- % else:
- |
- % endif
- % endfor
% endfor
diff --git a/plexpy/newsletters.py b/plexpy/newsletters.py
index a7704be6..723b63a0 100644
--- a/plexpy/newsletters.py
+++ b/plexpy/newsletters.py
@@ -698,9 +698,12 @@ class RecentlyAdded(Newsletter):
item['thumb_hash'] = set_hash_image_info(
img=item['thumb'], width=150, height=225, fallback='poster')
- item['art_hash'] = set_hash_image_info(
- img=item['art'], width=500, height=280,
- opacity=25, background='282828', blur=3, fallback='art')
+ if item['art']:
+ item['art_hash'] = set_hash_image_info(
+ img=item['art'], width=500, height=280,
+ opacity=25, background='282828', blur=3, fallback='art')
+ else:
+ item['art_hash'] = ''
item['poster_url'] = ''
item['art_url'] = ''
diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py
index f7fdefca..b3aad030 100644
--- a/plexpy/notification_handler.py
+++ b/plexpy/notification_handler.py
@@ -1119,6 +1119,9 @@ def get_imgur_info(img=None, rating_key=None, title='', width=600, height=1000,
def set_hash_image_info(img=None, rating_key=None, width=600, height=1000,
opacity=100, background='000000', blur=0, fallback=None):
+ if not rating_key and not img:
+ return fallback
+
if rating_key and not img:
if fallback == 'art':
img = '/library/metadata/{}/art'.format(rating_key)
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index ed6e2b36..37645ebd 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -4021,6 +4021,18 @@ class WebInterface(object):
def image(self, *args, **kwargs):
if args:
img_hash = args[0]
+
+ if img_hash in ('poster', 'cover', 'art'):
+ if img_hash == 'poster':
+ fbi = common.DEFAULT_POSTER_THUMB
+ elif img_hash == 'cover':
+ fbi = common.DEFAULT_COVER_THUMB
+ elif img_hash == 'art':
+ fbi = common.DEFAULT_ART
+
+ fp = os.path.join(plexpy.PROG_DIR, 'data', fbi)
+ return serve_file(path=fp, content_type='image/png')
+
img_info = notification_handler.get_hash_image_info(img_hash=img_hash)
if img_info:
| | | | | | | | | | | | | | | | | |