ai_member_xiaobian/scripts/gen_u24l2_cheng.py
2026-05-27 08:10:02 +08:00

185 lines
9.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""生成 U24-L2 承段剧本 Excel"""
import openpyxl
from openpyxl.styles import Font, Alignment, PatternFill, Border, Side
wb = openpyxl.Workbook()
ws = wb.active
ws.title = "U24-L2_承"
# Column headers
headers = ["类型", "剧情描述", "角色名", "编剧台词"]
header_font = Font(bold=True, size=11)
header_fill = PatternFill(start_color="D9E1F2", end_color="D9E1F2", fill_type="solid")
thin_border = Border(
left=Side(style="thin"),
right=Side(style="thin"),
top=Side(style="thin"),
bottom=Side(style="thin"),
)
for col, h in enumerate(headers, 1):
cell = ws.cell(row=1, column=col, value=h)
cell.font = header_font
cell.fill = header_fill
cell.alignment = Alignment(horizontal="center", vertical="center")
cell.border = thin_border
# Column widths
ws.column_dimensions["A"].width = 12
ws.column_dimensions["B"].width = 55
ws.column_dimensions["C"].width = 16
ws.column_dimensions["D"].width = 50
# --- 剧本数据 ---
# Format: [类型, 剧情描述, 角色名, 编剧台词]
# ⚠️ 对话互动:仅第一行标"中互动"User回应行类型留空
rows = [
# #0: Tom的脏乱厨房
["TL", "【全屏插入图】Tom家厨房——空罐子、旧报纸、扳手散落台面灶台积了厚厚一层灰墙角挂着蜘蛛网。", "", ""],
["", "Mama Green走在最前面推开门后愣住。", "Mama Green", "This is Tom's **kitchen**?"],
["", "【emoji】Mama Green流汗", "Mama Green", "It's **really** messy!"],
["", "Sue跟进来拎起台面上的一只旧袜子嫌弃地甩到一边。", "", ""],
["", "", "Sue", "Not in the **kitchen**!"],
["", "【emoji】Sue生气", "Sue", "Let's clean it!"],
["中互动", "【插入图】脏乱厨房台面散布各种杂物。请User点击所有不属于 **kitchen** 的东西,把它们清理出去。\n(可点击项:扳手、旧报纸、空罐子、旧袜子、工具箱)", "", ""],
# #0b: 过期食材
["TL", "User清理完杂物台面终于空了出来。Mama Green拉开储物柜。", "", ""],
["", "柜子里滚出发霉面包、干瘪胡萝卜,还有几个长绿毛的土豆。", "", ""],
["", "【emoji】Mama Green冒汗", "Mama Green", "So **many** food..."],
["", "", "Mama Green", "But they can't eat any more."],
["", "Mama Green在柜子深处翻找终于摸出番茄、鸡蛋、面粉和一块牛肉。", "", ""],
["", "", "Mama Green", "OK. We can work with this."],
["", "Jay和Lin晃进厨房。Jay东张西望鼻子里哼了一声。", "", ""],
# #1: 厨房焕新 + There are many... 首入
["TL", "【场景】Tom的厨房清理后整洁但老旧\n【角色】User、Mama Green、Sue、Jay、Lin", "", ""],
["", "Mama Green把可用食材整齐摆在台面上满意地拍了拍手。", "", ""],
["", "", "Mama Green", "Welcome to the **kitchen**!"],
["", "", "Mama Green", "**There are many** things here."],
["", "Sue兴奋地凑近逐一指认台面上的食材。", "", ""],
["", "【emoji】Sue星星", "Sue", "Eggs, tomatoes, and carrots!"],
# #2: 食材探索
["中互动", "【插入图】台面上摆着鸡蛋、番茄、胡萝卜三种食材每样都有一堆。请User依次点击每种食材并说出发现。", "", ""],
["中互动", "点击鸡蛋", "User", "**There are many** eggs!"],
["中互动", "点击番茄", "User", "**There are many** tomatoes!"],
["中互动", "点击胡萝卜", "User", "**There are many** carrots!"],
# #3: 番茄筛选kid #1
["TL", "Sue从番茄堆里拎出两个——一个拳头大一个樱桃小。", "", ""],
["", "【emoji】Sue星星", "Sue", "Look!"],
["", "", "Sue", "This tomato is big."],
["", "Sue把小的那个捧在手心里。", "", ""],
["", "", "Sue", "And this one is just a **kid**!"],
["", "", "Sue", "The **kid** tomatoes are sweeter."],
["", "Sue把两个番茄举到User面前眨眨眼。", "", ""],
["中互动", "", "Sue", "Which one?"],
["", "", "User", "The **kid** one!"],
# #4: 厨房安全警告
["TL", "Sue满意地点头把小番茄放进盆里。Mama Green走到灶台前。", "", ""],
["", "【镜头】灶台火焰特写——火苗噌地蹿起来。", "", ""],
["", "Mama Green从刀架上抽出一把厨刀利落地切起番茄。", "", ""],
["", "【镜头】刀在砧板上快速切动的特写。", "", ""],
["", "", "Mama Green", "Sharp **knives**. Hot fire."],
["", "Mama Green抬头看着User和Sue语气温和但认真。", "", ""],
["", "", "Mama Green", "We are careful in the **kitchen**."],
["", "Jay靠在门框上双手抱胸。", "", ""],
["", "【emoji】Jay烦躁", "", ""],
# #5: Jay鸡蛋杂技出糗really 输出)
["TL", "Jay拿起一颗鸡蛋在手里掂了掂对Lin挑眉。", "", ""],
["", "", "Jay", "Watch and learn."],
["", "Jay把鸡蛋往空中一抛——想转个圈再接住。", "", ""],
["", "鸡蛋从他指尖滑过——啪正中Lin的额头。", "", ""],
["", "蛋液顺着Lin的脸缓缓流下。", "", ""],
["", "【emoji】Lin惊讶", "Lin", "...Jay."],
["", "【emoji】Jay流汗", "Jay", "It was an egg accident!"],
["", "", "Lin", "An egg... accident?"],
["", "两人开始幼稚地互相推搡Lin抓起面粉袋要往Jay头上倒。", "", ""],
["", "【emoji】Lin生气", "", ""],
["", "Sue和User在一旁看热闹。", "", ""],
["", "【emoji】Sue大笑", "", ""],
["中互动", "", "Sue", "They are **really** funny!"],
["", "", "User", "They are **really** funny!"],
# #6: Green吐槽 + kid #2
["TL", "Mama Green抬起头看着还在拌嘴的两人叹了口气眼里却带着笑意。", "", ""],
["", "", "Mama Green", "You two are **really** like **kids**."],
["", "【emoji】Jay生气", "Jay", "I'm not a **kid**!"],
["", "Mama Green笑着拍拍Jay的头端起面粉盆往门外走去。", "", ""],
["", "", "Mama Green", "Mm-hmm. Stay here, **kids**."],
["", "Mama Green出去揉面。Jay气鼓鼓地站在原地。", "", ""],
["", "Sue望着Jay的背影嘴角上扬转头对User眨眨眼。", "", ""],
["中互动", "", "Sue", "So...?"],
["", "", "User", "Jay is the **kid**!"],
# #7: Lin赌气煎牛排fire呼应 + 转段伏笔)
["TL", "Lin把围裙往腰上一系赌气走向灶台。", "", ""],
["", "【emoji】Lin生气", "Lin", "Steak is hard work."],
["", "", "Lin", "A **kid** can't do it."],
["", "Lin往锅里倒了油火苗舔着锅底。", "", ""],
["", "", "Lin", "Fire and oil!"],
["", "", "Lin", "**Kid**, stay away!"],
["", "Lin把牛排往锅里一扔——滋啦油花四溅。", "", ""],
["", "【emoji】Lin发抖", "", ""],
["", "Lin吓得往后一跳Jay在旁边哈哈大笑。", "", ""],
["", "【emoji】Jay大笑", "Jay", "Ha! The fire scared you!"],
["", "Jay笑得太得意手肘碰翻了盐罐。", "", ""],
["", "【emoji】Jay流汗", "Jay", "Oops."],
# #8: 承段收尾
["TL", "【音效】狂风拍打窗户,沙尘暴声陡然变大。", "", ""],
["", "Jay和Lin同时转头看向窗外。", "", ""],
["", "锅里的油越烧越热,滋滋作响,冒起一缕细烟。", "", ""],
["", "【镜头】油锅特写——油面开始冒泡、微微颤动。", "", ""],
]
# 写入数据
wrap = Alignment(wrap_text=True, vertical="top")
for i, row_data in enumerate(rows):
for j, val in enumerate(row_data):
cell = ws.cell(row=i + 2, column=j + 1, value=val)
cell.alignment = wrap
cell.border = thin_border
if j == 0 and val: # 类型列居中
cell.alignment = Alignment(horizontal="center", vertical="top")
if val == "中互动":
cell.font = Font(bold=True, color="0070C0")
elif val == "TL":
cell.font = Font(bold=True, color="404040")
# 统计行
stat_row = len(rows) + 3
ws.cell(row=stat_row, column=1, value="统计").font = Font(bold=True, size=12)
ws.cell(row=stat_row + 1, column=1, value="总行数").font = Font(bold=True)
ws.cell(row=stat_row + 1, column=2, value=len(rows))
ws.cell(row=stat_row + 2, column=1, value="TL 行数").font = Font(bold=True)
ws.cell(row=stat_row + 2, column=2, value=sum(1 for r in rows if r[0] == "TL"))
ws.cell(row=stat_row + 3, column=1, value="中互动 个数").font = Font(bold=True)
ws.cell(row=stat_row + 3, column=2, value=sum(1 for r in rows if r[0] == "中互动"))
ws.cell(row=stat_row + 5, column=1, value="知识点输入/输出").font = Font(bold=True, size=12)
kps = [
["kitchen", "输入×7 (Tom's kitchen? / Not in the kitchen! / 图片互动 / Welcome to the kitchen! / We are careful in the kitchen)", "图片互动输出×1"],
["kid(s)", "输入×7 (just a kid / kid tomatoes / like kids / not a kid / Stay here kids / A kid can't do it / Kid stay away)", "中互动输出×2 (The kid one! / Jay is the kid!)"],
["many", "输入×2 (So many food / There are many things)", "转段主力输出"],
["really", "输入×3 (really messy / really like kids)", "中互动输出×1 (They are really funny!)"],
["There are many...", "输入×1 (Mama Green)", "中互动输出×3 (eggs / tomatoes / carrots)"],
["It's really...", "回归×1 (It's really messy)", "起段已砸实,承段不强制"],
]
for i, kp in enumerate(kps):
for j, val in enumerate(kp):
ws.cell(row=stat_row + 6 + i, column=j + 1, value=val)
out_path = "/root/.openclaw/workspace-xiaobian/output/U24-L2_承_剧本.xlsx"
wb.save(out_path)
print(f"✅ Saved: {out_path}")
print(f" Total rows: {len(rows)}")
print(f" TL rows: {sum(1 for r in rows if r[0] == 'TL')}")
print(f" 中互动: {sum(1 for r in rows if r[0] == '中互动')}")