update for soundboard with global soundfiles
This commit is contained in:
@@ -35,6 +35,19 @@ def cleanup_old_log_dirs(max_age_days=90):
|
||||
except Exception as e:
|
||||
logger.error(f"Fehler beim Löschen von {subdir_path}: {e}")
|
||||
|
||||
# ── Hilfsfunktion - globale Sounds laden ────────────────────────────────────────────────────────────────
|
||||
def load_global_sounds():
|
||||
global_sounds_path = os.path.join(app.root_path, 'sounds.json') # oder configs/sounds.json
|
||||
if os.path.exists(global_sounds_path):
|
||||
try:
|
||||
with open(global_sounds_path, 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
return data.get('global_sounds', [])
|
||||
except Exception as e:
|
||||
logger.error(f"Fehler beim Laden globaler Sounds: {e}")
|
||||
return []
|
||||
return []
|
||||
|
||||
# ── Bluetooth ────────────────────────────────────────────────────────────────
|
||||
from mkconnect.mouldking.MouldKing import MouldKing
|
||||
from mkconnect.tracer.TracerConsole import TracerConsole
|
||||
@@ -215,11 +228,17 @@ def control_page():
|
||||
if current_config is None:
|
||||
logger.warning("current_config ist None → Redirect zu index")
|
||||
return redirect(url_for('index'))
|
||||
|
||||
global_sounds = load_global_sounds()
|
||||
|
||||
logger.info(f"Übergebe config an Template: {current_config}")
|
||||
print("DEBUG: config hat channels?", 'channels' in current_config, len(current_config.get('channels', [])))
|
||||
|
||||
return render_template('control.html', config=current_config)
|
||||
return render_template(
|
||||
'control.html',
|
||||
config=current_config,
|
||||
global_sounds=global_sounds
|
||||
)
|
||||
|
||||
|
||||
@app.route('/soundboard')
|
||||
|
||||
Reference in New Issue
Block a user