mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Add newsletter base URL setting
This commit is contained in:
parent
7e11af1fd0
commit
1cb5f0b635
5 changed files with 51 additions and 21 deletions
|
@ -308,7 +308,8 @@ _CONFIG_DEFINITIONS = {
|
|||
'MONITOR_REMOTE_ACCESS': (int, 'Monitoring', 0),
|
||||
'MONITORING_INTERVAL': (int, 'Monitoring', 60),
|
||||
'MONITORING_USE_WEBSOCKET': (int, 'Monitoring', 0),
|
||||
'NEWSLETTER_DIR': (str, 'General', ''),
|
||||
'NEWSLETTER_DIR': (str, 'Newsletter', ''),
|
||||
'NEWSLETTER_BASE_URL': (str, 'Newsletter', ''),
|
||||
'NMA_APIKEY': (str, 'NMA', ''),
|
||||
'NMA_ENABLED': (int, 'NMA', 0),
|
||||
'NMA_PRIORITY': (int, 'NMA', 0),
|
||||
|
|
|
@ -341,8 +341,6 @@ class Newsletter(object):
|
|||
self.is_preview = False
|
||||
|
||||
def set_config(self, config=None, default=None):
|
||||
self._add_config()
|
||||
|
||||
return self._validate_config(config=config, default=default)
|
||||
|
||||
def _validate_config(self, config=None, default=None):
|
||||
|
@ -353,14 +351,13 @@ class Newsletter(object):
|
|||
for k, v in default.iteritems():
|
||||
if isinstance(v, int):
|
||||
new_config[k] = helpers.cast_to_int(config.get(k, v))
|
||||
elif isinstance(v, list):
|
||||
new_config[k] = list(config.get(k, v))
|
||||
else:
|
||||
new_config[k] = config.get(k, v)
|
||||
|
||||
return new_config
|
||||
|
||||
def _add_config(self):
|
||||
pass
|
||||
|
||||
def retrieve_data(self):
|
||||
pass
|
||||
|
||||
|
@ -448,12 +445,14 @@ class Newsletter(object):
|
|||
def _build_params(self):
|
||||
date_format = helpers.momentjs_to_arrow(plexpy.CONFIG.DATE_FORMAT)
|
||||
|
||||
base_url = plexpy.CONFIG.NEWSLETTER_BASE_URL or helpers.get_plexpy_url()
|
||||
|
||||
parameters = {
|
||||
'server_name': plexpy.CONFIG.PMS_NAME,
|
||||
'start_date': self.start_date.format(date_format),
|
||||
'end_date': self.end_date.format(date_format),
|
||||
'newsletter_days': self.config['last_days'],
|
||||
'newsletter_url': 'http://localhost:8181/dev'.rstrip('/') + '/newsletter/' + self.uuid,
|
||||
'newsletter_url': base_url.rstrip('/') + '/newsletter/' + self.uuid,
|
||||
'newsletter_uuid': self.uuid
|
||||
}
|
||||
|
||||
|
@ -500,24 +499,13 @@ class RecentlyAdded(Newsletter):
|
|||
"""
|
||||
NAME = 'Recently Added'
|
||||
_DEFAULT_CONFIG = {'last_days': 7,
|
||||
'incl_libraries': None
|
||||
'incl_libraries': []
|
||||
}
|
||||
_DEFAULT_SUBJECT = 'Recently Added to {server_name}! ({end_date})'
|
||||
_DEFAULT_BODY = 'View the newsletter here: {newsletter_url}'
|
||||
_TEMPLATE_MASTER = 'recently_added_master.html'
|
||||
_TEMPLATE = 'recently_added.html'
|
||||
|
||||
def __init__(self, config=None, email_config=None, start_date=None, end_date=None, subject=None, body=None):
|
||||
super(RecentlyAdded, self).__init__(config=config, email_config=email_config,
|
||||
start_date=start_date, end_date=end_date,
|
||||
subject=subject, body=body)
|
||||
|
||||
def _add_config(self):
|
||||
if self.config['incl_libraries'] is None:
|
||||
self.config['incl_libraries'] = []
|
||||
elif not isinstance(self.config['incl_libraries'], list):
|
||||
self.config['incl_libraries'] = [self.config['incl_libraries']]
|
||||
|
||||
def _get_recently_added(self, media_type=None):
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
|
||||
|
|
|
@ -2746,7 +2746,8 @@ class WebInterface(object):
|
|||
"themoviedb_lookup": checked(plexpy.CONFIG.THEMOVIEDB_LOOKUP),
|
||||
"tvmaze_lookup": checked(plexpy.CONFIG.TVMAZE_LOOKUP),
|
||||
"show_advanced_settings": plexpy.CONFIG.SHOW_ADVANCED_SETTINGS,
|
||||
"newsletter_dir": plexpy.CONFIG.NEWSLETTER_DIR
|
||||
"newsletter_dir": plexpy.CONFIG.NEWSLETTER_DIR,
|
||||
"newsletter_base_url": plexpy.CONFIG.NEWSLETTER_BASE_URL
|
||||
}
|
||||
|
||||
return serve_template(templatename="settings.html", title="Settings", config=config, kwargs=kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue