This commit is contained in:
david rice
2026-04-24 15:24:27 +01:00
parent f8d7727ff7
commit bc1d5bdc30
5 changed files with 119 additions and 25 deletions

View File

@@ -212,16 +212,20 @@ def control_video():
if _video_proc is not None and _video_proc.poll() is None:
return jsonify({"status": "already_running", "pid": _video_proc.pid}), 200
try:
cmd = ["python3", KIOSK_SCRIPT]
mode = data.get("mode", "")
if mode == "static-pink":
cmd.append("--static-pink")
log = open("/tmp/kiosk.log", "w")
_video_proc = subprocess.Popen(
["python3", KIOSK_SCRIPT],
cmd,
stdout=log,
stderr=subprocess.STDOUT,
env=os.environ.copy(),
)
except Exception as e:
return jsonify({"error": f"failed to launch kiosk: {e}"}), 500
return jsonify({"status": "started", "pid": _video_proc.pid}), 200
return jsonify({"status": "started", "mode": mode or "video", "pid": _video_proc.pid}), 200
elif action == "stop":
if _video_proc is not None and _video_proc.poll() is None: