Simplify default settings in setup wizard

This commit is contained in:
JonnyWong16 2022-03-26 14:57:44 -07:00
parent 87389320fb
commit 9c8e8b4351
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
5 changed files with 14 additions and 51 deletions

View file

@ -229,24 +229,6 @@
<!-- Required fields but hidden --> <!-- Required fields but hidden -->
<div style="display: none;"> <div style="display: none;">
<input type="checkbox" name="first_run" id="first_run" value="1" checked> <input type="checkbox" name="first_run" id="first_run" value="1" checked>
<input type="checkbox" name="group_history_tables" id="group_history_tables" value="1" checked>
<input type="checkbox" name="history_table_activity" id="history_table_activity" value="1" checked>
<input type="checkbox" name="sys_tray_icon" id="sys_tray_icon" value="1" checked>
<input type="checkbox" name="launch_startup" id="launch_startup" value="1" checked>
<input type="checkbox" name="launch_browser" id="launch_browser" value="1" checked>
<input type="checkbox" name="api_enabled" id="api_enabled" value="1" checked>
<input type="checkbox" name="refresh_users_on_startup" id="refresh_users_on_startup" value="1" checked>
<input type="checkbox" name="refresh_libraries_on_startup" id="refresh_libraries_on_startup" value="1" checked>
<input type="checkbox" name="check_github" id="check_github" value="1" checked>
<input type="checkbox" name="log_blacklist" id="log_blacklist" value="1" checked>
<input type="checkbox" name="log_blacklist_usernames" id="log_blacklist_usernames" value="1" checked>
<input type="checkbox" name="anon_redirect_dynamic" id="anon_redirect_dynamic" value="1" checked>
<input type="checkbox" name="cache_images" id="cache_images" value="1" checked>
<input type="checkbox" name="notify_group_recently_added_grandparent" id="notify_group_recently_added_grandparent" value="1" checked>
<input type="checkbox" name="notify_group_recently_added_parent" id="notify_group_recently_added_parent" value="1" checked>
<input type="checkbox" name="server_changed" id="server_changed" value="1" checked>
<input type="text" name="home_stats_cards" id="home_stats_cards" value="first_run_wizard">
<input type="text" name="home_library_cards" id="home_library_cards" value="first_run_wizard">
</div> </div>
</div> </div>

View file

