fix(music-lab): xfade offset 누적 오차 수정 + 테스트 보강

- _build_slideshow_cmd: offset 공식을 `duration_per_image * i - xd * i`로 수정 (누적 전환 오차 제거)
- _generate_metadata: genre 빈 문자열일 때 yt_tags에 빈 문자열 삽입 방지
- test: VIDEO_DATA_DIR 패치를 monkeypatch로 교체 (자동 복원 보장)
- test: xfade offset 값 검증 테스트 추가 (29.00, 58.00)
- test: 미사용 import 제거 (pytest, sqlite3)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-01 11:56:41 +09:00
parent 7336fd090e
commit abf475433b
2 changed files with 19 additions and 6 deletions

View File

@@ -84,7 +84,7 @@ def _build_slideshow_cmd(
filter_str = ";".join(filter_parts)
prev = "v0"
for i in range(1, n):
offset = max(0.0, duration_per_image * i - xd)
offset = max(0.0, duration_per_image * i - xd * i)
nxt = "out" if i == n - 1 else f"xf{i}"
filter_str += (
f";[{prev}][v{i}]xfade=transition=fade:"
@@ -159,7 +159,7 @@ def _generate_metadata(genre: str, moods: list, lyrics: str, target_countries: l
start, end = text.find("{"), text.rfind("}") + 1
return json.loads(text[start:end])
except Exception:
return {"yt_title": f"{genre or 'Music'} - Chill Beats", "yt_description": "", "yt_tags": [genre]}
return {"yt_title": f"{genre or 'Music'} - Chill Beats", "yt_description": "", "yt_tags": [genre] if genre else []}
def _render_visualizer(track: dict, proj: dict, output_path: str) -> None: