Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ RUN ARCH=$(if [ "$(dpkg --print-architecture)" = "amd64" ]; then echo "x86_64";
USER ${SEL_UID}:${SEL_GID}

RUN python3 -m venv $VENV_PATH \
&& $VENV_PATH/bin/python3 -m pip install --upgrade pip psutil requests \
&& $VENV_PATH/bin/python3 -m pip install --upgrade pip psutil requests pyzmq \
&& wget -q https://github.com/Supervisor/supervisor/archive/refs/heads/main.zip -O /tmp/supervisor.zip \
&& unzip /tmp/supervisor.zip -d /tmp \
&& cd /tmp/supervisor-main \
Expand Down
2 changes: 1 addition & 1 deletion Video/recorder.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[program:video-recording]
priority=10
command=/opt/bin/video.sh
command=python3 /opt/bin/video_recorder.py
killasgroup=true
autostart=%(ENV_SE_RECORD_VIDEO)s
startsecs=0
Expand Down
2 changes: 1 addition & 1 deletion Video/uploader.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[program:video-upload]
priority=5
command=/opt/bin/upload.sh
command=python3 /opt/bin/video_uploader.py
killasgroup=true
autostart=%(ENV_SE_VIDEO_UPLOAD_ENABLED)s
startsecs=0
Expand Down
39 changes: 39 additions & 0 deletions Video/video_recorder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
"""
Video service entry point that switches between:
1. Unified event-driven service (SE_EVENT_DRIVEN_SERVICES=true)
2. Traditional shell-based polling (SE_EVENT_DRIVEN_SERVICES=false or unset)

When event-driven mode is enabled, this launches a single unified service
that handles both recording and uploading with shared state management.
"""

import os
import subprocess
import sys


def main():
event_driven = os.environ.get("SE_EVENT_DRIVEN_SERVICES", "false").lower() == "true"

if event_driven:
print("Starting unified event-driven video service...")
print("This service handles both recording and uploading with shared state.")
try:
import asyncio

from video_service import main as service_main

asyncio.run(service_main())
except ImportError as e:
print(f"Failed to import video service: {e}")
print("Ensure pyzmq is installed: pip install pyzmq")
print("Falling back to shell-based recording...")
subprocess.run(["/opt/bin/video.sh"], check=True)
else:
print("Starting shell-based video recording...")
subprocess.run(["/opt/bin/video.sh"], check=True)


if __name__ == "__main__":
main()
Loading
Loading