feat: add Windows-first deployment flow

This commit is contained in:
admin committed 2026-08-20 10:21:44 +08:00
1 parent 7353d140b8
commit da01967c2e
5 files changed
+176 -31

No files matched your search

+1 -1
View File
@@ -62,4 +62,4 @@ class Settings(BaseSettings):
model_config = {"env_prefix": "LS_"}
settings = Settings()
settings = Settings()
+2 -2
View File
@@ -93,7 +93,7 @@ async def health():
@app.get("/hls/{path:path}")
async def serve_hls(path: str):
hls_root = "/tmp/hls"
hls_root = settings.hls_runtime_dir
fs_path = os.path.join(hls_root, path)
if os.path.isfile(fs_path):
return FileResponse(fs_path)
@@ -111,4 +111,4 @@ async def serve_hls(path: str):
media_type=resp.headers.get("content-type"),
)
except Exception:
raise HTTPException(status_code=404)
raise HTTPException(status_code=404)
+4 -4
View File
@@ -24,7 +24,7 @@ class TranscodeManager:
audio_bitrate = quality.get("audio_bitrate", "128k")
keyframe_seconds = quality.get("keyframe_seconds", segment_seconds)
keyframe_frames = keyframe_seconds * fps
hls_dir = f"/tmp/hls/{stream_key}/{label}"
hls_dir = os.path.join(settings.hls_runtime_dir, stream_key, label)
os.makedirs(hls_dir, exist_ok=True)
cmd = [
"ffmpeg", "-y",
@@ -42,8 +42,8 @@ class TranscodeManager:
"-hls_time", str(segment_seconds),
"-hls_list_size", "6",
"-hls_flags", "delete_segments+independent_segments+program_date_time",
"-hls_segment_filename", f"{hls_dir}/segment_%03d.ts",
f"{hls_dir}/index.m3u8",
"-hls_segment_filename", os.path.join(hls_dir, "segment_%03d.ts"),
os.path.join(hls_dir, "index.m3u8"),
]
try:
proc = subprocess.Popen(
@@ -72,4 +72,4 @@ class TranscodeManager:
self.stop_transcode(key)
transcode_mgr = TranscodeManager()
transcode_mgr = TranscodeManager()