Chnages
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user