import sys
sys.path.insert(0,"/home/zyw/Downloads/dasiwa-h3-research")
import v18_pipeline as p
BASE="/home/zyw/Downloads/dl-hub/100-长安Disco-场景图"

OUT={
 "A": dict(body="人物参考2/A-白背心短裤-正面.jpg",
   outfit="a white cropped camisole with a small pink bow on the strap, white denim shorts and white flat shoes",
   move="she shifts her weight onto one hip, turns her head to the lens and lets her long black hair swing across her shoulder"),
 "B": dict(body="人物参考2/B-碎花裙-正面.jpg",
   outfit="a white slip dress with a small pink floral print, thin straps and white flat shoes",
   move="she sways once, lifts one hand to tuck her hair behind her ear and smiles at the lens"),
 "C": dict(body="人物参考2/C-水手服-正面.jpg",
   outfit="a white sailor top with a navy collar and a red bow, a navy pleated skirt, white knee socks and brown loafers",
   move="she steps once, turns her shoulders and the pleated skirt swings with the turn"),
 "D": dict(body="人物参考2/D-西装-正面.jpg",
   outfit="a dark grey blazer over a white shirt with a matching pencil skirt and black heels",
   move="she rolls her shoulders back, lifts her chin and looks straight into the lens"),
}

def prompt(cid):
    o=OUT[cid]
    return f"""subject_definitions:
<Subject 1> is the environment shown in <Picture 1>: a tall red wooden lattice screen on the left with a blue-green landscape painting behind its slats, deep blue night sky opening on the right, soft out-of-focus red lanterns glowing in the background, and a narrow strip of grey stone paving along the bottom.
<Subject 2> is the young woman whose face comes from <Picture 3> and whose body and outfit come from <Picture 2>: long straight black hair, pale skin, dark eyes, and {o['outfit']}. She holds nothing in her hands.

summary:
[reference generation] A five-second vertical fashion clip in which <Subject 2> stands on the paving in front of <Subject 1> and performs one small pose change; the camera is locked off, her whole body stays inside the frame, and she is the only person on screen.

retention_analysis:
<Subject 1> (appears in [Shot 1]): fully_preserved - the red lattice, the painting, the night sky, the red lantern bokeh and the paving keep their positions, scale and colour.
<Subject 2> (appears in [Shot 1]): fully_preserved - her black hair, face and {o['outfit']} stay identical to the references.

detailed_description:
[Shot 1] 0.00s-5.00s. Locked-off vertical shot at chest height with a 35mm lens, the red lattice and lanterns behind her. No push-in, no pan, no zoom, no orbit, no handheld shake; she is the only person.
0.00s-0.70s: the frame starts with her open palm and sleeve right against the lens, filling almost the whole frame; she pulls her hand away and lowers it, revealing her full body in the outfit, her head near the top tenth of the frame and both shoes on the stone.
0.70s-4.20s: {o['move']}, slowly and on the beat.
4.20s-5.00s: she raises her open palm toward the camera again; by 4.90s her palm completely fills the frame and covers the lens, only her palm and sleeve are visible and no background is left.

overall_soundscape:
A quiet night walkway: a distant murmur, a faint breeze, the soft scuff of her shoes on stone.

non_diegetic_music:
Mid-tempo disco at about 118 BPM: four-on-the-floor kick, octave-jumping bass, offbeat hi-hats and short string stabs; instrumental, no vocals.
"""

for cid in sys.argv[1:]:
    res=p.run_pipeline(
        image_path=f"{BASE}/人物参考/底板-去人.png",
        requirement=f"黑发少女在红格栅前变装短视频 第{cid}套",
        prompt_override=prompt(cid),
        extra_images=[f"{BASE}/{OUT[cid]['body']}", f"{BASE}/人物参考2/脸-正面.jpg"],
        width=768, height=1344, duration=5, seed=606060, steps=8, fps=24.0,
        topic=f"变装4-{cid}", variant=cid)
    print("SEG",cid,res["video_local"],flush=True)
