diff --git a/server/app.py b/server/app.py index f75eed2..3e85c73 100644 --- a/server/app.py +++ b/server/app.py @@ -224,6 +224,7 @@ async def stream(job_id: str) -> StreamingResponse: asr_bottom=job.get("asr_bottom", False), name_suffix=job.get("name_suffix", ""), cards_fixed=job.get("cards_fixed", False), + card_cuts=job.get("card_cuts") or None, ) else: stream_iter = process_bg_template( @@ -610,6 +611,7 @@ async def auto_build( remove_silence: str = Form(""), asr_bottom: str = Form(""), cards_fixed: str = Form(""), + card_cuts: str = Form(""), ) -> JSONResponse: """자동 탭 빌드 — 붙여넣기 스키마 JSON + 카드 PNG들 → 기존 paste job. @@ -634,6 +636,14 @@ async def auto_build( body = await f.read() with open(os.path.join(cdir, f"{i:03d}.png"), "wb") as out: out.write(body) + # 카드별 소속 컷 — 값이 깨져도 빌드를 막지 않는다(없으면 기존 전체 균등 배치) + cut_map: list[int] = [] + try: + parsed = json.loads(card_cuts) if card_cuts.strip() else [] + if isinstance(parsed, list): + cut_map = [int(v) for v in parsed if isinstance(v, int) and not isinstance(v, bool)] + except (json.JSONDecodeError, ValueError, TypeError): + cut_map = [] JOBS[h] = { "paste": payload, "draft_name": f"auto_{h}", "video_scale": _scale(video_scale), "flip": _truthy(flip), @@ -641,6 +651,7 @@ async def auto_build( "bg_white": _truthy(bg_white), "remove_silence": _truthy(remove_silence), "asr_bottom": _truthy(asr_bottom), "name_suffix": safe_tag, "cards_fixed": _truthy(cards_fixed), + "card_cuts": cut_map, } return JSONResponse({"job_id": h, "cuts": len(payload["cuts"]), "cards": len(cards)})