mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-30 03:28:31 -07:00
Make self-hosted option global
This commit is contained in:
parent
04641c7c63
commit
e9bdbb863c
6 changed files with 77 additions and 64 deletions
|
@ -989,6 +989,13 @@
|
||||||
<h3>Newsletters</h3>
|
<h3>Newsletters</h3>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="newsletter_self_hosted" name="newsletter_self_hosted" value="1" ${config['newsletter_self_hosted']}> Self-Hosted Newsletters
|
||||||
|
</label>
|
||||||
|
<p class="help-block">Enable to self-host newsletters without uploading images to Imgur.</p>
|
||||||
|
</div>
|
||||||
|
<div id="newsletter_self_hosted_options">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="newsletter_base_url">Newsletter Base URL</label>
|
<label for="newsletter_base_url">Newsletter Base URL</label>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -1004,6 +1011,7 @@
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block">Set your Tautulli base URL for self-hosted newsletters. (e.g. http://mydomain.com)</p>
|
<p class="help-block">Set your Tautulli base URL for self-hosted newsletters. (e.g. http://mydomain.com)</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>
|
<p><input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully"></p>
|
||||||
|
|
||||||
|
@ -1756,6 +1764,7 @@ $(document).ready(function() {
|
||||||
initConfigCheckbox('#check_github');
|
initConfigCheckbox('#check_github');
|
||||||
initConfigCheckbox('#notify_upload_posters');
|
initConfigCheckbox('#notify_upload_posters');
|
||||||
initConfigCheckbox('#monitor_pms_updates');
|
initConfigCheckbox('#monitor_pms_updates');
|
||||||
|
initConfigCheckbox('#newsletter_self_hosted');
|
||||||
|
|
||||||
$('#menu_link_shutdown').click(function() {
|
$('#menu_link_shutdown').click(function() {
|
||||||
$('#confirm-message').text("Are you sure you want to shutdown Tautulli?");
|
$('#confirm-message').text("Are you sure you want to shutdown Tautulli?");
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
% if data:
|
% if data:
|
||||||
<%
|
<%
|
||||||
|
import plexpy
|
||||||
|
|
||||||
recently_added = data['recently_added']
|
recently_added = data['recently_added']
|
||||||
|
base_url = ''
|
||||||
|
if self_hosted and plexpy.CONFIG.NEWSLETTER_BASE_URL:
|
||||||
|
base_url = plexpy.CONFIG.NEWSLETTER_BASE_URL + '/'
|
||||||
%>
|
%>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
@ -567,7 +572,7 @@
|
||||||
<div class="content" style="box-sizing: border-box;display: block;margin: 0 auto;max-width: 1042px;padding: 10px;">
|
<div class="content" style="box-sizing: border-box;display: block;margin: 0 auto;max-width: 1042px;padding: 10px;">
|
||||||
|
|
||||||
<!-- START CENTERED WHITE CONTAINER -->
|
<!-- START CENTERED WHITE CONTAINER -->
|
||||||
<span class="preheader" style="color: transparent;display: none;height: 0;max-height: 0;max-width: 0;opacity: 0;overflow: hidden;mso-hide: all;visibility: hidden;width: 0;">Tautulli Newsletter - ${title}</span>
|
<span class="preheader" style="color: transparent;display: none;height: 0;max-height: 0;max-width: 0;opacity: 0;overflow: hidden;mso-hide: all;visibility: hidden;width: 0;">Tautulli card-backbro - ${title}</span>
|
||||||
|
|
||||||
<table border="0" cellpadding="0" cellspacing="0" class="main" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background: #282A2D;border-radius: 3px;color: #ffffff;">
|
<table border="0" cellpadding="0" cellspacing="0" class="main" style="border-collapse: separate;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 100%;background: #282A2D;border-radius: 3px;color: #ffffff;">
|
||||||
|
|
||||||
|
@ -601,14 +606,14 @@
|
||||||
% else:
|
% else:
|
||||||
<div class="card-instance movie" style="float: left;width: 500px;margin: 3px;border: 1px solid rgba(255,255,255,.1);-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;font-size: 12px;overflow: hidden;position: relative;height: 235px;">
|
<div class="card-instance movie" style="float: left;width: 500px;margin: 3px;border: 1px solid rgba(255,255,255,.1);-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;font-size: 12px;overflow: hidden;position: relative;height: 235px;">
|
||||||
% endif
|
% endif
|
||||||
% if preview:
|
% if self_hosted:
|
||||||
<div class="card-background" style="background-image: url(${'pms_image_proxy?img=' + movie['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
<div class="card-background" style="background-image: url(${base_url + 'pms_image_proxy?img=' + movie['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
||||||
% else:
|
% else:
|
||||||
<div class="card-background" style="background-image: url(${movie['art_url']});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
<div class="card-background" style="background-image: url(${movie['art_url']});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
||||||
% endif
|
% endif
|
||||||
<div class="card-poster-container" style="width: 150px;margin: 3px;border: 1px solid rgba(255,255,255,.1);float: left;position: relative;z-index: 1;height: 225px;">
|
<div class="card-poster-container" style="width: 150px;margin: 3px;border: 1px solid rgba(255,255,255,.1);float: left;position: relative;z-index: 1;height: 225px;">
|
||||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${movie['rating_key']}" title="${movie['title']}" target="_blank" style="color: #3498db;text-decoration: underline;">
|
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${movie['rating_key']}" title="${movie['title']}" target="_blank" style="color: #3498db;text-decoration: underline;">
|
||||||
<div class="card-poster" style="background-image: url(${'pms_image_proxy?img=' + movie['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if preview else movie['poster_url']});background-color: #3F4245;background-position: center;background-size: cover;height: 100%;width: 100%;">
|
<div class="card-poster" style="background-image: url(${base_url + 'pms_image_proxy?img=' + movie['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if self_hosted else movie['poster_url']});background-color: #3F4245;background-position: center;background-size: cover;height: 100%;width: 100%;">
|
||||||
<div class="card-poster-overlay" style="background: url(https://cdn.discordapp.com/attachments/334355557706235906/401064397780287489/newsletter-view-on-plex-flat.png) bottom right no-repeat;width: 100%;height: 100%;"></div>
|
<div class="card-poster-overlay" style="background: url(https://cdn.discordapp.com/attachments/334355557706235906/401064397780287489/newsletter-view-on-plex-flat.png) bottom right no-repeat;width: 100%;height: 100%;"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -684,14 +689,14 @@
|
||||||
% else:
|
% else:
|
||||||
<div class="card-instance show" style="float: left;width: 500px;margin: 3px;border: 1px solid rgba(255,255,255,.1);-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;font-size: 12px;overflow: hidden;position: relative;height: 235px;">
|
<div class="card-instance show" style="float: left;width: 500px;margin: 3px;border: 1px solid rgba(255,255,255,.1);-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;font-size: 12px;overflow: hidden;position: relative;height: 235px;">
|
||||||
% endif
|
% endif
|
||||||
% if preview:
|
% if self_hosted:
|
||||||
<div class="card-background" style="background-image: url(${'pms_image_proxy?img=' + show['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
<div class="card-background" style="background-image: url(${base_url + 'pms_image_proxy?img=' + show['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
||||||
% else:
|
% else:
|
||||||
<div class="card-background" style="background-image: url(${show['art_url']});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
<div class="card-background" style="background-image: url(${show['art_url']});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
||||||
% endif
|
% endif
|
||||||
<div class="card-poster-container" style="width: 150px;margin: 3px;border: 1px solid rgba(255,255,255,.1);float: left;position: relative;z-index: 1;height: 225px;">
|
<div class="card-poster-container" style="width: 150px;margin: 3px;border: 1px solid rgba(255,255,255,.1);float: left;position: relative;z-index: 1;height: 225px;">
|
||||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${link_rating_key}" title="${link_title}" target="_blank" style="color: #3498db;text-decoration: underline;">
|
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${link_rating_key}" title="${link_title}" target="_blank" style="color: #3498db;text-decoration: underline;">
|
||||||
<div class="card-poster" style="background-image: url(${'pms_image_proxy?img=' + show['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if preview else show['poster_url']});background-color: #3F4245;background-position: center;background-size: cover;height: 100%;width: 100%;">
|
<div class="card-poster" style="background-image: url(${base_url + 'pms_image_proxy?img=' + show['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if self_hosted else show['poster_url']});background-color: #3F4245;background-position: center;background-size: cover;height: 100%;width: 100%;">
|
||||||
<div class="card-poster-overlay" style="background: url(https://cdn.discordapp.com/attachments/334355557706235906/401064397780287489/newsletter-view-on-plex-flat.png) bottom right no-repeat;width: 100%;height: 100%;"></div>
|
<div class="card-poster-overlay" style="background: url(https://cdn.discordapp.com/attachments/334355557706235906/401064397780287489/newsletter-view-on-plex-flat.png) bottom right no-repeat;width: 100%;height: 100%;"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -789,14 +794,14 @@
|
||||||
% else:
|
% else:
|
||||||
<div class="card-instance album" style="float: left;width: 500px;margin: 3px;border: 1px solid rgba(255,255,255,.1);-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;font-size: 12px;overflow: hidden;position: relative;height: 160px;">
|
<div class="card-instance album" style="float: left;width: 500px;margin: 3px;border: 1px solid rgba(255,255,255,.1);-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;font-size: 12px;overflow: hidden;position: relative;height: 160px;">
|
||||||
% endif
|
% endif
|
||||||
% if preview:
|
% if self_hosted:
|
||||||
<div class="card-background" style="background-image: url(${'pms_image_proxy?img=' + album['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});">
|
<div class="card-background" style="background-image: url(${base_url + 'pms_image_proxy?img=' + album['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
||||||
% else:
|
% else:
|
||||||
<div class="card-background" style="background-image: url(${album['art_url']});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
<div class="card-background" style="background-image: url(${album['art_url']});background-position: center;background-size: cover;width: 100%;height: 100%;">
|
||||||
% endif
|
% endif
|
||||||
<div class="card-poster-container" style="width: 150px;margin: 3px;border: 1px solid rgba(255,255,255,.1);float: left;position: relative;z-index: 1;height: 150px;">
|
<div class="card-poster-container" style="width: 150px;margin: 3px;border: 1px solid rgba(255,255,255,.1);float: left;position: relative;z-index: 1;height: 150px;">
|
||||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${album['rating_key']}" title="${album['title']}" target="_blank" style="color: #3498db;text-decoration: underline;">
|
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${album['rating_key']}" title="${album['title']}" target="_blank" style="color: #3498db;text-decoration: underline;">
|
||||||
<div class="card-poster" style="background-image: url(${'pms_image_proxy?img=' + album['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if preview else album['poster_url']});background-color: #3F4245;background-position: center;background-size: cover;height: 100%;width: 100%;">
|
<div class="card-poster" style="background-image: url(${base_url + 'pms_image_proxy?img=' + album['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if self_hosted else album['poster_url']});background-color: #3F4245;background-position: center;background-size: cover;height: 100%;width: 100%;">
|
||||||
<div class="card-poster-overlay" style="background: url(https://cdn.discordapp.com/attachments/334355557706235906/401064397780287489/newsletter-view-on-plex-flat.png) bottom right no-repeat;width: 100%;height: 100%;"></div>
|
<div class="card-poster-overlay" style="background: url(https://cdn.discordapp.com/attachments/334355557706235906/401064397780287489/newsletter-view-on-plex-flat.png) bottom right no-repeat;width: 100%;height: 100%;"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
% if data:
|
% if data:
|
||||||
<%
|
<%
|
||||||
|
import plexpy
|
||||||
|
|
||||||
recently_added = data['recently_added']
|
recently_added = data['recently_added']
|
||||||
|
base_url = ''
|
||||||
|
if self_hosted and plexpy.CONFIG.NEWSLETTER_BASE_URL:
|
||||||
|
base_url = plexpy.CONFIG.NEWSLETTER_BASE_URL + '/'
|
||||||
%>
|
%>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
|
@ -601,14 +606,14 @@
|
||||||
% else:
|
% else:
|
||||||
<div class="card-instance movie">
|
<div class="card-instance movie">
|
||||||
% endif
|
% endif
|
||||||
% if preview:
|
% if self_hosted:
|
||||||
<div class="card-background" style="background-image: url(${'pms_image_proxy?img=' + movie['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});">
|
<div class="card-background" style="background-image: url(${base_url + 'pms_image_proxy?img=' + movie['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});">
|
||||||
% else:
|
% else:
|
||||||
<div class="card-background" style="background-image: url(${movie['art_url']});">
|
<div class="card-background" style="background-image: url(${movie['art_url']});">
|
||||||
% endif
|
% endif
|
||||||
<div class="card-poster-container">
|
<div class="card-poster-container">
|
||||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${movie['rating_key']}" title="${movie['title']}" target="_blank">
|
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${movie['rating_key']}" title="${movie['title']}" target="_blank">
|
||||||
<div class="card-poster" style="background-image: url(${'pms_image_proxy?img=' + movie['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if preview else movie['poster_url']})">
|
<div class="card-poster" style="background-image: url(${base_url + 'pms_image_proxy?img=' + movie['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if self_hosted else movie['poster_url']})">
|
||||||
<div class="card-poster-overlay"></div>
|
<div class="card-poster-overlay"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -684,14 +689,14 @@
|
||||||
% else:
|
% else:
|
||||||
<div class="card-instance show">
|
<div class="card-instance show">
|
||||||
% endif
|
% endif
|
||||||
% if preview:
|
% if self_hosted:
|
||||||
<div class="card-background" style="background-image: url(${'pms_image_proxy?img=' + show['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});">
|
<div class="card-background" style="background-image: url(${base_url + 'pms_image_proxy?img=' + show['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});">
|
||||||
% else:
|
% else:
|
||||||
<div class="card-background" style="background-image: url(${show['art_url']});">
|
<div class="card-background" style="background-image: url(${show['art_url']});">
|
||||||
% endif
|
% endif
|
||||||
<div class="card-poster-container">
|
<div class="card-poster-container">
|
||||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${link_rating_key}" title="${link_title}" target="_blank">
|
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${link_rating_key}" title="${link_title}" target="_blank">
|
||||||
<div class="card-poster" style="background-image: url(${'pms_image_proxy?img=' + show['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if preview else show['poster_url']});">
|
<div class="card-poster" style="background-image: url(${base_url + 'pms_image_proxy?img=' + show['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if self_hosted else show['poster_url']});">
|
||||||
<div class="card-poster-overlay"></div>
|
<div class="card-poster-overlay"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
@ -789,14 +794,14 @@
|
||||||
% else:
|
% else:
|
||||||
<div class="card-instance album">
|
<div class="card-instance album">
|
||||||
% endif
|
% endif
|
||||||
% if preview:
|
% if self_hosted:
|
||||||
<div class="card-background" style="background-image: url(${'pms_image_proxy?img=' + album['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});">
|
<div class="card-background" style="background-image: url(${base_url + 'pms_image_proxy?img=' + album['art'] + '&width=500&height=280&opacity=25&background=282828&blur=3&fallback=art&refresh=true'});">
|
||||||
% else:
|
% else:
|
||||||
<div class="card-background" style="background-image: url(${album['art_url']});">
|
<div class="card-background" style="background-image: url(${album['art_url']});">
|
||||||
% endif
|
% endif
|
||||||
<div class="card-poster-container">
|
<div class="card-poster-container">
|
||||||
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${album['rating_key']}" title="${album['title']}" target="_blank">
|
<a href="${parameters['pms_web_url']}#!/server/${parameters['pms_identifier']}/details?key=%2Flibrary%2Fmetadata%2F${album['rating_key']}" title="${album['title']}" target="_blank">
|
||||||
<div class="card-poster" style="background-image: url(${'pms_image_proxy?img=' + album['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if preview else album['poster_url']});">
|
<div class="card-poster" style="background-image: url(${base_url + 'pms_image_proxy?img=' + album['thumb'] + '&width=300&height=450&fallback=poster&refresh=true' if self_hosted else album['poster_url']});">
|
||||||
<div class="card-poster-overlay"></div>
|
<div class="card-poster-overlay"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -248,7 +248,6 @@ _CONFIG_DEFINITIONS = {
|
||||||
'HIPCHAT_ON_CONCURRENT': (int, 'Hipchat', 0),
|
'HIPCHAT_ON_CONCURRENT': (int, 'Hipchat', 0),
|
||||||
'HIPCHAT_ON_NEWDEVICE': (int, 'Hipchat', 0),
|
'HIPCHAT_ON_NEWDEVICE': (int, 'Hipchat', 0),
|
||||||
'INTERFACE': (str, 'General', 'default'),
|
'INTERFACE': (str, 'General', 'default'),
|
||||||
'INTERFACE_NEWSLETTERS': (str, 'General', 'newsletters'),
|
|
||||||
'IP_LOGGING_ENABLE': (int, 'General', 0),
|
'IP_LOGGING_ENABLE': (int, 'General', 0),
|
||||||
'IFTTT_KEY': (str, 'IFTTT', ''),
|
'IFTTT_KEY': (str, 'IFTTT', ''),
|
||||||
'IFTTT_EVENT': (str, 'IFTTT', 'tautulli'),
|
'IFTTT_EVENT': (str, 'IFTTT', 'tautulli'),
|
||||||
|
@ -308,7 +307,9 @@ _CONFIG_DEFINITIONS = {
|
||||||
'MONITOR_REMOTE_ACCESS': (int, 'Monitoring', 0),
|
'MONITOR_REMOTE_ACCESS': (int, 'Monitoring', 0),
|
||||||
'MONITORING_INTERVAL': (int, 'Monitoring', 60),
|
'MONITORING_INTERVAL': (int, 'Monitoring', 60),
|
||||||
'MONITORING_USE_WEBSOCKET': (int, 'Monitoring', 0),
|
'MONITORING_USE_WEBSOCKET': (int, 'Monitoring', 0),
|
||||||
|
'NEWSLETTER_TEMPLATES': (str, 'Newsletter', 'newsletters'),
|
||||||
'NEWSLETTER_DIR': (str, 'Newsletter', ''),
|
'NEWSLETTER_DIR': (str, 'Newsletter', ''),
|
||||||
|
'NEWSLETTER_SELF_HOSTED': (int, 'Newsletter', 0),
|
||||||
'NEWSLETTER_BASE_URL': (str, 'Newsletter', ''),
|
'NEWSLETTER_BASE_URL': (str, 'Newsletter', ''),
|
||||||
'NMA_APIKEY': (str, 'NMA', ''),
|
'NMA_APIKEY': (str, 'NMA', ''),
|
||||||
'NMA_ENABLED': (int, 'NMA', 0),
|
'NMA_ENABLED': (int, 'NMA', 0),
|
||||||
|
|
|
@ -262,7 +262,7 @@ def send_newsletter(newsletter_id=None, subject=None, body=None, newsletter_log_
|
||||||
|
|
||||||
def serve_template(templatename, **kwargs):
|
def serve_template(templatename, **kwargs):
|
||||||
interface_dir = os.path.join(str(plexpy.PROG_DIR), 'data/interfaces/')
|
interface_dir = os.path.join(str(plexpy.PROG_DIR), 'data/interfaces/')
|
||||||
template_dir = os.path.join(str(interface_dir), plexpy.CONFIG.INTERFACE_NEWSLETTERS)
|
template_dir = os.path.join(str(interface_dir), plexpy.CONFIG.NEWSLETTER_TEMPLATES)
|
||||||
|
|
||||||
_hplookup = TemplateLookup(directories=[template_dir], default_filters=['unicode', 'h'])
|
_hplookup = TemplateLookup(directories=[template_dir], default_filters=['unicode', 'h'])
|
||||||
|
|
||||||
|
@ -289,8 +289,7 @@ def generate_newsletter_uuid():
|
||||||
|
|
||||||
class Newsletter(object):
|
class Newsletter(object):
|
||||||
NAME = ''
|
NAME = ''
|
||||||
_DEFAULT_CONFIG = {'last_days': 7,
|
_DEFAULT_CONFIG = {'last_days': 7}
|
||||||
'self_hosted': 0}
|
|
||||||
_DEFAULT_EMAIL_CONFIG = EMAIL().return_default_config()
|
_DEFAULT_EMAIL_CONFIG = EMAIL().return_default_config()
|
||||||
_DEFAULT_EMAIL_CONFIG['from_name'] = 'Tautulli Newsletter'
|
_DEFAULT_EMAIL_CONFIG['from_name'] = 'Tautulli Newsletter'
|
||||||
_DEFAULT_EMAIL_CONFIG['notifier'] = 0
|
_DEFAULT_EMAIL_CONFIG['notifier'] = 0
|
||||||
|
@ -337,7 +336,7 @@ class Newsletter(object):
|
||||||
self.data = {}
|
self.data = {}
|
||||||
self.newsletter = None
|
self.newsletter = None
|
||||||
|
|
||||||
self.is_preview = bool(self.config['self_hosted'])
|
self.is_preview = False
|
||||||
|
|
||||||
def set_config(self, config=None, default=None):
|
def set_config(self, config=None, default=None):
|
||||||
return self._validate_config(config=config, default=default)
|
return self._validate_config(config=config, default=default)
|
||||||
|
@ -372,6 +371,7 @@ class Newsletter(object):
|
||||||
self.is_preview = True
|
self.is_preview = True
|
||||||
|
|
||||||
self.retrieve_data()
|
self.retrieve_data()
|
||||||
|
|
||||||
return {'title': self.NAME,
|
return {'title': self.NAME,
|
||||||
'parameters': self.parameters,
|
'parameters': self.parameters,
|
||||||
'data': self.data}
|
'data': self.data}
|
||||||
|
@ -392,17 +392,13 @@ class Newsletter(object):
|
||||||
title=self.subject_formatted,
|
title=self.subject_formatted,
|
||||||
parameters=self.parameters,
|
parameters=self.parameters,
|
||||||
data=self.data,
|
data=self.data,
|
||||||
preview=self.is_preview
|
self_hosted=self.is_preview or plexpy.CONFIG.NEWSLETTER_SELF_HOSTED
|
||||||
)
|
)
|
||||||
|
|
||||||
def send(self):
|
def send(self):
|
||||||
self.newsletter = self.generate_newsletter()
|
self.newsletter = self.generate_newsletter()
|
||||||
|
|
||||||
self._save()
|
self._save()
|
||||||
|
|
||||||
if self.is_preview:
|
|
||||||
return True
|
|
||||||
|
|
||||||
return self._send()
|
return self._send()
|
||||||
|
|
||||||
def _save(self):
|
def _save(self):
|
||||||
|
@ -498,12 +494,6 @@ class Newsletter(object):
|
||||||
|
|
||||||
def _return_config_options(self):
|
def _return_config_options(self):
|
||||||
config_options = [
|
config_options = [
|
||||||
{'label': 'Self-Hosted',
|
|
||||||
'value': self.config['self_hosted'],
|
|
||||||
'description': 'Self-host this newsletter.',
|
|
||||||
'name': 'newsletter_config_self_hosted',
|
|
||||||
'input_type': 'checkbox'
|
|
||||||
},
|
|
||||||
{'label': 'Number of Days',
|
{'label': 'Number of Days',
|
||||||
'value': self.config['last_days'],
|
'value': self.config['last_days'],
|
||||||
'name': 'newsletter_config_last_days',
|
'name': 'newsletter_config_last_days',
|
||||||
|
@ -670,6 +660,7 @@ class RecentlyAdded(Newsletter):
|
||||||
artists = recently_added.get('artist', [])
|
artists = recently_added.get('artist', [])
|
||||||
albums = [a for artist in artists for a in artist['album']]
|
albums = [a for artist in artists for a in artist['album']]
|
||||||
|
|
||||||
|
if not plexpy.CONFIG.NEWSLETTER_SELF_HOSTED:
|
||||||
for item in movies + shows + albums:
|
for item in movies + shows + albums:
|
||||||
poster_info = get_poster_info(poster_thumb=item['thumb'],
|
poster_info = get_poster_info(poster_thumb=item['thumb'],
|
||||||
poster_key=item['rating_key'],
|
poster_key=item['rating_key'],
|
||||||
|
|
|
@ -2747,6 +2747,7 @@ class WebInterface(object):
|
||||||
"tvmaze_lookup": checked(plexpy.CONFIG.TVMAZE_LOOKUP),
|
"tvmaze_lookup": checked(plexpy.CONFIG.TVMAZE_LOOKUP),
|
||||||
"show_advanced_settings": plexpy.CONFIG.SHOW_ADVANCED_SETTINGS,
|
"show_advanced_settings": plexpy.CONFIG.SHOW_ADVANCED_SETTINGS,
|
||||||
"newsletter_dir": plexpy.CONFIG.NEWSLETTER_DIR,
|
"newsletter_dir": plexpy.CONFIG.NEWSLETTER_DIR,
|
||||||
|
"newsletter_self_hosted": checked(plexpy.CONFIG.NEWSLETTER_SELF_HOSTED),
|
||||||
"newsletter_base_url": plexpy.CONFIG.NEWSLETTER_BASE_URL
|
"newsletter_base_url": plexpy.CONFIG.NEWSLETTER_BASE_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2768,7 +2769,8 @@ class WebInterface(object):
|
||||||
"monitor_pms_updates", "monitor_remote_access", "get_file_sizes", "log_blacklist", "http_hash_password",
|
"monitor_pms_updates", "monitor_remote_access", "get_file_sizes", "log_blacklist", "http_hash_password",
|
||||||
"allow_guest_access", "cache_images", "http_proxy", "http_basic_auth", "notify_concurrent_by_ip",
|
"allow_guest_access", "cache_images", "http_proxy", "http_basic_auth", "notify_concurrent_by_ip",
|
||||||
"history_table_activity", "plexpy_auto_update",
|
"history_table_activity", "plexpy_auto_update",
|
||||||
"themoviedb_lookup", "tvmaze_lookup", "http_plex_admin"
|
"themoviedb_lookup", "tvmaze_lookup", "http_plex_admin",
|
||||||
|
"newsletter_self_hosted"
|
||||||
]
|
]
|
||||||
for checked_config in checked_configs:
|
for checked_config in checked_configs:
|
||||||
if checked_config not in kwargs:
|
if checked_config not in kwargs:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue