diff --git a/data/interfaces/newsletters/recently_added.html b/data/interfaces/newsletters/recently_added.html
index 135c7088..58d67db9 100644
--- a/data/interfaces/newsletters/recently_added.html
+++ b/data/interfaces/newsletters/recently_added.html
@@ -68,17 +68,14 @@
width: 100%;
}
- /* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
.container {
display: block;
margin: 0 auto !important;
- /* makes it centered */
max-width: 1042px;
padding: 10px;
width: 1042px;
}
- /* This should also be a block element, so that it will fill 100% of the .container */
.content {
box-sizing: border-box;
display: block;
@@ -172,88 +169,9 @@
text-decoration: underline;
}
- /* -------------------------------------
- BUTTONS
- ------------------------------------- */
- .btn {
- box-sizing: border-box;
- width: 100%;
- }
-
- .btn > tbody > tr > td {
- padding-bottom: 15px;
- }
-
- .btn table {
- width: auto;
- }
-
- .btn table td {
- background-color: #ffffff;
- border-radius: 5px;
- text-align: center;
- }
-
- .btn a {
- background-color: #ffffff;
- border: solid 1px #3498db;
- border-radius: 5px;
- box-sizing: border-box;
- color: #3498db;
- cursor: pointer;
- display: inline-block;
- font-size: 14px;
- font-weight: bold;
- margin: 0;
- padding: 12px 25px;
- text-decoration: none;
- text-transform: capitalize;
- }
-
- .btn-primary table td {
- background-color: #3498db;
- }
-
- .btn-primary a {
- background-color: #3498db;
- border-color: #3498db;
- color: #ffffff;
- }
-
/* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */
- .last {
- margin-bottom: 0;
- }
-
- .first {
- margin-top: 0;
- }
-
- .align-center {
- text-align: center;
- }
-
- .align-right {
- text-align: right;
- }
-
- .align-left {
- text-align: left;
- }
-
- .clear {
- clear: both;
- }
-
- .mt0 {
- margin-top: 0;
- }
-
- .mb0 {
- margin-bottom: 0;
- }
.mb5 {
margin-bottom: 5px;
}
@@ -263,9 +181,6 @@
text-overflow: ellipsis;
overflow: hidden;
}
- .clear {
- clear: both;
- }
.preheader {
color: transparent;
@@ -324,6 +239,7 @@
margin-left: auto;
margin-right: auto;
}
+
/* -------------------------------------
MEDIA SECTIONS
------------------------------------- */
@@ -378,6 +294,7 @@
font-size: 20px;
text-transform: uppercase;
}
+
/* -------------------------------------
MEDIA CARDS
------------------------------------- */
@@ -480,21 +397,21 @@
padding-left: 5px;
}
.card-info-footer .badge-container {
- max-width: 265px;
+ max-width: 260px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.card-info-footer .star-rating-container {
- width: 60px;
- vertical-align: bottom;
- padding-right: 5px;
+ width: 65px;
}
.card-info-footer .star-rating {
+ margin-left: 4px;
font-size: 0.8rem;
line-height: 1rem;
width: 0.5rem;
display: inline-block;
+ vertical-align: bottom;
}
.star-rating.full {
color: #E5A00D;
@@ -505,6 +422,7 @@
.badge {
display: inline-block;
min-width: 10px;
+ margin-right: 4px;
padding: 3px 7px;
font-size: 11px;
line-height: 1;
@@ -609,20 +527,11 @@
line-height: inherit !important;
text-decoration: none !important;
}
-
- .btn-primary table td:hover {
- background-color: #34495e !important;
- }
-
- .btn-primary a:hover {
- background-color: #34495e !important;
- border-color: #34495e !important;
- }
}
-
+
% if preview and service and service != 'self-hosted':
-
-
-
% if base_url and not preview:
% endif
-
-
-
|
-
% if message:
@@ -663,7 +565,6 @@
|
% endif
-
% if recently_added.get('movie'):
@@ -679,109 +580,105 @@
|
-
- % for movie_a, movie_b in grouper(recently_added['movie'], 2):
-
-
-
-
-
- % for movie in (movie_a, movie_b):
- % if movie:
- % if not movie_b:
- |
- % endif
-
-
-
+ % for movie_a, movie_b in grouper(recently_added['movie'], 2):
+
+
+
+
+ % 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 '...')}
-
- |
-
-
-
-
-
+
+
+ |
+
+
+
+
+ ${movie['title']}
+ |
+
+
+
+ % if movie['tagline']:
+
+ ${movie['tagline']}
+
+ % endif
+
+ ${movie['summary'][:450] + (movie['summary'][450:] and '...')}
+
+ |
+
+
+
-
-
- |
- % if not movie_b:
- |
- % endif
- % endif
- % endfor
-
-
-
- |
-
- % endfor
-
+
+ |
+
+
+ |
+ % if not movie_b:
+ |
+ % endif
+ % endif
+ % endfor
+
+
+ |
+
+ % endfor
|
@@ -803,142 +700,137 @@
-
- % for show_a, show_b in grouper(recently_added['show'], 2):
-
-
-
-
-
- % 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']
- %>
-
-
-
+ % for show_a, show_b in grouper(recently_added['show'], 2):
+
+
+
+
+ % 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 /
+ |
+
+ |
+
+
+
+
+ ${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]):
+ % if season['episode_count'] == 1:
+ Season ${season['media_index']} · Episode ${season['episode'][0]['media_index']} - ${season['episode'][0]['title']}
+ % else:
+ Season ${season['media_index']} · 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
-
-
-
- |
-
- % endfor
-
+
+ |
+
+
+ |
+ % if not show_b:
+ |
+ % endif
+ % endif
+ % endfor
+
+
+ |
+
+ % endfor
|
@@ -960,124 +852,114 @@
-
- % 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:
- % if not album_b:
- |
- % endif
-
-
-
+ % 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:
+ % 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
- |
-
-
-
-
-
+
+
+ |
+
+
+
+
+ ${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
-
-
-
- |
-
- % endfor
-
+
+ |
+
+
+ |
+ % if not album_b:
+ |
+ % endif
+ % endif
+ % endfor
+
+
+ |
+
+ % endfor
|
% endif
-
-
-
-
|
diff --git a/data/interfaces/newsletters/recently_added.inline.html b/data/interfaces/newsletters/recently_added.inline.html
index 06d3d000..4c5991d4 100644
--- a/data/interfaces/newsletters/recently_added.inline.html
+++ b/data/interfaces/newsletters/recently_added.inline.html
@@ -68,17 +68,14 @@
width: 100%;
}
- /* Set a max-width, and make it display as block so it will automatically stretch to that width, but will also shrink down on a phone or something */
.container {
display: block;
margin: 0 auto !important;
- /* makes it centered */
max-width: 1042px;
padding: 10px;
width: 1042px;
}
- /* This should also be a block element, so that it will fill 100% of the .container */
.content {
box-sizing: border-box;
display: block;
@@ -172,88 +169,9 @@
text-decoration: underline;
}
- /* -------------------------------------
- BUTTONS
- ------------------------------------- */
- .btn {
- box-sizing: border-box;
- width: 100%;
- }
-
- .btn > tbody > tr > td {
- padding-bottom: 15px;
- }
-
- .btn table {
- width: auto;
- }
-
- .btn table td {
- background-color: #ffffff;
- border-radius: 5px;
- text-align: center;
- }
-
- .btn a {
- background-color: #ffffff;
- border: solid 1px #3498db;
- border-radius: 5px;
- box-sizing: border-box;
- color: #3498db;
- cursor: pointer;
- display: inline-block;
- font-size: 14px;
- font-weight: bold;
- margin: 0;
- padding: 12px 25px;
- text-decoration: none;
- text-transform: capitalize;
- }
-
- .btn-primary table td {
- background-color: #3498db;
- }
-
- .btn-primary a {
- background-color: #3498db;
- border-color: #3498db;
- color: #ffffff;
- }
-
/* -------------------------------------
OTHER STYLES THAT MIGHT BE USEFUL
------------------------------------- */
- .last {
- margin-bottom: 0;
- }
-
- .first {
- margin-top: 0;
- }
-
- .align-center {
- text-align: center;
- }
-
- .align-right {
- text-align: right;
- }
-
- .align-left {
- text-align: left;
- }
-
- .clear {
- clear: both;
- }
-
- .mt0 {
- margin-top: 0;
- }
-
- .mb0 {
- margin-bottom: 0;
- }
.mb5 {
margin-bottom: 5px;
}
@@ -263,9 +181,6 @@
text-overflow: ellipsis;
overflow: hidden;
}
- .clear {
- clear: both;
- }
.preheader {
color: transparent;
@@ -324,6 +239,7 @@
margin-left: auto;
margin-right: auto;
}
+
/* -------------------------------------
MEDIA SECTIONS
------------------------------------- */
@@ -378,6 +294,7 @@
font-size: 20px;
text-transform: uppercase;
}
+
/* -------------------------------------
MEDIA CARDS
------------------------------------- */
@@ -480,21 +397,21 @@
padding-left: 5px;
}
.card-info-footer .badge-container {
- max-width: 265px;
+ max-width: 260px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.card-info-footer .star-rating-container {
- width: 60px;
- vertical-align: bottom;
- padding-right: 5px;
+ width: 65px;
}
.card-info-footer .star-rating {
+ margin-left: 4px;
font-size: 0.8rem;
line-height: 1rem;
width: 0.5rem;
display: inline-block;
+ vertical-align: bottom;
}
.star-rating.full {
color: #E5A00D;
@@ -505,6 +422,7 @@
.badge {
display: inline-block;
min-width: 10px;
+ margin-right: 4px;
padding: 3px 7px;
font-size: 11px;
line-height: 1;
@@ -609,21 +527,12 @@
line-height: inherit !important;
text-decoration: none !important;
}
-
- .btn-primary table td:hover {
- background-color: #34495e !important;
- }
-
- .btn-primary a:hover {
- background-color: #34495e !important;
- border-color: #34495e !important;
- }
}
-
-% if preview and service and service != 'self-hosted' :
+
+% if preview and service and service != 'self-hosted':
Note: Local preview images only - images will be uploaded to ${service.capitalize()} when the newsletter is sent.
% elif preview and not service:
Warning: The Image Hosting setting must be enabled for images to display on the newsletter.
@@ -632,19 +541,13 @@
-
-
-
% if base_url and not preview:
% endif
-
-
-
|
-
% if message:
@@ -663,7 +565,6 @@
|
% endif
-
% if recently_added.get('movie'):
@@ -679,109 +580,105 @@
|
-
- % for movie_a, movie_b in grouper(recently_added['movie'], 2):
-
-
-
-
-
- % for movie in (movie_a, movie_b):
- % if movie:
- % if not movie_b:
- |
- % endif
-
-
-
+ % for movie_a, movie_b in grouper(recently_added['movie'], 2):
+
+
+
+
+ % 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 '...')}
-
- |
-
-
-
-
-
+
+
+ |
+
+
+
+
+ ${movie['title']}
+ |
+
+
+
+ % if movie['tagline']:
+
+ ${movie['tagline']}
+
+ % endif
+
+ ${movie['summary'][:450] + (movie['summary'][450:] and '...')}
+
+ |
+
+
+
-
-
- |
- % if not movie_b:
- |
- % endif
- % endif
- % endfor
-
-
-
- |
-
- % endfor
-
+
+ |
+
+
+ |
+ % if not movie_b:
+ |
+ % endif
+ % endif
+ % endfor
+
+
+ |
+
+ % endfor
|
@@ -803,142 +700,137 @@
-
- % for show_a, show_b in grouper(recently_added['show'], 2):
-
-
-
-
-
- % 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']
- %>
-
-
-
+ % for show_a, show_b in grouper(recently_added['show'], 2):
+
+
+
+
+ % 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 /
+ |
+
+ |
+
+
+
+
+ ${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]):
+ % if season['episode_count'] == 1:
+ Season ${season['media_index']} · Episode ${season['episode'][0]['media_index']} - ${season['episode'][0]['title']}
+ % else:
+ Season ${season['media_index']} · 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
-
-
-
- |
-
- % endfor
-
+
+ |
+
+
+ |
+ % if not show_b:
+ |
+ % endif
+ % endif
+ % endfor
+
+
+ |
+
+ % endfor
|
@@ -960,124 +852,114 @@
-
- % 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:
- % if not album_b:
- |
- % endif
-
-
-
+ % 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:
+ % 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
- |
-
-
-
-
-
+
+
+ |
+
+
+
+
+ ${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
-
-
-
- |
-
- % endfor
-
+
+ |
+
+
+ |
+ % if not album_b:
+ |
+ % endif
+ % endif
+ % endfor
+
+
+ |
+
+ % endfor
|
% endif
-
-
-
-
|
diff --git a/plexpy/newsletters.py b/plexpy/newsletters.py
index e93ae078..64c05558 100644
--- a/plexpy/newsletters.py
+++ b/plexpy/newsletters.py
@@ -456,6 +456,7 @@ class Newsletter(object):
for line in self.newsletter.encode('utf-8').splitlines():
if '' not in line:
n_file.write(line + '\r\n')
+ #n_file.write(line.strip())
logger.info(u"Tautulli Newsletters :: %s newsletter saved to '%s'" % (self.NAME, newsletter_file))
except OSError as e:
@@ -464,18 +465,20 @@ class Newsletter(object):
def _send(self):
if self.config['formatted']:
+ newsletter_stripped = ''.join(l.strip() for l in self.newsletter.splitlines())
+
if self.email_config['notifier_id']:
return send_notification(
notifier_id=self.email_config['notifier_id'],
subject=self.subject_formatted,
- body=self.newsletter
+ body=newsletter_stripped
)
else:
email = EMAIL(config=self.email_config)
return email.notify(
subject=self.subject_formatted,
- body=self.newsletter
+ body=newsletter_stripped
)
elif self.config['notifier_id']:
return send_notification(
| | | | | |