ai_member_xiaobian/tmp/gen_zhuan.py
2026-05-26 08:10:02 +08:00

82 lines
3.8 KiB
Python
Raw 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.

import openpyxl
from openpyxl.styles import Font, Alignment, PatternFill, Border, Side
wb = openpyxl.Workbook()
ws = wb.active
ws.title = "U23_L2_转"
ws.column_dimensions['A'].width = 12
ws.column_dimensions['B'].width = 45
ws.column_dimensions['C'].width = 12
ws.column_dimensions['D'].width = 42
header_font = Font(bold=True, size=11)
header_fill = PatternFill(start_color="D9D9D9", end_color="D9D9D9", fill_type="solid")
cell_align = Alignment(vertical="top", wrap_text=True)
header_align = Alignment(horizontal="center", vertical="center", wrap_text=True)
thin_border = Border(left=Side(style="thin"), right=Side(style="thin"), top=Side(style="thin"), bottom=Side(style="thin"))
for col, h in enumerate(["类型", "剧情描述", "角色名", "编剧台词"], 1):
cell = ws.cell(row=1, column=col, value=h)
cell.font = header_font
cell.fill = header_fill
cell.alignment = header_align
cell.border = thin_border
rows = [
["TL", "【场景】会场 — 品鉴台前\n【角色】User、May、Sam、Jack、Kalab、Tom、Smith、Fiona", "", ""],
["", "接承段结尾四人赶到会场。Kalab 已站在台上,黄金 Kiwi 在聚光灯下", "", ""],
["", "", "Kalab", "My golden kiwi!"],
["", "", "Kalab", "Two hundred days of sun!"],
["", "Smith 切了一片尝了尝满意地点头。Fiona 同样赞许", "", ""],
["", "Tom 拿起一片,咬了一小口 — 皱眉 —悄悄把盘子推开", "", ""],
["", "May 凑近 User 耳边", "", ""],
["", "", "May", "Look. Tom did not eat the kiwi."],
["", "Jack 看过来,好奇地问", "", ""],
["", "", "Jack", "What are they eating?"],
["中互动", "", "User", "Kiwi!"],
["", "Smith 举起评分牌 — 高分。群众鼓掌", "", ""],
["", "【镜头】Sam脸色刷白手抖得更厉害了", "", ""],
["TL", "", "Smith", "Next — Sam and his pineapple!"],
["", "所有人转头看向 Sam 的展位……空的。May 叹气", "", ""],
["", "", "May", "Not again..."],
["中互动", "", "User", "Sam went to the toilet!"],
["", "User 和 May 跑到厕所门口。隔间门关着", "", ""],
["", "May 拍门", "", ""],
["", "", "May", "Sam! It is your turn!"],
["", "", "Sam", "One minute!"],
["中互动", "", "User", "Sam is still in the toilet!"],
["", "门开了。Sam 出来,满头汗,脸色惨白", "", ""],
["", "", "Sam", "I am so sorry..."],
["", "", "Sam", "I went to the toilet."],
["TL", "【场景】会场 — 回程通道\n【角色】User、May、Sam、Fiona", "", ""],
["", "三人往回赶。路上 Fiona 递来一盘切好的普通 Kiwi", "", ""],
["", "", "Fiona", "Try this!"],
["", "", "Fiona", "It is kiwi from Kalab."],
["", "May 尝了一个,眼睛亮了", "", ""],
["", "", "May", "Wow. This kiwi is sweet!"],
["中互动", "", "User", "The kiwi is so sweet!"],
["", "Sam 深呼吸,看着 Pineapple 展台", "", ""],
["", "", "May", "You can do it, Sam!"],
["", "Sam 终于露出一点笑容", "", ""],
["", "", "Sam", "Okay... I will try."],
["", "钩子User 扫了一圈会场 — Smith、Fiona 都在。但评审席上 Tom 的座位空了。User 拉了拉 May 的袖子", "", ""],
]
tl_fill = PatternFill(start_color="E8F0FE", end_color="E8F0FE", fill_type="solid")
interact_fill = PatternFill(start_color="FFF2CC", end_color="FFF2CC", fill_type="solid")
for i, row in enumerate(rows, 2):
for col, val in enumerate(row, 1):
cell = ws.cell(row=i, column=col, value=val)
cell.alignment = cell_align
cell.border = thin_border
if row[0] == "TL":
cell.fill = tl_fill
elif row[0] == "中互动":
cell.fill = interact_fill
ws.freeze_panes = "A2"
wb.save("/root/.openclaw/workspace-xiaobian/output/U23_L2_转_剧本V1.xlsx")
print("OK")