% if data: <% import plexpy from plexpy.helpers import grouper 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/' base_url_image = base_url + 'image/' elif preview: base_url = 'newsletter/' base_url_image = base_url + 'image/' else: base_url = base_url_image = '' %> Tautulli Newsletter - ${subject}
% 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
${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 > 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]): 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

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): % 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 artist['title'].lower() != 'various artists':

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

% endif
% endif