% if data: <% import plexpy from plexpy.helpers import grouper, get_img_service recently_added = data['recently_added'] if plexpy.CONFIG.NEWSLETTER_SELF_HOSTED and plexpy.CONFIG.HTTP_BASE_URL: base_url = plexpy.CONFIG.HTTP_BASE_URL + plexpy.HTTP_ROOT + 'newsletter/' elif preview: base_url = 'newsletter/' else: base_url = '' service = get_img_service(include_self=True) if service == 'self-hosted' and plexpy.CONFIG.HTTP_BASE_URL: base_url_image = plexpy.CONFIG.HTTP_BASE_URL + plexpy.HTTP_ROOT + 'newsletter/image/' elif service and service != 'self-hosted' and preview: base_url_image = 'newsletter/image/' else: base_url_image = '' %>
% if preview and service:

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.

% endif

Tautulli Newsletter - ${subject} % if base_url and not preview: Click here to view the full newsletter. % endif
${parameters['server_name']} ${parameters['start_date']} - ${parameters['end_date']}
% if message:
${' '.join(l for l in message.splitlines()) | n}
% endif % if recently_added.get('movie'):
Recently Added Movies ${len(recently_added['movie'])} movie${'s' if len(recently_added['movie']) > 1 else ''}
% 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 '...')}
% if not movie_b: | % endif % endif % endfor
% endfor
% endif % if recently_added.get('show'):
Recently Added TV Shows ${len(recently_added['show'])} show${'s' if len(recently_added['show']) > 1 else ''} / <% total_episodes = sum(season['episode_count'] for show in recently_added['show'] for season in show['season']) %> ${total_episodes} episode${'s' if total > 1 else ''}
% 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 / % 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
% endfor
% endif % if recently_added.get('artist'):
Recently Added Music ${len(recently_added['artist'])} artist${'s' if len(recently_added['artist']) > 1 else ''} / <% total_albums = sum(artist['album_count'] for artist in recently_added['artist']) %> ${total_albums} album${'s' if total > 1 else ''}
% 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
% if not album_b: | % endif % endif % endfor
% endfor
% endif

% endif