mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 05:33:40 -05:00
major refactoring + docker progress
This commit is contained in:
parent
ecb8a80f8b
commit
e75f8c944a
35 changed files with 227 additions and 104 deletions
11
active-stream-proxy/Dockerfile
Normal file
11
active-stream-proxy/Dockerfile
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
FROM python:3.12-alpine
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY requirements.txt ./
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD [ "python", "./main.py" ]
|
||||
17
active-stream-proxy/main.py
Normal file
17
active-stream-proxy/main.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import subprocess
|
||||
import time
|
||||
import requests
|
||||
|
||||
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text
|
||||
old_active_stream = active_stream
|
||||
|
||||
proc = None
|
||||
|
||||
while True:
|
||||
proc = subprocess.Popen([f"ffmpeg -re -i rtmp://mediamtx:1935/{active_stream} -c:a copy rtmp://host.containers.internal:1936/active-input"], shell=True)
|
||||
time.sleep(3)
|
||||
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text
|
||||
if old_active_stream is not active_stream:
|
||||
proc.terminate()
|
||||
proc = subprocess.Popen([f"ffmpeg -re -i rtmp://mediamtx:1935/{active_stream} -c:a copy rtmp://host.containers.internal:1936/active-input"], shell=True)
|
||||
old_active_stream = active_stream
|
||||
1
active-stream-proxy/requirements.txt
Normal file
1
active-stream-proxy/requirements.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
requests
|
||||
Loading…
Add table
Add a link
Reference in a new issue