feat(music-lab): video.py — Windows에 style/background_mode/tracks 전달 + orchestrator 파라미터 wiring
This commit is contained in:
@@ -130,3 +130,33 @@ def test_container_to_nas_music_path(monkeypatch):
|
||||
monkeypatch.setattr(video, "NAS_VIDEOS_ROOT", "/volume1/docker/webpage/data/videos")
|
||||
monkeypatch.setattr(video, "NAS_MUSIC_ROOT", "/volume1/docker/webpage/data/music")
|
||||
assert video._container_to_nas("/app/data/abc.mp3") == "/volume1/docker/webpage/data/music/abc.mp3"
|
||||
|
||||
|
||||
@respx.mock
|
||||
def test_generate_video_passes_essential_params(encoder_env, tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(storage, "VIDEO_DATA_DIR", str(tmp_path))
|
||||
captured = {}
|
||||
|
||||
def hook(req):
|
||||
import json as _json
|
||||
captured["body"] = _json.loads(req.content)
|
||||
return Response(200, json={"ok": True, "duration_ms": 5000,
|
||||
"output_path_nas": "/v/3/video.mp4",
|
||||
"output_bytes": 10_000_000,
|
||||
"encoder": "h264_nvenc", "preset": "p4"})
|
||||
|
||||
respx.post("http://192.168.45.59:8765/encode_video").mock(side_effect=hook)
|
||||
out = video.generate(
|
||||
pipeline_id=3, audio_path="/app/data/x.mp3",
|
||||
cover_path="/app/data/videos/3/cover.jpg",
|
||||
genre="mix", duration_sec=3600, resolution="1920x1080",
|
||||
style="essential", background_mode="video_loop",
|
||||
background_path="/app/data/videos/3/loop.mp4",
|
||||
tracks=[{"id": 1, "title": "T1", "start_offset_sec": 0}],
|
||||
)
|
||||
body = captured["body"]
|
||||
assert body["style"] == "essential"
|
||||
assert body["background_mode"] == "video_loop"
|
||||
assert body["background_path_nas"] == "/volume1/docker/webpage/data/videos/3/loop.mp4"
|
||||
assert body["tracks"][0]["title"] == "T1"
|
||||
assert out["url"].endswith("/3/video.mp4")
|
||||
|
||||
Reference in New Issue
Block a user