#!/usr/bin/env python3 """Produce dialogue component configs and write back to F column.""" import subprocess, json TOKEN = "t-g1045kg0ZYXHLVSY7EFUPUJUOLBGTOLYLPDKWLYN" SHEET_ID = "wMQVyV" SPREADSHEET_TOKEN = "It4AsFkC7hXHc4te9yUcyLHRnOe" components = { # Row 111: 对话选择-配图 (1217408) 111: """【任务标题】 打开坏掉的门 【资源配置】 图片时机: 互动内容 互动反馈 【情境引入】 无 【互动内容】 要求:选择正确的回复 选项:(音频) 选项1:The door is open.(正确) - 反馈: 无 选项2:The door is closed. - 反馈 Alex: No, look. This door is broken. It's always open. 【后置对话】 无""", # Row 120: 对话选择-配图 (1217409) 120: """【任务标题】 查看关闭的门 【资源配置】 图片时机: 互动内容 互动反馈 【情境引入】 无 【互动内容】 要求:选择正确的回复 选项:(音频) 选项1:Look, the door is closed.(正确) - 反馈: 无 选项2:Look, the door is open. - 反馈 Eva: No, this door is closed. Look again. 【后置对话】 无""", # Row 129: 对话挖空-配图 (1217410) 129: """【任务标题】 还剩最后一扇门 【资源配置】 图片时机: 互动内容 互动反馈 【情境引入】 无 【互动内容】 Only one ___ left.(音频) 选项1:door(正确) 选项2:room 【互动反馈】 正确 Vicky : Yes! Just one more room. 错误 Vicky : Think about it. What do we open? 【后置对话】 无""", # Row 133: 对话组句-配图 (1217411) 133: """【任务标题】 发现门是关着的 【资源配置】 图片时机: 互动内容 互动反馈 【情境引入】 无 【互动内容】 题目:描述这扇门的状态 (音频) 选项1:The 选项2:door 选项3:is 选项4:closed 答案:The door is closed. 辅助信息:用主语 The door + is + 状态词描述门的状态 【互动反馈】 正确 Vicky : Yes, it's closed. Peter must be inside! 错误 Vicky : That doesn't look right. Think about the word order. 【后置对话】 无""", # Row 144: 对话组句-配图 (1217412) 144: """【任务标题】 表示现在门打开了 【资源配置】 图片时机: 互动内容 互动反馈 【情境引入】 无 【互动内容】 题目:描述现在门的状态 (音频) 选项1:The 选项2:door 选项3:is 选项4:open 选项5:Now 答案:Now the door is open. 辅助信息:用主语 The door + is + 状态词描述门的状态;Now 放在句首表示时间 【互动反馈】 正确 Alex : Yes! The door is open now. 错误 Alex : Hmm, try putting the words in the right order. 【后置对话】 无""", # Row 147: 看图拼词 (1217413) 147: """【任务标题】 拼写 door 的英文 【资源配置】 图片文件名:1217413.png 【互动内容】 任务描述:请拼出门的英文单词 题干:d(2)r 答案:oo 选项:o, a, e, r, n, p 辅助信息:门的英文是 door / 中间有两个一样的字母哦 【后置对话】 无""", # Row 163: 对话挖空 (1217414) 163: """【任务标题】 回忆窗户的状态 【资源配置】无 【情境引入】 无 【互动内容】 I remember that. It was ___ before.(音频) 选项1:closed(正确) 选项2:open 【互动反馈】 正确 Alex : Yes, it was closed. But now it's different. 错误 Alex : No. Think about what I just said about the window. 【后置对话】 无""", # Row 164: 对话挖空 (1217415) 164: """【任务标题】 发现窗户现在是开着的 【资源配置】无 【情境引入】 无 【互动内容】 But now it's ___.(音频) 选项1:open(正确) 选项2:closed 【互动反馈】 正确 Alex : Right! Someone opened it! 错误 Alex : Look at the window again. Is it really closed now? 【后置对话】 无""", # Row 179: 对话朗读 (1217416) 179: """【任务标题】 问候 Grace 和 Dan 【资源配置】图片时机:无 【情境引入】无 【互动内容】 User : I'm glad you get home!(朗读) 【后置对话】 无""", } results = {} for row_num, content in sorted(components.items()): body = { "valueRange": { "range": f"{SHEET_ID}!F{row_num}:F{row_num}", "values": [[content]] } } cmd = [ "curl", "-s", "-X", "PUT", f"https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/{SPREADSHEET_TOKEN}/values", "-H", f"Authorization: Bearer {TOKEN}", "-H", "Content-Type: application/json", "-d", json.dumps(body, ensure_ascii=False) ] result = subprocess.run(cmd, capture_output=True, text=True) resp = json.loads(result.stdout) code = resp.get("code", -1) msg = resp.get("msg", "unknown") print(f"Row {row_num}: code={code}, msg={msg}") results[row_num] = {"code": code, "msg": msg} # Summary success = sum(1 for r in results.values() if r["code"] == 0) print(f"\nTotal: {len(results)} writes, {success} succeeded, {len(results) - success} failed")