Update web_server.py
This commit is contained in:
parent
77c05b0315
commit
bbc7fdbfd4
1 changed files with 38 additions and 4 deletions
|
|
@ -1960,6 +1960,23 @@ def test_connection_endpoint():
|
||||||
|
|
||||||
success, message = run_service_test(service, test_config)
|
success, message = run_service_test(service, test_config)
|
||||||
|
|
||||||
|
# Update status cache immediately when test succeeds to reflect current state
|
||||||
|
import time
|
||||||
|
if success:
|
||||||
|
current_time = time.time()
|
||||||
|
if service == 'spotify':
|
||||||
|
_status_cache['spotify']['connected'] = True
|
||||||
|
_status_cache_timestamps['spotify'] = current_time
|
||||||
|
print("✅ Updated Spotify status cache after successful test")
|
||||||
|
elif service in ['plex', 'jellyfin', 'navidrome']:
|
||||||
|
_status_cache['media_server']['connected'] = True
|
||||||
|
_status_cache['media_server']['type'] = service
|
||||||
|
_status_cache_timestamps['media_server'] = current_time
|
||||||
|
print(f"✅ Updated {service} status cache after successful test")
|
||||||
|
elif service == 'soulseek':
|
||||||
|
# Soulseek doesn't use cache, but update anyway for consistency
|
||||||
|
print("✅ Soulseek test successful")
|
||||||
|
|
||||||
# Add activity for connection test
|
# Add activity for connection test
|
||||||
if success:
|
if success:
|
||||||
add_activity_item("✅", "Connection Test", f"{service.title()} connection successful", "Now")
|
add_activity_item("✅", "Connection Test", f"{service.title()} connection successful", "Now")
|
||||||
|
|
@ -1989,6 +2006,23 @@ def test_dashboard_connection_endpoint():
|
||||||
|
|
||||||
success, message = run_service_test(service, test_config)
|
success, message = run_service_test(service, test_config)
|
||||||
|
|
||||||
|
# Update status cache immediately when test succeeds to reflect current state
|
||||||
|
import time
|
||||||
|
if success:
|
||||||
|
current_time = time.time()
|
||||||
|
if service == 'spotify':
|
||||||
|
_status_cache['spotify']['connected'] = True
|
||||||
|
_status_cache_timestamps['spotify'] = current_time
|
||||||
|
print("✅ Updated Spotify status cache after successful dashboard test")
|
||||||
|
elif service in ['plex', 'jellyfin', 'navidrome']:
|
||||||
|
_status_cache['media_server']['connected'] = True
|
||||||
|
_status_cache['media_server']['type'] = service
|
||||||
|
_status_cache_timestamps['media_server'] = current_time
|
||||||
|
print(f"✅ Updated {service} status cache after successful dashboard test")
|
||||||
|
elif service == 'soulseek':
|
||||||
|
# Soulseek doesn't use cache, but log anyway for consistency
|
||||||
|
print("✅ Soulseek dashboard test successful")
|
||||||
|
|
||||||
# Add activity for dashboard connection test (different from settings test)
|
# Add activity for dashboard connection test (different from settings test)
|
||||||
if success:
|
if success:
|
||||||
add_activity_item("🎛️", "Dashboard Test", f"{service.title()} service verified", "Now")
|
add_activity_item("🎛️", "Dashboard Test", f"{service.title()} service verified", "Now")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue