auto-start fix

This commit is contained in:
2026-02-19 09:22:38 +01:00
parent e1f068f97f
commit f9804ecb00
2 changed files with 35 additions and 8 deletions
+14 -3
View File
@@ -390,9 +390,11 @@ def api_soundboard_load():
sb = load_soundboard_config(filename,
current_app.config['SOUNDBOARD_CONFIG_DIR'],
current_app.config['SOUNDS_DIR'])
# Wenn das gleiche Theme erneut geladen wird, Auto-Random nicht stoppen
same_theme = state.current_soundboard and state.current_soundboard.get('filename') == filename
if not same_theme:
_stop_auto_random_internal()
state.current_soundboard = sb
# Stoppe ggf. laufende Auto-Randoms beim Laden neuer Themen
_stop_auto_random_internal()
logger.info(f"Soundboard geladen: {filename}")
return jsonify({"success": True, "soundboard": sb})
except Exception as e:
@@ -453,6 +455,13 @@ def api_soundboard_auto_stop():
return jsonify({"success": True, "message": "Auto-Random gestoppt", "was_running": stopped})
@api_bp.route('/soundboard/current', methods=['GET'])
def api_soundboard_current():
if state.current_soundboard:
return jsonify({"soundboard": state.current_soundboard})
return jsonify({"soundboard": None}), 200
@api_bp.route('/soundboard/status', methods=['GET'])
def api_soundboard_status():
with auto_random_lock:
@@ -462,6 +471,7 @@ def api_soundboard_status():
imax = auto_random_params.get('imax')
dmin = auto_random_params.get('dmin')
dmax = auto_random_params.get('dmax')
current_theme = state.current_soundboard.get('filename') if state.current_soundboard else None
next_seconds = max(0, next_ts - time.time()) if next_ts else None
return jsonify({
"active": active,
@@ -469,7 +479,8 @@ def api_soundboard_status():
"interval_min": imin,
"interval_max": imax,
"delay_min": dmin,
"delay_max": dmax
"delay_max": dmax,
"current_theme": current_theme
})