% 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 + 'image/' elif preview and service and service != 'self-hosted': base_url_image = 'image/' else: base_url_image = '' %> Tautulli Newsletter - ${subject} % 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.

% endif
% if base_url and not preview: % endif % if message: % endif % if recently_added.get('movie'): % endif % if recently_added.get('show'): % endif % if recently_added.get('artist'): % endif % if recently_added.get('other_video'): % endif
${parameters['server_name']}
${parameters['start_date']} - ${parameters['end_date']}
${'
'.join(l for l in message.splitlines()) | n}
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): % endfor
% for movie in (movie_a, movie_b): % if movie: % if not movie_b: % endif % if not movie_b: % endif % endif % endfor
${movie['title']}
% if movie['tagline']:

${movie['tagline']}

% endif

${movie['summary'][:450] + (movie['summary'][450:] and '...')}

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_episodes > 1 else ''}
% for show_a, show_b in grouper(recently_added['show'], 2): % endfor
% 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'] %> % if not show_b: % endif % endif % endfor
${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: <% remaining_seasons = show['season_count'] - 8 %> ...plus ${remaining_seasons} more season${'s' if remaining_seasons > 1 else ''}! % 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

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_albums > 1 else ''}
% for album_a, album_b in grouper([a for artist in recently_added['artist'] for a in artist['album']], 2): % endfor
% for album in (album_a, album_b): % if album: % if not album_b: % endif % if not album_b: % endif % endif % endfor
${album['title']}

${album['parent_title']} · ${album['track_count']} track${'s' if album['track_count'] > 1 else ''}

% if album['parent_title'].lower() != 'various artists':

${album['summary'][:200] + (album['summary'][200:] and '...')}

% endif
Recently Added Videos
${len(recently_added['other_video'])} video${'s' if len(recently_added['other_video']) > 1 else ''}
% for video_a, video_b in grouper(recently_added['other_video'], 2): % endfor
% for video in (video_a, video_b): % if video: % if not video_b: % endif % if not video_b: % endif % endif % endfor
${video['title']}
% if video['tagline']:

${video['tagline']}

% endif

${video['summary'][:450] + (video['summary'][450:] and '...')}

% endif