remove dead code

Signed-off-by: Micha Albert <micha@2231puppy.tech>
This commit is contained in:
Micha Albert 2024-10-05 15:10:54 -04:00
parent 2b1d2b32ec
commit fa4bd9e7c1
3 changed files with 0 additions and 43 deletions

View file

@ -1,13 +0,0 @@
FROM python:3.12-alpine
WORKDIR /usr/src/app
RUN apk add --no-cache ffmpeg
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./main.py" ]

View file

@ -1,29 +0,0 @@
import subprocess
import time
import requests
time.sleep(8)
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text.replace('"', '')
print(active_stream)
old_active_stream = active_stream
proc = None
if active_stream != "":
proc = subprocess.Popen(["ffmpeg", "-re", "-i", f"rtmp://host.containers.internal:1935/{active_stream}", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
else:
proc = subprocess.Popen(["ffmpeg", "-f", "lavfi", "-i", "anullsrc", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
while True:
time.sleep(3)
active_stream = requests.get("http://backend:8000/api/v1/active_stream").text.replace('"', '')
if old_active_stream is not active_stream:
if proc:
proc.terminate()
if active_stream != "":
proc = subprocess.Popen(["ffmpeg", "-re", "-i", f"rtmp://host.containers.internal:1935/{active_stream}", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
else:
proc = subprocess.Popen(["ffmpeg", "-f", "lavfi", "-i", "anullsrc", "-c:a", "libmp3lame", "-f", "flv", "rtmp://host.containers.internal:1936/active-input"])
old_active_stream = active_stream

View file

@ -1 +0,0 @@
requests