mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Cleanup save settings
This commit is contained in:
parent
0e53252a27
commit
e2ac8be451
2 changed files with 31 additions and 48 deletions
|
@ -224,7 +224,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
<li class="card card-sortable">
|
<li class="card card-sortable">
|
||||||
<div class="card-handle"><i class="fa fa-bars"></i></div>
|
<div class="card-handle"><i class="fa fa-bars"></i></div>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="hscard-last_watched" name="hscard-last_watched" value="last_watched"> Last Played
|
<input type="checkbox" id="hscard-last_watched" name="hscard-last_watched" value="last_watched"> Last Watched
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="card card-sortable">
|
<li class="card card-sortable">
|
||||||
|
@ -475,7 +475,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" id="pms_identifier" name="pms_identifier" value="${config['pms_identifier']}">
|
<input type="hidden" id="pms_identifier" name="pms_identifier" value="${config['pms_identifier']}">
|
||||||
<input type="checkbox" name="server_changed" id="server_changed" value="1" style="display:none">
|
<input type="checkbox" name="server_changed" id="server_changed" value="1" style="display: none;">
|
||||||
|
|
||||||
<div class="padded-header">
|
<div class="padded-header">
|
||||||
<h3>Plex Logs</h3>
|
<h3>Plex Logs</h3>
|
||||||
|
@ -1381,7 +1381,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>{media_type}</strong></td>
|
<td><strong>{media_type}</strong></td>
|
||||||
<td>The type of media (movie, episode, track).</td>
|
<td>The type of media. <span class="small-muted">(movie, episode, track)</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>{title}</strong></td>
|
<td><strong>{title}</strong></td>
|
||||||
|
@ -1481,10 +1481,8 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>{poster_url}</strong></td>
|
<td><strong>{poster_url}</strong></td>
|
||||||
<td>
|
<td>A URL for the movie or TV show poster.
|
||||||
A URL for the movie or TV show poster.<br />
|
<p class="small-muted">(PMS agent must be Freebase or TheTVDB)</p></td>
|
||||||
<p class="small-muted">(PMS agent must be Freebase or TheTVDB)</p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>{imdb_id}</strong></td>
|
<td><strong>{imdb_id}</strong></td>
|
||||||
|
|
|
@ -1244,11 +1244,11 @@ class WebInterface(object):
|
||||||
for checked_config in checked_configs:
|
for checked_config in checked_configs:
|
||||||
if checked_config not in kwargs:
|
if checked_config not in kwargs:
|
||||||
# checked items should be zero or one. if they were not sent then the item was not checked
|
# checked items should be zero or one. if they were not sent then the item was not checked
|
||||||
kwargs[checked_config] = 0
|
kwargs[checked_config] = '0'
|
||||||
|
|
||||||
# If http password exists in config, do not overwrite when blank value received
|
# If http password exists in config, do not overwrite when blank value received
|
||||||
if 'http_password' in kwargs:
|
if kwargs.get('http_password'):
|
||||||
if kwargs['http_password'] == ' ' and plexpy.CONFIG.HTTP_PASSWORD != '':
|
if kwargs['http_password'].strip() == '' and plexpy.CONFIG.HTTP_PASSWORD != '':
|
||||||
kwargs['http_password'] = plexpy.CONFIG.HTTP_PASSWORD
|
kwargs['http_password'] = plexpy.CONFIG.HTTP_PASSWORD
|
||||||
|
|
||||||
for plain_config, use_config in [(x[4:], x) for x in kwargs if x.startswith('use_')]:
|
for plain_config, use_config in [(x[4:], x) for x in kwargs if x.startswith('use_')]:
|
||||||
|
@ -1258,50 +1258,34 @@ class WebInterface(object):
|
||||||
|
|
||||||
# Check if we should refresh our data
|
# Check if we should refresh our data
|
||||||
server_changed = False
|
server_changed = False
|
||||||
|
reschedule = False
|
||||||
https_changed = False
|
https_changed = False
|
||||||
refresh_libraries = False
|
refresh_libraries = False
|
||||||
refresh_users = False
|
refresh_users = False
|
||||||
reschedule = False
|
|
||||||
|
|
||||||
if 'monitoring_interval' in kwargs and 'refresh_libraries_interval' in kwargs:
|
# If we change any monitoring settings, make sure we reschedule tasks.
|
||||||
if (kwargs['monitoring_interval'] != str(plexpy.CONFIG.MONITORING_INTERVAL)) or \
|
if kwargs.get('monitoring_interval') != str(plexpy.CONFIG.MONITORING_INTERVAL) or \
|
||||||
(kwargs['refresh_libraries_interval'] != str(plexpy.CONFIG.REFRESH_LIBRARIES_INTERVAL)):
|
kwargs.get('refresh_libraries_interval') != str(plexpy.CONFIG.REFRESH_LIBRARIES_INTERVAL) or \
|
||||||
reschedule = True
|
kwargs.get('refresh_users_interval') != str(plexpy.CONFIG.REFRESH_USERS_INTERVAL) or \
|
||||||
|
kwargs.get('notify_recently_added') != str(plexpy.CONFIG.NOTIFY_RECENTLY_ADDED) or \
|
||||||
if 'monitoring_interval' in kwargs and 'refresh_users_interval' in kwargs:
|
kwargs.get('monitor_remote_access') != str(plexpy.CONFIG.MONITOR_REMOTE_ACCESS):
|
||||||
if (kwargs['monitoring_interval'] != str(plexpy.CONFIG.MONITORING_INTERVAL)) or \
|
|
||||||
(kwargs['refresh_users_interval'] != str(plexpy.CONFIG.REFRESH_USERS_INTERVAL)):
|
|
||||||
reschedule = True
|
|
||||||
|
|
||||||
if 'notify_recently_added' in kwargs and \
|
|
||||||
(kwargs['notify_recently_added'] != plexpy.CONFIG.NOTIFY_RECENTLY_ADDED):
|
|
||||||
reschedule = True
|
reschedule = True
|
||||||
|
|
||||||
if 'monitor_remote_access' in kwargs and \
|
# If we change the SSL setting for PMS or PMS remote setting, make sure we grab the new url.
|
||||||
(kwargs['monitor_remote_access'] != plexpy.CONFIG.MONITOR_REMOTE_ACCESS):
|
if kwargs.get('pms_ssl') != str(plexpy.CONFIG.PMS_SSL) or \
|
||||||
reschedule = True
|
kwargs.get('pms_is_remote') != str(plexpy.CONFIG.PMS_IS_REMOTE):
|
||||||
|
|
||||||
# If we change the SSL setting for PMS, make sure we grab the new url.
|
|
||||||
if 'pms_ssl' in kwargs and \
|
|
||||||
(kwargs['pms_ssl'] != plexpy.CONFIG.PMS_SSL):
|
|
||||||
server_changed = True
|
|
||||||
|
|
||||||
# If we change the PMS remote setting, make sure we grab the new url.
|
|
||||||
if 'pms_is_remote' in kwargs and \
|
|
||||||
(kwargs['pms_is_remote'] != plexpy.CONFIG.PMS_IS_REMOTE):
|
|
||||||
server_changed = True
|
server_changed = True
|
||||||
|
|
||||||
# If we change the HTTPS setting, make sure we generate a new certificate.
|
# If we change the HTTPS setting, make sure we generate a new certificate.
|
||||||
if 'https_create_cert' in kwargs and kwargs['https_create_cert']:
|
if kwargs.get('enable_https') and kwargs.get('https_create_cert'):
|
||||||
if 'https_create_cert' in kwargs and (kwargs['https_create_cert'] != plexpy.CONFIG.HTTPS_CREATE_CERT) or \
|
if kwargs.get('https_domain') != plexpy.CONFIG.HTTPS_DOMAIN or \
|
||||||
'https_domain' in kwargs and (kwargs['https_domain'] != plexpy.CONFIG.HTTPS_DOMAIN) or \
|
kwargs.get('https_ip') != plexpy.CONFIG.HTTPS_IP or \
|
||||||
'https_ip' in kwargs and (kwargs['https_ip'] != plexpy.CONFIG.HTTPS_IP) or \
|
kwargs.get('https_cert') != plexpy.CONFIG.HTTPS_CERT or \
|
||||||
'https_cert' in kwargs and (kwargs['https_cert'] != plexpy.CONFIG.HTTPS_CERT) or \
|
kwargs.get('https_key') != plexpy.CONFIG.HTTPS_KEY:
|
||||||
'https_key' in kwargs and (kwargs['https_key'] != plexpy.CONFIG.HTTPS_KEY):
|
|
||||||
https_changed = True
|
https_changed = True
|
||||||
|
|
||||||
# Remove config with 'hscard-' prefix and change home_stats_cards to list
|
# Remove config with 'hscard-' prefix and change home_stats_cards to list
|
||||||
if 'home_stats_cards' in kwargs:
|
if kwargs.get('home_stats_cards', ''):
|
||||||
for k in kwargs.keys():
|
for k in kwargs.keys():
|
||||||
if k.startswith('hscard-'):
|
if k.startswith('hscard-'):
|
||||||
del kwargs[k]
|
del kwargs[k]
|
||||||
|
@ -1311,7 +1295,7 @@ class WebInterface(object):
|
||||||
kwargs['home_stats_cards'] = plexpy.CONFIG.HOME_STATS_CARDS
|
kwargs['home_stats_cards'] = plexpy.CONFIG.HOME_STATS_CARDS
|
||||||
|
|
||||||
# Remove config with 'hlcard-' prefix and change home_library_cards to list
|
# Remove config with 'hlcard-' prefix and change home_library_cards to list
|
||||||
if 'home_library_cards' in kwargs:
|
if kwargs.get('home_library_cards', ''):
|
||||||
for k in kwargs.keys():
|
for k in kwargs.keys():
|
||||||
if k.startswith('hlcard-'):
|
if k.startswith('hlcard-'):
|
||||||
del kwargs[k]
|
del kwargs[k]
|
||||||
|
@ -1320,7 +1304,8 @@ class WebInterface(object):
|
||||||
if kwargs['home_library_cards'] == ['first_run_wizard']:
|
if kwargs['home_library_cards'] == ['first_run_wizard']:
|
||||||
refresh_libraries = True
|
refresh_libraries = True
|
||||||
|
|
||||||
if 'server_changed' in kwargs:
|
# If we change the server, make sure we grab the new url and refresh libraries and users lists.
|
||||||
|
if kwargs.get('server_changed'):
|
||||||
del kwargs['server_changed']
|
del kwargs['server_changed']
|
||||||
server_changed = True
|
server_changed = True
|
||||||
refresh_users = True
|
refresh_users = True
|
||||||
|
@ -1336,14 +1321,14 @@ class WebInterface(object):
|
||||||
plextv.get_real_pms_url()
|
plextv.get_real_pms_url()
|
||||||
pmsconnect.get_server_friendly_name()
|
pmsconnect.get_server_friendly_name()
|
||||||
|
|
||||||
# Generate a new HTTPS certificate
|
|
||||||
if https_changed:
|
|
||||||
create_https_certificates(plexpy.CONFIG.HTTPS_CERT, plexpy.CONFIG.HTTPS_KEY)
|
|
||||||
|
|
||||||
# Reconfigure scheduler if intervals changed
|
# Reconfigure scheduler if intervals changed
|
||||||
if reschedule:
|
if reschedule:
|
||||||
plexpy.initialize_scheduler()
|
plexpy.initialize_scheduler()
|
||||||
|
|
||||||
|
# Generate a new HTTPS certificate
|
||||||
|
if https_changed:
|
||||||
|
create_https_certificates(plexpy.CONFIG.HTTPS_CERT, plexpy.CONFIG.HTTPS_KEY)
|
||||||
|
|
||||||
# Refresh users table if our server IP changes.
|
# Refresh users table if our server IP changes.
|
||||||
if refresh_libraries:
|
if refresh_libraries:
|
||||||
threading.Thread(target=pmsconnect.refresh_libraries).start()
|
threading.Thread(target=pmsconnect.refresh_libraries).start()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue