import sys, os, json
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(ref="人物参考2/A-白背心短裤-正面.jpg", face="人物参考2/A-白背心短裤-正面.jpg",
   outfit="a white cropped camisole with a small pink bow, 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(ref="人物参考2/B-碎花裙-正面.jpg", face="人物参考2/B-碎花裙-正面.jpg",
   outfit="a white floral slip dress with 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(ref="人物参考2/C-水手服-正面.jpg", face="人物参考2/C-水手服-正面.jpg",
   outfit="a white sailor top with navy collar and 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(ref="人物参考2/D-西装-正面.jpg", face="人物参考2/D-西装-正面.jpg",
   outfit="a dark grey blazer and matching pencil skirt over a white shirt, with black heels",
   move="she uncrosses her arms, rolls her shoulders back, and looks 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 already standing in <Picture 1>, whose face and body come from <Picture 2> and <Picture 3>: long straight black hair, pale skin, dark eyes, and {o['outfit']}. She holds nothing in her hands. She keeps the exact position, distance and height in frame that she has in <Picture 1>.

summary:
[reference generation] A five-second vertical fashion clip in which <Subject 2> holds her position in front of <Subject 1> and performs one small pose change; the camera is locked off, her whole body stays inside the frame, and no other person appears.

retention_analysis:
<Subject 1> (appears in [Shot 1]): fully_preserved - the red lattice, the painting, the sky, the 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 medium-full shot at chest height, 35mm lens; she stands on the paving in front of the lattice, her whole body and both shoes inside the frame, the red lantern glow rimming her hair and shoulders. No push-in, no pan, no zoom, no orbit, no handheld shake. She does not walk toward the camera. No other person is visible.
{o['move']}, slowly and on the beat; at the end she settles and holds the pose, looking into the lens.

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}/合成板4/{cid}.png",
        requirement=f"黑发少女在红格栅前变装短视频第{cid}套",
        prompt_override=prompt(cid),
        extra_images=[f"{BASE}/{OUT[cid]['ref']}", f"{BASE}/人物参考2/A-白背心短裤-正面.jpg"],
        width=768, height=1344, duration=5, seed=303030, steps=8, fps=24.0,
        topic=f"变装-{cid}", variant=cid)
    print("SEG",cid,res["video_local"],flush=True)
