mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Fix libraries and users refresh
This commit is contained in:
parent
a9ce92decb
commit
a8aae9f1f5
6 changed files with 28 additions and 17 deletions
|
@ -359,6 +359,10 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
</label>
|
</label>
|
||||||
<p class="help-block">Force PlexPy to connect to your Plex Server via SSL. Your server needs to have remote access enabled.</p>
|
<p class="help-block">Force PlexPy to connect to your Plex Server via SSL. Your server needs to have remote access enabled.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<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">
|
||||||
|
|
||||||
<div class="padded-header">
|
<div class="padded-header">
|
||||||
<h3>Plex Logs</h3>
|
<h3>Plex Logs</h3>
|
||||||
</div>
|
</div>
|
||||||
|
@ -374,8 +378,6 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
<a href="https://support.plex.tv/hc/en-us/articles/200250417-Plex-Media-Server-Log-Files" target="_blank">Click here</a> for help. This is required if you enable IP logging (for PMS 0.9.12 and below). </p>
|
<a href="https://support.plex.tv/hc/en-us/articles/200250417-Plex-Media-Server-Log-Files" target="_blank">Click here</a> for help. This is required if you enable IP logging (for PMS 0.9.12 and below). </p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="hidden" id="pms_identifier" name="pms_identifier" value="${config['pms_identifier']}">
|
|
||||||
|
|
||||||
<input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully">
|
<input type="button" class="btn btn-bright save-button" value="Save" data-success="Changes saved successfully">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1554,6 +1556,7 @@ $(document).ready(function() {
|
||||||
serverChanged = true;
|
serverChanged = true;
|
||||||
$("#pms_identifier").val("");
|
$("#pms_identifier").val("");
|
||||||
$("#pms-verify-status").html("");
|
$("#pms-verify-status").html("");
|
||||||
|
$("#server_changed").prop('checked', true);
|
||||||
verifyServer();
|
verifyServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,7 @@ from plexpy import common
|
||||||
<input type="checkbox" name="launch_browser" id="launch_browser" value="1" ${config['launch_browser']}>
|
<input type="checkbox" name="launch_browser" id="launch_browser" value="1" ${config['launch_browser']}>
|
||||||
<input type="checkbox" name="refresh_users_on_startup" id="refresh_users_on_startup" value="1" ${config['refresh_users_on_startup']}>
|
<input type="checkbox" name="refresh_users_on_startup" id="refresh_users_on_startup" value="1" ${config['refresh_users_on_startup']}>
|
||||||
<input type="checkbox" name="refresh_libraries_on_startup" id="refresh_libraries_on_startup" value="1" ${config['refresh_libraries_on_startup']}>
|
<input type="checkbox" name="refresh_libraries_on_startup" id="refresh_libraries_on_startup" value="1" ${config['refresh_libraries_on_startup']}>
|
||||||
|
<input type="checkbox" name="server_changed" id="server_changed" value="1" checked>
|
||||||
<input type="checkbox" name="first_run_complete" id="first_run_complete" value="1" checked>
|
<input type="checkbox" name="first_run_complete" id="first_run_complete" value="1" checked>
|
||||||
<input type="checkbox" name="check_github" id="check_github" value="1" checked>
|
<input type="checkbox" name="check_github" id="check_github" value="1" checked>
|
||||||
<input type="text" name="home_stats_cards" id="home_stats_cards" value="first_run_wizard">
|
<input type="text" name="home_stats_cards" id="home_stats_cards" value="first_run_wizard">
|
||||||
|
|
|
@ -176,7 +176,7 @@ def initialize(config_file):
|
||||||
plextv.refresh_users()
|
plextv.refresh_users()
|
||||||
|
|
||||||
# Refresh the libraries list on startup
|
# Refresh the libraries list on startup
|
||||||
if CONFIG.PMS_TOKEN and CONFIG.REFRESH_LIBRARIES_ON_STARTUP:
|
if CONFIG.PMS_IP and CONFIG.PMS_TOKEN and CONFIG.REFRESH_LIBRARIES_ON_STARTUP:
|
||||||
pmsconnect.refresh_libraries()
|
pmsconnect.refresh_libraries()
|
||||||
|
|
||||||
# Store the original umask
|
# Store the original umask
|
||||||
|
|
|
@ -22,8 +22,6 @@ def update_section_ids():
|
||||||
|
|
||||||
plexpy.CONFIG.UPDATE_SECTION_IDS = -1
|
plexpy.CONFIG.UPDATE_SECTION_IDS = -1
|
||||||
|
|
||||||
logger.info(u"PlexPy Libraries :: Updating section_id's in database.")
|
|
||||||
|
|
||||||
#logger.debug(u"PlexPy Libraries :: Disabling monitoring while update in progress.")
|
#logger.debug(u"PlexPy Libraries :: Disabling monitoring while update in progress.")
|
||||||
#plexpy.schedule_job(activity_pinger.check_active_sessions, 'Check for active sessions',
|
#plexpy.schedule_job(activity_pinger.check_active_sessions, 'Check for active sessions',
|
||||||
# hours=0, minutes=0, seconds=0)
|
# hours=0, minutes=0, seconds=0)
|
||||||
|
@ -51,6 +49,13 @@ def update_section_ids():
|
||||||
#plexpy.initialize_scheduler()
|
#plexpy.initialize_scheduler()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
if not history_results:
|
||||||
|
plexpy.CONFIG.__setattr__('UPDATE_SECTION_IDS', 0)
|
||||||
|
plexpy.CONFIG.write()
|
||||||
|
return None
|
||||||
|
|
||||||
|
logger.info(u"PlexPy Libraries :: Updating section_id's in database.")
|
||||||
|
|
||||||
# Add thread filter to the logger
|
# Add thread filter to the logger
|
||||||
#logger.debug(u"PlexPy Libraries :: Disabling logging in the current thread while update in progress.")
|
#logger.debug(u"PlexPy Libraries :: Disabling logging in the current thread while update in progress.")
|
||||||
#thread_filter = logger.NoThreadFilter(threading.current_thread().name)
|
#thread_filter = logger.NoThreadFilter(threading.current_thread().name)
|
||||||
|
@ -572,11 +577,10 @@ class Libraries(object):
|
||||||
return library_details
|
return library_details
|
||||||
else:
|
else:
|
||||||
logger.warn(u"PlexPy Libraries :: Unable to retrieve library from local database. Requesting library list refresh.")
|
logger.warn(u"PlexPy Libraries :: Unable to retrieve library from local database. Requesting library list refresh.")
|
||||||
# Let's first refresh the user list to make sure the user isn't newly added and not in the db yet
|
# Let's first refresh the libraries list to make sure the library isn't newly added and not in the db yet
|
||||||
|
pmsconnect.refresh_libraries()
|
||||||
try:
|
try:
|
||||||
if section_id:
|
if section_id:
|
||||||
# Refresh libraries
|
|
||||||
pmsconnect.refresh_libraries()
|
|
||||||
query = 'SELECT section_id, section_name, section_type, count, parent_count, child_count, ' \
|
query = 'SELECT section_id, section_name, section_type, count, parent_count, child_count, ' \
|
||||||
'thumb AS library_thumb, custom_thumb_url AS custom_thumb, art, ' \
|
'thumb AS library_thumb, custom_thumb_url AS custom_thumb, art, ' \
|
||||||
'do_notify, do_notify_created, keep_history ' \
|
'do_notify, do_notify_created, keep_history ' \
|
||||||
|
|
|
@ -292,10 +292,9 @@ class Users(object):
|
||||||
else:
|
else:
|
||||||
logger.warn(u"PlexPy Users :: Unable to retrieve user from local database. Requesting user list refresh.")
|
logger.warn(u"PlexPy Users :: Unable to retrieve user from local database. Requesting user list refresh.")
|
||||||
# Let's first refresh the user list to make sure the user isn't newly added and not in the db yet
|
# Let's first refresh the user list to make sure the user isn't newly added and not in the db yet
|
||||||
|
plextv.refresh_users()
|
||||||
try:
|
try:
|
||||||
if str(user_id).isdigit():
|
if str(user_id).isdigit():
|
||||||
# Refresh users
|
|
||||||
plextv.refresh_users()
|
|
||||||
query = 'SELECT user_id, username, friendly_name, thumb AS user_thumb, custom_avatar_url AS custom_thumb, ' \
|
query = 'SELECT user_id, username, friendly_name, thumb AS user_thumb, custom_avatar_url AS custom_thumb, ' \
|
||||||
'email, is_home_user, is_allow_sync, is_restricted, do_notify, keep_history ' \
|
'email, is_home_user, is_allow_sync, is_restricted, do_notify, keep_history ' \
|
||||||
'FROM users ' \
|
'FROM users ' \
|
||||||
|
|
|
@ -1151,6 +1151,7 @@ class WebInterface(object):
|
||||||
del kwargs[use_config]
|
del kwargs[use_config]
|
||||||
|
|
||||||
# Check if we should refresh our data
|
# Check if we should refresh our data
|
||||||
|
server_changed = False
|
||||||
refresh_libraries = False
|
refresh_libraries = False
|
||||||
refresh_users = False
|
refresh_users = False
|
||||||
reschedule = False
|
reschedule = False
|
||||||
|
@ -1173,11 +1174,6 @@ class WebInterface(object):
|
||||||
(kwargs['monitor_remote_access'] != plexpy.CONFIG.MONITOR_REMOTE_ACCESS):
|
(kwargs['monitor_remote_access'] != plexpy.CONFIG.MONITOR_REMOTE_ACCESS):
|
||||||
reschedule = True
|
reschedule = True
|
||||||
|
|
||||||
if 'pms_ip' in kwargs:
|
|
||||||
if kwargs['pms_ip'] != plexpy.CONFIG.PMS_IP:
|
|
||||||
refresh_libraries = True
|
|
||||||
refresh_users = 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 'home_stats_cards' in kwargs:
|
||||||
for k in kwargs.keys():
|
for k in kwargs.keys():
|
||||||
|
@ -1198,15 +1194,23 @@ 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:
|
||||||
|
del kwargs['server_changed']
|
||||||
|
server_changed = True
|
||||||
|
refresh_users = True
|
||||||
|
refresh_libraries = True
|
||||||
|
|
||||||
plexpy.CONFIG.process_kwargs(kwargs)
|
plexpy.CONFIG.process_kwargs(kwargs)
|
||||||
|
|
||||||
# Write the config
|
# Write the config
|
||||||
plexpy.CONFIG.write()
|
plexpy.CONFIG.write()
|
||||||
|
|
||||||
# Get new server URLs for SSL communications.
|
# Get new server URLs for SSL communications.
|
||||||
|
if server_changed:
|
||||||
plextv.get_real_pms_url()
|
plextv.get_real_pms_url()
|
||||||
|
|
||||||
# Get new server friendly name.
|
# Get new server friendly name.
|
||||||
|
if server_changed:
|
||||||
pmsconnect.get_server_friendly_name()
|
pmsconnect.get_server_friendly_name()
|
||||||
|
|
||||||
# Reconfigure scheduler if intervals changed
|
# Reconfigure scheduler if intervals changed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue