import json
from pathlib import Path

BASE_DIR = Path(r"c:\Projects\KieuStory")
banana_file = BASE_DIR / "02_AI_Prompts" / "gemini_banana_prompts.json"
registry_file = BASE_DIR / ".agents" / "teamwork" / "spec_miner_m2_2" / "gemini_banana_ep01_registry.json"

with open(banana_file, "r", encoding="utf-8") as f:
    banana_data = json.load(f)

with open(registry_file, "r", encoding="utf-8") as f:
    ep01_registry = json.load(f)

print("Original top keys:", list(banana_data.keys()))
print("Total shots in registry:", len(ep01_registry))

banana_data["ep01_start_frames"] = ep01_registry
for shot_id, shot_info in ep01_registry.items():
    banana_data[shot_id] = shot_info

sai_nha_16x9 = (
    "Cinematic solo master portrait of a brutal 16th century feudal East Asian imperial bailiff guard "
    "('linh sai nha nha dich phong kien'). 100% pure East Asian Vietnamese ancestry, rough weather-beaten "
    "rustic Asian facial features, menacing scowling cruel expression, narrow ruthless predatory eyes, rugged dark "
    "sun-tanned skin, unkempt black stubble. Strictly authentic 16th century feudal Asian guard attire: wearing an "
    "authentic conical peaked lacquered red bamboo helmet with brass peak ('non dau son son'), traditional coarse "
    "dark slate-grey linen soldier tunic with red cloth-trimmed collar and chest border ('ao chen nep vat linh trang'), "
    "cloth puttees tightly wrapped around calves, and rustic black cloth shoes. Firmly gripping an antique heavy "
    "red-lacquered punishment wooden cudgel with brass-tipped ends ('gay son bit dong') in one hand, heavy rusty "
    "forged iron gallows chains ('xich sat gong cum') in the other, and an authentic wide-bladed steel dao saber "
    "('dao ban rong co') sheathed at his hip. Standing in the dark shadows of a traditional brick courtyard under "
    "flickering torchlight, gritty dramatic chiaroscuro lighting, 85mm f/1.4 lens, 35mm cinema film grain, authentic "
    "historical drama aesthetic, single character solo shot --no western, caucasian, white people, modern clothing, "
    "police uniforms, modern military gear, zippers, metal snap buttons, modern boots, sunglasses, western armor, guns --ar 16:9"
)
sai_nha_9x16 = (
    "Cinematic vertical 9:16 solo portrait of a ferocious 16th century East Asian feudal bailiff guard standing menacingly. "
    "100% pure East Asian rustic features, peaked red-lacquered conical bamboo helmet, dark coarse tunic with red cloth borders, "
    "cloth leg gaiters. Gripping a brass-tipped red wooden cudgel and clanking rusty iron chains, wide antique saber at waist. "
    "Harsh rim lighting from flickering torches, gritty period drama poster aesthetic, single character solo shot "
    "--no modern uniform, no western faces, no caucasian, no zippers --ar 9:16"
)

if "characters" in banana_data and "05_Imperial_Court_And_Officials" in banana_data["characters"]:
    if "sai_nha" in banana_data["characters"]["05_Imperial_Court_And_Officials"]:
        banana_data["characters"]["05_Imperial_Court_And_Officials"]["sai_nha"]["prompt_16x9"] = sai_nha_16x9
        banana_data["characters"]["05_Imperial_Court_And_Officials"]["sai_nha"]["prompt_9x16"] = sai_nha_9x16

with open(banana_file, "w", encoding="utf-8") as f:
    json.dump(banana_data, f, ensure_ascii=False, indent=2)

print("Saved gemini_banana_prompts.json with", len(banana_data), "keys.")