@ -116,7 +116,7 @@ _CONFIG_DEFINITIONS = {
'GROUP_HISTORY_TABLES': (int, 'General', 1), 'GROUP_HISTORY_TABLES': (int, 'General', 1),
'HISTORY_TABLE_ACTIVITY': (int, 'General', 1), 'HISTORY_TABLE_ACTIVITY': (int, 'General', 1),
'HOME_SECTIONS': (list, 'General', ['current_activity', 'watch_stats', 'library_stats', 'recently_added']), 'HOME_SECTIONS': (list, 'General', ['current_activity', 'watch_stats', 'library_stats', 'recently_added']),
'HOME_LIBRARY_CARDS': (list, 'General', ['first_run']), 'HOME_LIBRARY_CARDS': (list, 'General', []),
'HOME_STATS_CARDS': (list, 'General', ['top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music', 'HOME_STATS_CARDS': (list, 'General', ['top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music',
'popular_music', 'last_watched', 'top_libraries', 'top_users', 'top_platforms', 'most_concurrent']), 'popular_music', 'last_watched', 'top_libraries', 'top_users', 'top_platforms', 'most_concurrent']),
'HOME_REFRESH_INTERVAL': (int, 'General', 10), 'HOME_REFRESH_INTERVAL': (int, 'General', 10),
@ -601,14 +601,6 @@ class Config(object):
self.CONFIG_VERSION = 4 self.CONFIG_VERSION = 4
if self.CONFIG_VERSION == 4: if self.CONFIG_VERSION == 4:
if not len(self.HOME_STATS_CARDS) and 'watch_stats' in self.HOME_SECTIONS:
home_sections = self.HOME_SECTIONS
home_sections.remove('watch_stats')
self.HOME_SECTIONS = home_sections
if not len(self.HOME_LIBRARY_CARDS) and 'library_stats' in self.HOME_SECTIONS:
home_sections = self.HOME_SECTIONS
home_sections.remove('library_stats')
self.HOME_SECTIONS = home_sections
self.CONFIG_VERSION = 5 self.CONFIG_VERSION = 5

View file

@ -988,9 +988,6 @@ class DataFactory(object):
if session.get_session_shared_libraries(): if session.get_session_shared_libraries():
library_cards = session.get_session_shared_libraries() library_cards = session.get_session_shared_libraries()
if 'first_run_wizard' in library_cards:
return None
library_stats = [] library_stats = []
try: try:

View file

@ -99,13 +99,9 @@ def refresh_libraries():
'section_id NOT IN ({})'.format(', '.join(['?'] * len(section_ids))) 'section_id NOT IN ({})'.format(', '.join(['?'] * len(section_ids)))
monitor_db.action(query=query, args=[plexpy.CONFIG.PMS_IDENTIFIER] + section_ids) monitor_db.action(query=query, args=[plexpy.CONFIG.PMS_IDENTIFIER] + section_ids)
if plexpy.CONFIG.HOME_LIBRARY_CARDS == ['first_run_wizard']: new_keys = plexpy.CONFIG.HOME_LIBRARY_CARDS + new_keys
plexpy.CONFIG.__setattr__('HOME_LIBRARY_CARDS', library_keys) plexpy.CONFIG.__setattr__('HOME_LIBRARY_CARDS', new_keys)
plexpy.CONFIG.write() plexpy.CONFIG.write()
else:
new_keys = plexpy.CONFIG.HOME_LIBRARY_CARDS + new_keys
plexpy.CONFIG.__setattr__('HOME_LIBRARY_CARDS', new_keys)
plexpy.CONFIG.write()
logger.info("Tautulli Libraries :: Libraries list refreshed.") logger.info("Tautulli Libraries :: Libraries list refreshed.")
return True return True

View file

@ -3171,14 +3171,16 @@ class WebInterface(object):
# First run from the setup wizard # First run from the setup wizard
if kwargs.pop('first_run', None): if kwargs.pop('first_run', None):
first_run = True first_run = True
server_changed = True
for checked_config in config.CHECKED_SETTINGS: if not first_run:
checked_config = checked_config.lower() for checked_config in config.CHECKED_SETTINGS:
if checked_config not in kwargs: checked_config = checked_config.lower()
# checked items should be zero or one. if they were not sent then the item was not checked if checked_config not in kwargs:
kwargs[checked_config] = 0 # checked items should be zero or one. if they were not sent then the item was not checked
else: kwargs[checked_config] = 0
kwargs[checked_config] = 1 else:
kwargs[checked_config] = 1
# 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 kwargs.get('http_password') == ' ': if kwargs.get('http_password') == ' ':
@ -3237,9 +3239,6 @@ class WebInterface(object):
del kwargs[k] del kwargs[k]
kwargs['home_stats_cards'] = kwargs['home_stats_cards'].split(',') kwargs['home_stats_cards'] = kwargs['home_stats_cards'].split(',')
if kwargs['home_stats_cards'] == ['first_run_wizard']:
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 kwargs.get('home_library_cards'): if kwargs.get('home_library_cards'):
for k in list(kwargs.keys()): for k in list(kwargs.keys()):
@ -3247,11 +3246,8 @@ class WebInterface(object):
del kwargs[k] del kwargs[k]
kwargs['home_library_cards'] = kwargs['home_library_cards'].split(',') kwargs['home_library_cards'] = kwargs['home_library_cards'].split(',')
if kwargs['home_library_cards'] == ['first_run_wizard']:
refresh_libraries = True
# If we change the server, make sure we grab the new url and refresh libraries and users lists. # If we change the server, make sure we grab the new url and refresh libraries and users lists.
if kwargs.pop('server_changed', None): if kwargs.pop('server_changed', None) or server_changed:
server_changed = True server_changed = True
refresh_users = True refresh_users = True
refresh_libraries = True refresh_libraries = True