Changes
This commit is contained in:
@@ -209,11 +209,16 @@ def control_video():
|
|||||||
if action == "start":
|
if action == "start":
|
||||||
if _video_proc is not None and _video_proc.poll() is None:
|
if _video_proc is not None and _video_proc.poll() is None:
|
||||||
return jsonify({"status": "already_running", "pid": _video_proc.pid}), 200
|
return jsonify({"status": "already_running", "pid": _video_proc.pid}), 200
|
||||||
|
try:
|
||||||
|
log = open("/tmp/kiosk.log", "w")
|
||||||
_video_proc = subprocess.Popen(
|
_video_proc = subprocess.Popen(
|
||||||
["python3", KIOSK_SCRIPT],
|
["python3", KIOSK_SCRIPT],
|
||||||
stdout=open("/tmp/kiosk.log", "w"),
|
stdout=log,
|
||||||
stderr=subprocess.STDOUT,
|
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", "pid": _video_proc.pid}), 200
|
||||||
|
|
||||||
elif action == "stop":
|
elif action == "stop":
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ class KioskManager:
|
|||||||
def __init__(self, pipeline):
|
def __init__(self, pipeline):
|
||||||
self.pipeline = pipeline
|
self.pipeline = pipeline
|
||||||
self.videos = [
|
self.videos = [
|
||||||
"file:///root/python/vid.mp4",
|
"file:///root/vid.mp4",
|
||||||
"file:///root/python/vid2.mp4"
|
"file:///root/vid2.mp4"
|
||||||
]
|
]
|
||||||
self.current_video_index = 0
|
self.current_video_index = 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user