Uncoulpe self-hosted newsletter and image setting

This commit is contained in:
JonnyWong16 2018-05-06 08:33:28 -07:00
commit 04fcd78102
4 changed files with 27 additions and 16 deletions

View file

@ -956,8 +956,7 @@
</div>
<div id="self_host_newsletter_options" style="overlfow: hidden; display: ${'block' if config['newsletter_self_hosted'] == 'checked' else 'none'}">
<p class="help-block" id="self_host_newsletter_message">
Note: The <span class="inline-pre">${http_root}newsletter</span> endpoint on your domain must be publicly accessible from the internet.<br>
Note: Newsletter images will be self-hosted regardless of the Image Hosting setting below.<br>
Note: The <span class="inline-pre">${http_root}newsletter</span> endpoint on your domain must be publicly accessible from the internet.
</p>
<p class="help-block settings-warning base-url-warning">Warning: Public Tautulli domain not set under <a data-tab-destination="tabs-web_interface" data-target="#http_base_url">Web Interface</a>.</p>
</div>
@ -1084,7 +1083,7 @@
Add a new newsletter agent, or configure an existing newsletter agent by clicking the settings icon on the right.
</p>
<p class="help-block settings-warning" id="newsletter_upload_warning">
Warning: Either <em>online</em> <a data-tab-destination="tabs-notifications" data-target="#notify_upload_posters">Image Hosting</a> or <a data-tab-destination="tabs-notifications" data-target="#newsletter_self_hosted">Self-Hosted Newsletters</a> must be enabled.</span>
Warning: <a data-tab-destination="tabs-notifications" data-target="#notify_upload_posters">Image Hosting</a> must be enabled for images to display on the newsletter.</span>
</p>
<br/>
<div id="plexpy-newsletters-table">
@ -2605,10 +2604,10 @@ $(document).ready(function() {
});
function newsletterUploadEnabled() {
if ($('#notify_upload_posters').val() !== '2' || $('#newsletter_self_hosted').is(':checked')) {
$('#newsletter_upload_warning').hide();
} else {
if ($('#notify_upload_posters').val() === '0') {
$('#newsletter_upload_warning').show();
} else {
$('#newsletter_upload_warning').hide();
}
}
newsletterUploadEnabled();

View file

@ -1,17 +1,23 @@
% if data:
<%
import plexpy
from plexpy.helpers import grouper
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/'
base_url_image = base_url + 'image/'
elif preview:
base_url = 'newsletter/'
base_url_image = base_url + 'image/'
else:
base_url = base_url_image = ''
base_url = ''
if get_img_service(include_self=True) == 'self-hosted' and plexpy.CONFIG.HTTP_BASE_URL:
base_url_image = plexpy.CONFIG.HTTP_BASE_URL + plexpy.HTTP_ROOT + 'newsletter/image/'
elif preview:
base_url_image = 'newsletter/image/'
else:
base_url_image = ''
%>
<!doctype html>
<html>

View file

@ -1,17 +1,23 @@
% if data:
<%
import plexpy
from plexpy.helpers import grouper
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/'
base_url_image = base_url + 'image/'
elif preview:
base_url = 'newsletter/'
base_url_image = base_url + 'image/'
else:
base_url = base_url_image = ''
base_url = ''
if get_img_service(include_self=True) == 'self-hosted' and plexpy.CONFIG.HTTP_BASE_URL:
base_url_image = plexpy.CONFIG.HTTP_BASE_URL + plexpy.HTTP_ROOT + 'newsletter/image/'
elif preview:
base_url_image = 'newsletter/image/'
else:
base_url_image = ''
%>
<!doctype html>
<html>

View file

@ -695,7 +695,7 @@ class RecentlyAdded(Newsletter):
artists = recently_added.get('artist', [])
albums = [a for artist in artists for a in artist['album']]
if self.is_preview or plexpy.CONFIG.NEWSLETTER_SELF_HOSTED:
if self.is_preview or helpers.get_img_service(include_self=True) == 'self-hosted':
for item in movies + shows + albums:
if item['media_type'] == 'album':
height = 150
@ -717,7 +717,7 @@ class RecentlyAdded(Newsletter):
item['poster_url'] = ''
item['art_url'] = ''
else:
elif helpers.get_img_service():
# Upload posters and art to image hosting service
for item in movies + shows + albums:
if item['media_type'] == 'album':