diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..4d914de5bac16d6d79d298e771a6a4476f02b1be --- /dev/null +++ b/.gitattributes @@ -0,0 +1,10 @@ +*.jpg filter=lfs diff=lfs merge=lfs -text +*.mp4 filter=lfs diff=lfs merge=lfs -text +*.MOV filter=lfs diff=lfs merge=lfs -text +*.JPG filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.woff2 filter=lfs diff=lfs merge=lfs -text +*.woff filter=lfs diff=lfs merge=lfs -text +*.mp3 filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8ea3819ab11f2a2aad7432693e01ecc5226b7a41 --- /dev/null +++ b/README.md @@ -0,0 +1,97 @@ +--- +title: 这个用英语怎么说 · 热点事件英语实况图 +emoji: 🔤 +colorFrom: pink +colorTo: yellow +sdk: static +pinned: false +--- + +# 这个用英语怎么说?· 热点事件英语实况图 + +参考 [Ethscriptions/eths](https://huggingface.co/spaces/Ethscriptions/eths) 的制作流程(Pillow 逐帧渲染 → ffmpeg 编码 → 写入苹果实况配对标识),面向 **雅思 / 托福考生、留学生、年轻职场人**,目前共三组 27 张带声音的苹果实况照片(JPG + MOV,全部 ≤ 3 秒,微信朋友圈兼容)。 + +## 第七组:本周国内社会热点里的 9 个词(2026-10-25 新增) + +选词原则:**词本身就是最近一周国内社会热搜事件的核心词**,同时是雅思 / 托福 / 留学 / 年轻职场人群会直接碰到、却很难一下想起英文的人 / 事 / 物。 + +| # | 中文 | 英文 | 音标 | 类别 | 对应国内热点 | 底图 | +| --- | --- | --- | --- | --- | --- | --- | +| 60 | 余震 | **aftershock** | /ˈæftərʃɑːk/ | 事 | 10 月 22 日西藏那曲巴青县 7.0 级地震,16 人遇难、1600 余名搜救人员驰援 | Commons 实拍(USGS,CC0) | +| 61 | 秋裤 | **long johns** | /ˈlɔːŋ dʒɑːnz/ | 物 | 10 月 21–25 日「全国秋裤预警地图」,超 15 省份需穿秋裤 | AI 生成 | +| 62 | 读研 / 考研 | **grad school** | /ˈɡræd skuːl/ | 事 | 2027 考研 10 月 15–24 日报名收官,预测约 320 万–335 万人 | Commons 实拍(Gary Todd,CC0) | +| 63 | 导师 | **supervisor** | /ˈsuːpərvaɪzər/ | 人 | 考研报名季选导师、联系导师 | AI 生成 | +| 64 | 以旧换新(国补) | **trade-in** | /ˈtreɪd ɪn/ | 事 | 2026 年中央 2500 亿元支持消费品以旧换新,双 11 叠加「国补」 | AI 生成 | +| 65 | 尾款 | **final payment** | /ˈfaɪnl ˈpeɪmənt/ | 物 | 双 11 预售:天猫 10 月 15 日预售、10 月 20 日晚 8 点付尾款 | AI 生成 | +| 66 | 结婚登记 | **marriage registration** | /ˈmærɪdʒ ˌredʒɪˈstreɪʃn/ | 事 | 10 月 24 日统计年鉴:初婚 1042 万重回千万,登记 676.5 万对 +10.8% | AI 生成 | +| 67 | 生育率 | **fertility rate** | /fərˈtɪləti reɪt/ | 事 | 热搜「全国总人口面临跌破 14 亿」,连续四年负增长 | Commons 实拍(Shixart1985,CC BY 2.0) | +| 68 | 续航焦虑 | **range anxiety** | /ˈreɪndʒ æŋˌzaɪəti/ | 事 | 10 月 20 日微博热搜第一「油车电车 10 年成本账怎么算」 | Commons 实拍(Jengtingchen,CC BY-SA 4.0) | + +- 下载包:`live/china-hot-topics-live-photos.zip`(9 对同名 JPG + MOV + 使用说明,约 40 MB) +- 清单:`pack7.json`;制作脚本 `source/studio/items7.json`、`find7.py`、`package7.py`,底图 `source/photos/6x_pick.jpg` 与 `live-*.png` + +热点依据(检索于 2026-10-25 UTC):应急管理部 / BBC 中文(那曲地震)、中国天气网(秋裤预警地图)、教育部(2027 考研报名)、发改委 / 知乎专栏(2026 国补与双 11 时间表)、新浪财经(统计年鉴初婚数据)、微博热搜(总人口 14 亿、油车电车成本账)。 + +## 第六组:国际热点事件里的 9 个词(2026-10-25 新增) + +选词原则:**词本身就是最近两周社会热点事件的核心词**,同时是这几类人群会直接碰到、却很难一下想起英文的人 / 事 / 物。 + +| # | 中文 | 英文 | 音标 | 类别 | 对应热点事件 | 底图 | +| --- | --- | --- | --- | --- | --- | --- | +| 50 | 小黑屋(二次检查) | **secondary inspection** | /ˌsekənderi ɪnˈspekʃn/ | 事 | 10 月 25 日中方再称留学生入境美国时被长时间盘查、遣返 | Commons 实拍(U.S. CBP,公有领域) | +| 51 | 公务员 | **civil servant** | /ˌsɪvl ˈsɜːrvənt/ | 人 | 2027 国考 10 月 14–24 日报名,招 3.57 万人、连续两年缩招 | AI 生成 | +| 52 | 遣散费(N+1) | **severance pay** | /ˈsevərəns peɪ/ | 物 | Barclays 10 月裁约 5,000 人,Amazon / Salesforce 等 AI 裁员潮 | AI 生成 | +| 53 | 关税 | **tariff** | /ˈtærɪf/ | 事 | 10 月 23 日特朗普签令调整对加拿大产品关税 | Commons 实拍(Steven Lek,CC BY-SA 4.0) | +| 54 | 中期选举 | **midterm elections** | /ˈmɪdtɜːrm ɪˈlekʃnz/ | 事 | 11 月 3 日美国中期选举 | Commons 实拍(Ktkvtsh,CC BY 4.0) | +| 55 | (诺奖)得主 | **laureate** | /ˈlɔːriət/ | 人 | 10 月 5–12 日诺贝尔奖揭晓 | Commons 实拍(Osama S. M. Amin,CC BY-SA 4.0) | +| 56 | 停火 | **ceasefire** | /ˈsiːsfaɪər/ | 事 | 10 月 23 日俄乌同意在 Oleshky 局部停火,10 月 27 日生效 | Commons 实拍(Dietmar Rabich,CC BY-SA 4.0) | +| 57 | 流感疫苗 | **flu shot** | /ˈfluː ʃɑːt/ | 物 | 流感季:美国高校 9–10 月校园疫苗诊所,两岸疾控提示流行期 | Commons 实拍(Staff Sgt. Samara Taylor,公有领域) | +| 58 | 疫情暴发 | **outbreak** | /ˈaʊtbreɪk/ | 事 | 10 月 20 日尼日利亚确认埃博拉输入病例,非洲疾控紧急会议 | Commons 实拍(CDC Global,CC BY 2.0) | + +- 下载包:`live/hot-news-words-live-photos.zip`(9 对同名 JPG + MOV + 使用说明,约 43 MB) +- 清单:`pack6.json`;制作脚本 `source/studio/items6.json`、`find6.py`、`package6.py`,底图 `source/photos/5x_pick.jpg` 与 `live-civil-servant.png`、`live-severance-pay.png` + +热点依据(检索于 2026-10-25 UTC):VOA 中文(留学生入境盘查)、人民网 / 新浪财经(2027 国考)、Reuters(AI 裁员、俄乌停火)、白宫 Fact Sheet(加拿大关税)、Overseas Vote Foundation(中期选举 11 月 3 日)、NobelPrize.org、UT Austin UHS(校园流感疫苗)、WHO AFRO(尼日利亚埃博拉)。以上只是选题依据,不构成签证、考试或求职建议。 + +## 第五组:留学 & 职场场景里的 9 个日常词 + +这几类人群在热点场景(雅思停考、签证新规、秋招入职)里常碰到、却叫不出英文名的日常词。 + +| # | 中文 | 英文 | 音标 | 类别 | 热点钩子 | 底图 | +| --- | --- | --- | --- | --- | --- | --- | +| 41 | 监考老师 | **invigilator** | /ɪnˈvɪdʒɪleɪtər/ | 人 | 10 月 10–13 日雅思机考系统故障,中国大陆考试连停 4 天 | AI 生成 | +| 42 | 成绩单 | **transcript** | /ˈtrænskrɪpt/ | 物 | 托福 iBT 新版(2026-01-21 起)改用 1–6 分制,申请季递交材料 | AI 生成 | +| 43 | 录指纹 | **biometrics** | /ˌbaɪoʊˈmetrɪks/ | 事 | 美国 F-1 改 4 年固定期限(2026-09-15 生效)、英国毕业生签证明年缩至 18 个月,签证预约扎堆 | Wikimedia Commons(U.S. CBP,公有领域) | +| 44 | 转机 | **layover** | /ˈleɪoʊvər/ | 事 | 开学季与假期往返机票 | Wikimedia Commons(No Swan So Fine,CC BY-SA 4.0) | +| 45 | 时差 | **jet lag** | /ˈdʒet læɡ/ | 事 | 长途飞行后倒时差 | Wikimedia Commons(Saimmx,CC0) | +| 46 | 押金 | **security deposit** | /sɪˈkjʊrəti dɪˌpɑːzɪt/ | 物 | 留学生租房季,澳洲、英国租房紧张 | AI 生成 | +| 47 | 试用期 | **probation period** | /proʊˈbeɪʃn ˌpɪriəd/ | 事 | 秋招 8–11 月进入主批,应届生陆续入职 | AI 生成 | +| 48 | 工位 | **cubicle** | /ˈkjuːbɪkl/ | 物 | 职场新人日常 | Wikimedia Commons(Asa Wilson,CC BY-SA 2.0) | +| 49 | 工资条 | **payslip** | /ˈpeɪslɪp/ | 物 | 第一份工资到账 | AI 生成 | + +- 下载包:`live/study-abroad-workplace-live-photos.zip`(9 对同名 JPG + MOV + 使用说明,约 41 MB) +- 网页预览:`live/cover_*.jpg`(封面)、`live/final_*.jpg`(答案帧)、`live/preview_*.mp4`(720p 预览,带声音) +- 清单:`pack.json` + +## 热点依据(检索于 2026-10-25 UTC) + +- 雅思机考系统故障,British Council 取消 10 月 10–13 日中国大陆机考,后恢复(SCMP / ieltsvega / toeflresources) +- TOEFL iBT 2026-01-21 起改版,分数改用 1–6 分制(ETS) +- 美国 DHS 取消 F-1/J-1「D/S」,改为最长 4 年固定期限,2026-09-15 生效;10 月 8 日提议 OPT 收费(UC Davis SISS、Pitt News) +- 英国 Graduate visa:2026-12-31 前申请 2 年,2027-01-01 起 18 个月(GOV.UK) +- 国内秋招 8–11 月进入主批,10–11 月完成筛选面试(解放日报 / 前程无忧) + +以上只是选题依据,不构成签证、考试或求职建议,请以官方页面为准。 + +## 制作流程(`source/studio/`) + +1. `items5.json` — 9 个词条(中文 / 英文 / 音标 / 词性 / 类别 / 热点钩子 / Commons 检索词 / 卡片位置) +2. `find5.py` — 按词条检索 Wikimedia Commons,仅保留 CC0 / 公有领域 / CC BY / CC BY-SA 的大图,生成候选图拼版供人工挑选;选不到合适实拍图的词条改用 AI 生成底图(`source/photos/`) +3. `render.py` + `audio.py` — 1080×1440 @ 30fps 逐帧渲染:封面提问 →「答案揭晓」→ 字母逐个弹出 → 音标 + 两遍真人感 TTS(Edge 神经语音 Ava / Andrew)→ 释义;音效(whoosh / 打字 tick / 和弦 / 彩纸)为程序合成;总时长锁定 ≤ 3 秒 +4. `package5.py` + `pair_live_photo.py` — 用 [LiveCanvas](https://github.com/pengchujin/livecanvas)(MIT / Apache-2.0)改造的配对器写入 Apple Live Photo 标识(保留 AAC 音轨),生成下载包、网页预览与 `pack.json` + +依赖:Python 3.12、Pillow、numpy、edge-tts、ffmpeg/ffprobe,字体 Poppins / Noto Sans / Noto Sans SC / 得意黑(Smiley Sans)。 + +## 图片来源与授权 + +4 张实拍底图来自 Wikimedia Commons,作者与许可见页面底部及素材包内 `使用说明.txt`;CC BY-SA 图片二次发布时请保留署名并沿用相同许可。其余 5 张为本项目 AI 生成图片。网页本身为纯静态,不上传任何用户数据。实况图制作工具请到原项目 [Ethscriptions/eths](https://huggingface.co/spaces/Ethscriptions/eths)。 diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..7f0c16a4782a7b98277a3664bee208d0585c5f5d Binary files /dev/null and b/favicon.ico differ diff --git a/fonts/lw-ipa-500.woff2 b/fonts/lw-ipa-500.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..d48d00cd4d7bff1b06567ecc264ed53e2963b8d6 --- /dev/null +++ b/fonts/lw-ipa-500.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c6040d6b5a51617cfceff93905b05cf70f57e7de7a63d348128623f71085715 +size 49308 diff --git a/fonts/lw-poppins-600.woff2 b/fonts/lw-poppins-600.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..0ad1f9e19863f7fc69dd3b97bcd99b9789ec7b4d --- /dev/null +++ b/fonts/lw-poppins-600.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad9a7124f57b64ee302c169eeb3c88c6c14337a9bfa8aea9e35e8c7bf83f09a7 +size 51560 diff --git a/fonts/lw-poppins-800.woff2 b/fonts/lw-poppins-800.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..5a78279ade4e02f1297f2c94b54daa06e4796a0e --- /dev/null +++ b/fonts/lw-poppins-800.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fcdf47602defc21f1a03d304c63c1e53b070271d1313dfa2ea8a7c201e1a151a +size 50916 diff --git a/fonts/lw-sc-500.woff2 b/fonts/lw-sc-500.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..d7419c4bb831b880ba0da456c6dbde20654205ad --- /dev/null +++ b/fonts/lw-sc-500.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e025bfcb117d83617cacc7a8bd0475e04f145768a5956747ab81e5b273e75482 +size 132 diff --git a/fonts/lw-sc-700.woff2 b/fonts/lw-sc-700.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..e2b27e66f21d8aec549e931b696704a37df8b5cb --- /dev/null +++ b/fonts/lw-sc-700.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f76f452e3ebaee4f91e015c3da77e209c806af9c0bc066a6845755df90eefb30 +size 132 diff --git a/fonts/lw-smiley.woff2 b/fonts/lw-smiley.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..d2253c62e711101f6c0271526300bfc6c8ca4083 --- /dev/null +++ b/fonts/lw-smiley.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b377879fd406d940000df63731122707b6a0526e70d35097de020162b9e19d96 +size 132 diff --git a/index.html b/index.html new file mode 100644 index 0000000000000000000000000000000000000000..91fe5f5f43b82f6ab98549214edcf4263a2c0fac --- /dev/null +++ b/index.html @@ -0,0 +1,233 @@ + + + + + + +这个用英语怎么说?· 热点事件英语实况图 + + + + +
+ + +
+ 🔥 2026 年 10 月 · 两组共 18 张实况图 +

新闻里天天见的人、事、物,
换成英文你能马上说出来吗?

+

给 雅思 / 托福考生、留学生、年轻职场人 做的实况图单词卡:每张 ≤ 3 秒,先看封面猜中文,长按实况听两遍发音、看音标和释义。第六组是最近两周社会热点事件本身涉及的词(入境小黑屋、国考公务员、AI 裁员遣散费、关税、中期选举、诺奖得主、停火、流感疫苗、疫情暴发);第五组是这些人群在热点场景里常碰到的日常词。全部 JPG + MOV 成对打包,导入苹果「照片」即为带声音的 LIVE 实况照片,可发微信朋友圈 / 小红书 / 抖音图文。

+
+ +
+ +
+
+

怎么用(Mac → iPhone)

+
    +
  1. 下载并解压素材包,里面是 9 对同名文件:LIVE_41_invigilator.JPG / .MOV ……
  2. +
  3. 全选所有 JPG 和 MOV,一起拖进 Mac「照片」App(或 照片 → 文件 → 导入);每一对会被识别为一张 LIVE 实况照片。
  4. +
  5. 通过 iCloud 照片或隔空投送到 iPhone,发朋友圈 / 小红书 / 抖音图文时选中它们,保持「实况」开启即可带声音播放。
  6. +
  7. 不要用其他软件重新转码 MOV,否则会丢失配对信息。尺寸 1080×1440(3:4),30fps,H.264 + AAC,全部 ≤ 3 秒。
  8. +
+
+
+

建议文案(点右上角复制)

+
+
+
+ +
+

图片来源与授权

+ +
+ + +
+ + + + diff --git a/live/cover_41.jpg b/live/cover_41.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5bce559afe94e0e103602505914a119d5e02b09a --- /dev/null +++ b/live/cover_41.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46409692a2e19094c7c279cb41ac7c966b9ccb2eed78dd487466271ea98f4399 +size 140094 diff --git a/live/cover_42.jpg b/live/cover_42.jpg new file mode 100644 index 0000000000000000000000000000000000000000..879a5b9dce7bd4f0c8617732fdede74204eee1f7 --- /dev/null +++ b/live/cover_42.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44a02587f4c83e61d50d70040807aada85e177e6a1de2d939808cf3f617eec46 +size 152546 diff --git a/live/cover_43.jpg b/live/cover_43.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aac51233290548d46471d536176c7b1e13cc485e --- /dev/null +++ b/live/cover_43.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0b948d9a6e6a7096c4c28ec3f10ec43fd59fbf338510ae21859cb94c05348b7 +size 76280 diff --git a/live/cover_44.jpg b/live/cover_44.jpg new file mode 100644 index 0000000000000000000000000000000000000000..473f8ff75ec9d43750dd7be8d02f3519064ef0c2 --- /dev/null +++ b/live/cover_44.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b2c1fffb99649584396486833a1eceab6d8b01d1a6602fb4875ddd6e8dc8e61 +size 219270 diff --git a/live/cover_45.jpg b/live/cover_45.jpg new file mode 100644 index 0000000000000000000000000000000000000000..60017b18a463223786320d1177bd4afa1d1935c2 --- /dev/null +++ b/live/cover_45.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c15687b25123ce8dd1291ef91dcdf21acc7e98aeaea08df581d443458fc7d8c4 +size 89983 diff --git a/live/cover_46.jpg b/live/cover_46.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cd453beae07945debc38d71bd3528ff90409126c --- /dev/null +++ b/live/cover_46.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:567e2e8626da62a0f5e34d51d84055c619562356818135c20f51c1b85d476b07 +size 98391 diff --git a/live/cover_47.jpg b/live/cover_47.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d5d191f00d7005b4a4d1f5989005889a6c2ef390 --- /dev/null +++ b/live/cover_47.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:96967c36b53449f8b3906cd589324bacbd9764000f7f8ba9eba7492bc5e0fa82 +size 138515 diff --git a/live/cover_48.jpg b/live/cover_48.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7afa19fa3a97949abe4be6755851db5ebcca5715 --- /dev/null +++ b/live/cover_48.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:127bd42aeddabb743eccffdd591f406398ab50b3babe38c0fc49aa650b04bc32 +size 197456 diff --git a/live/cover_49.jpg b/live/cover_49.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0343dae54677d98459a3a284ae9db5be01da58ab --- /dev/null +++ b/live/cover_49.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0816545286d4c750f56903c8dac2e2646dead788d25f1c0b6bc7a77fa076c31 +size 92304 diff --git a/live/cover_50.jpg b/live/cover_50.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f27c2c1ff203621c2fb9767bc0b516fc1d1fd427 --- /dev/null +++ b/live/cover_50.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a81bb05d420b38e567aa27233f5ab75da10c0a7c9a5f939bed301252d2e6b782 +size 78491 diff --git a/live/cover_51.jpg b/live/cover_51.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ccfaf7b6579970a6fe9fa0d32dd4787cee2ba33f --- /dev/null +++ b/live/cover_51.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2b0f20ab4cb8315acf0f8b8c97afa09c5f11b3fb9901d81d3e191d1fb261962 +size 124649 diff --git a/live/cover_52.jpg b/live/cover_52.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e8f9b7634894fc217f84f41d2c6e0e9d5bd57c9f --- /dev/null +++ b/live/cover_52.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd943c3aad802ba02bef1393ddf98845ebfa1f1d90d5e0d6bb5455b1d0a4bf6b +size 131154 diff --git a/live/cover_53.jpg b/live/cover_53.jpg new file mode 100644 index 0000000000000000000000000000000000000000..68f5ac350d0c74826881fd1b9f3a6ae21ddb4f12 --- /dev/null +++ b/live/cover_53.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6419ace3d381aeec040b1d348ce1fde6feb65734f011bcf440b0b8049393d60d +size 155225 diff --git a/live/cover_54.jpg b/live/cover_54.jpg new file mode 100644 index 0000000000000000000000000000000000000000..707e788c7e60c0ec7ec46c3b8d60372a7f57bb54 --- /dev/null +++ b/live/cover_54.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c4e1510adf281c4a3faef1ad6bbfca6787591fe425f1a105b0cf517bba1b7fc +size 97781 diff --git a/live/cover_55.jpg b/live/cover_55.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4d5938c3045835ea955c30162c700cdae0b8ae8a --- /dev/null +++ b/live/cover_55.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3484a836244f358fb5344ae5a861966ba9180487c988c84b6922492106eea8b7 +size 203720 diff --git a/live/cover_56.jpg b/live/cover_56.jpg new file mode 100644 index 0000000000000000000000000000000000000000..22c34862f59c7e0c97d467400e72c35db25cbbf8 --- /dev/null +++ b/live/cover_56.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecb690a8621ffbcf5f44bdc6a1063da9b371c1abea17902cdeb4fd9777d37da4 +size 121874 diff --git a/live/cover_57.jpg b/live/cover_57.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7545e3fce96d9c1b50749a7eb63a5ce0d2889bff --- /dev/null +++ b/live/cover_57.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e2a390c7c592e4af58a27d40538969982c437cf0c235e0a3c0c69a15264f8bc +size 98894 diff --git a/live/cover_58.jpg b/live/cover_58.jpg new file mode 100644 index 0000000000000000000000000000000000000000..15f047eb0a9d01015bd577b181c1f7befac69963 --- /dev/null +++ b/live/cover_58.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:431276a9d205cd30669b9d25299285ba99f496cf3a04484a2efec03220a4429d +size 88381 diff --git a/live/final_41.jpg b/live/final_41.jpg new file mode 100644 index 0000000000000000000000000000000000000000..78cb4c62e8b352760ee254a218b1a1fb67a67230 --- /dev/null +++ b/live/final_41.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d3b915248ccb1743879353b721df67c8b209f7be46d5ab11f1679a544fac705 +size 112541 diff --git a/live/final_42.jpg b/live/final_42.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7ecd9ed28b7bd1cf971e3ce8934cd48c3727d2cb --- /dev/null +++ b/live/final_42.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f339978678a0aedf7bf78167847c66b4a7e70b064e7eac255907a5544bf7c9fb +size 108197 diff --git a/live/final_43.jpg b/live/final_43.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ae1c192b003703f6b2827f66b15680cfddda2b36 --- /dev/null +++ b/live/final_43.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5325b1da38c49166c113b98de00bfe465d4d69a47fe0079584c8f65c1ed0fdfb +size 58373 diff --git a/live/final_44.jpg b/live/final_44.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e2143fd3297519b32070c7aafd6e9d1f850e9ad3 --- /dev/null +++ b/live/final_44.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d63cfce8ee667556ef2f21738e573d7bdeb99528b1021daf4a70c09bc22a439f +size 152924 diff --git a/live/final_45.jpg b/live/final_45.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a789615b14b82fee49a48daed329f2537ba99435 --- /dev/null +++ b/live/final_45.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be44403d202e938240a192f80518497047302eba86a618814f06d106467cc8f6 +size 67728 diff --git a/live/final_46.jpg b/live/final_46.jpg new file mode 100644 index 0000000000000000000000000000000000000000..20aa63042a2913c91710548b0c2c15974aff8b59 --- /dev/null +++ b/live/final_46.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3df1b616aeb55e7713d78b3d1d4309e9cbe5a39c0ed135d433a34554a384dfa3 +size 79397 diff --git a/live/final_47.jpg b/live/final_47.jpg new file mode 100644 index 0000000000000000000000000000000000000000..51083ea8b1ec6960d0220a6271e74da93759de95 --- /dev/null +++ b/live/final_47.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1b0db6d079e099144e351e1dacc2ca8cfea0a499c23be701f9c11fbb134fa5e +size 107321 diff --git a/live/final_48.jpg b/live/final_48.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a489a3df954980ea443399278f6216231b7f5832 --- /dev/null +++ b/live/final_48.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1711c2b6a132c4703ba418b89be94c7161c29a390832d96c74a9e909a0310e69 +size 137084 diff --git a/live/final_49.jpg b/live/final_49.jpg new file mode 100644 index 0000000000000000000000000000000000000000..84205c06d849289ac9dd0693e8f133bff75f484b --- /dev/null +++ b/live/final_49.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5378724f994599439bd552b6ead88ff86eba37f7de0087f3f51e275a37d50099 +size 64370 diff --git a/live/final_50.jpg b/live/final_50.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a4c07274c744685b677cd56a34f9c59981b2f66d --- /dev/null +++ b/live/final_50.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8893bacbc1eb2a8d00041aee7b1c127ed3c63c31ab24498718ff0a99ea11c0c +size 65660 diff --git a/live/final_51.jpg b/live/final_51.jpg new file mode 100644 index 0000000000000000000000000000000000000000..81576ee5f296b6f7b0de1ba6ba71b2df43687c34 --- /dev/null +++ b/live/final_51.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de157a51b167a1bdbb7f3d9cf5bd01fc52f0c179e2df06d03bb9e7262c864c3f +size 99945 diff --git a/live/final_52.jpg b/live/final_52.jpg new file mode 100644 index 0000000000000000000000000000000000000000..312efd9ce29af8c9197a850ff1382a6b5dc564df --- /dev/null +++ b/live/final_52.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72ec8b7a1a025bd018d3b98d48aa5290f60ae0879c350026008230783cddab1f +size 95680 diff --git a/live/final_53.jpg b/live/final_53.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6f07d8006284a8a34f46826a9338fd4073b5817f --- /dev/null +++ b/live/final_53.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d8e9f86be2e7f4d554489b19c74f3ad24859caba9cd2593251e63dcbafad396 +size 104675 diff --git a/live/final_54.jpg b/live/final_54.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e35d89a74e73325626fd6152414ff8e9e5350470 --- /dev/null +++ b/live/final_54.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c31da6cb5731277673f04f93e31bd768fb78436f7547146ef8bb6ecabc6caad +size 79446 diff --git a/live/final_55.jpg b/live/final_55.jpg new file mode 100644 index 0000000000000000000000000000000000000000..8c065759aa5631986030e47011d3af41a8118335 --- /dev/null +++ b/live/final_55.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cdfeeb0fb71382e4b523a53f661a23e77eecfd54e56009d4e3ca945cc5870948 +size 136672 diff --git a/live/final_56.jpg b/live/final_56.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d7139ed63d42e88048c9551b094484d689894785 --- /dev/null +++ b/live/final_56.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b52ea98e806b6a5cb5389d9a308bc4a13fe4a5def79e1a3cb3bd31077b6b282 +size 101713 diff --git a/live/final_57.jpg b/live/final_57.jpg new file mode 100644 index 0000000000000000000000000000000000000000..78fd2a2bf95c3056a20116f55832ab0337a61755 --- /dev/null +++ b/live/final_57.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75fd23d7e7344d1121d1e022002d0555716dcf18c5627a9f3e3a12e1fc7a9d0e +size 68435 diff --git a/live/final_58.jpg b/live/final_58.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7343cae24eaba4dc25fea72eca8df096c6bd5063 --- /dev/null +++ b/live/final_58.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9568f553eccf6c16b416151f604f9b71b19f927b36d8b4fee7abfb86a9464c7f +size 62888 diff --git a/live/hot-news-words-live-photos.zip b/live/hot-news-words-live-photos.zip new file mode 100644 index 0000000000000000000000000000000000000000..4ebed19b93b1f51c80f4ea2115a1ae84c0cdb036 --- /dev/null +++ b/live/hot-news-words-live-photos.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2cec07d5e447fd0ff684dbb44fa2c1b16d11a806dc1a7078a7a288c4a274674 +size 42979404 diff --git a/live/preview_41.mp4 b/live/preview_41.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..26e0d8d57cafb792f1aba46b93a919bdcc36c0b3 --- /dev/null +++ b/live/preview_41.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:247fcf458eccdd3467df57f3361c503d60d87f23415a4555cb66512a13f29042 +size 430006 diff --git a/live/preview_42.mp4 b/live/preview_42.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..0d07712ddc077212723463b950288365850b9da0 --- /dev/null +++ b/live/preview_42.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0fdf324aca9f3f7f5b74bc04022d7f0289607689491c6222f5b3eca262e4d9ce +size 474163 diff --git a/live/preview_43.mp4 b/live/preview_43.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..8b47282dfe38a9aabf7b5cf76d1aa62637a22fec --- /dev/null +++ b/live/preview_43.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6c4eed763e3d63efa65fa0af90d068f77d9773634603c4f5af10198900a5228 +size 283779 diff --git a/live/preview_44.mp4 b/live/preview_44.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..d9e13c02315eb1e240e8725eb161196a6421b963 --- /dev/null +++ b/live/preview_44.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e862befcb35968a504aee2cbe73279b1117771e6d3351a5eff66ebb0fabaa5e8 +size 789824 diff --git a/live/preview_45.mp4 b/live/preview_45.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..afdb9abffb5c8e06cec1e10d28c05c01e518662e --- /dev/null +++ b/live/preview_45.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:358493a3e72941b9572c8ae9383b0ea8c7a02cd1ab8f16281fd7571809ae2b47 +size 322859 diff --git a/live/preview_46.mp4 b/live/preview_46.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..47e77fc3e4f9ddc41460ab09342ccc0f7291fe8e --- /dev/null +++ b/live/preview_46.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98b4df68793b99135ec4b70556b7167c1cbbe0954037fdf96460481214128c13 +size 337373 diff --git a/live/preview_47.mp4 b/live/preview_47.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..7d3de675eb5d27fe0c59a340ba4ff6e83b685faa --- /dev/null +++ b/live/preview_47.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ba94badec3d3c00a352e642b03bcb730f0e307cb83f564540d92b259d62c982 +size 373462 diff --git a/live/preview_48.mp4 b/live/preview_48.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..82b5c68026cdb0cd0db0c08e1dafcad496c6ed21 --- /dev/null +++ b/live/preview_48.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:540c518b81d4e37a679d4f9c160d491290c4907a222ccbbccfb4cd207a8d6c99 +size 558103 diff --git a/live/preview_49.mp4 b/live/preview_49.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..c6a64a1ea130f10302ac6a64a6d7061c43bc6622 --- /dev/null +++ b/live/preview_49.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aae75f46db6e9c8a9c100e9e89b57a0be1e95324a89fbbc635402da5d5816c15 +size 307761 diff --git a/live/preview_50.mp4 b/live/preview_50.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..218b6694ee50cf737a5dbd5fd64b431153fb320f --- /dev/null +++ b/live/preview_50.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51c41d57032727c73984ca91b1d8d13891b08ae4d573d6065dc626ba98d273fe +size 298535 diff --git a/live/preview_51.mp4 b/live/preview_51.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..d36e857c956e59c16dfe7e4734a7dd4b2a2ad6ac --- /dev/null +++ b/live/preview_51.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d766744ad0e3734d563ea6d18d65c31ec5e3e398ce60dbc622c07f20a0120af6 +size 354771 diff --git a/live/preview_52.mp4 b/live/preview_52.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..d01c93f7a418a8b5d785b7bd9b480421125e0f08 --- /dev/null +++ b/live/preview_52.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a020b9741b73b06bd220bc1ec67bc542b1bc2c3a9be579c341a7c0a2348b802 +size 350270 diff --git a/live/preview_53.mp4 b/live/preview_53.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..172969718607522066855705f0712f0d03cbd513 --- /dev/null +++ b/live/preview_53.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a69679ae9d7e63c6f44858904e5c7fd4ab58d50e0d897c774f545020a3ac9c1d +size 373950 diff --git a/live/preview_54.mp4 b/live/preview_54.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..9858b6c851b5c54b6a186ffe1e6c4e6409914d94 --- /dev/null +++ b/live/preview_54.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2bf8e33b5816a42ef51a0cb2c83e81ea667af65946a5b943f2f3c1c66849f4d +size 345184 diff --git a/live/preview_55.mp4 b/live/preview_55.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..fee5cc1e82c94aad5ee50ae9b13d7f5fbc7fd999 --- /dev/null +++ b/live/preview_55.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e08ce17e80764738b64e0eab7050fa654e26c7b031d916976df4fe64e3e6f040 +size 485794 diff --git a/live/preview_56.mp4 b/live/preview_56.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..67fa3dd8b52ade7aa594299f25fdefb2d1ee39b9 --- /dev/null +++ b/live/preview_56.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62b7817565d58e6ef55b7400d92b82d3fd7fd6f8e1f7c4acf87b1eb75cda8920 +size 422145 diff --git a/live/preview_57.mp4 b/live/preview_57.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..5514499f2ded421852c1f4d70ead93f996d3e197 --- /dev/null +++ b/live/preview_57.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:785972e54c483aa49a1e065bf416342775c56a7432985aa9c879ce24d1b61902 +size 312082 diff --git a/live/preview_58.mp4 b/live/preview_58.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..3a9cc9fedec18748e43b10f11189bd3e30668576 --- /dev/null +++ b/live/preview_58.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:679bdf4de3dcf750d22ba44eba4a8b92aca53319acd8da0c56c17c80461bd3c5 +size 297242 diff --git a/live/study-abroad-workplace-live-photos.zip b/live/study-abroad-workplace-live-photos.zip new file mode 100644 index 0000000000000000000000000000000000000000..8e3cfe1a58f89a49a9b79565ca6f8b199a10a790 --- /dev/null +++ b/live/study-abroad-workplace-live-photos.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df0d63a067005cae6975e35d29374bc930bcc47a6eff68456ddd78591c1044e5 +size 40752357 diff --git a/pack.json b/pack.json new file mode 100644 index 0000000000000000000000000000000000000000..1ee0ceec82f679bc8d39a321b1e1e43282d76288 --- /dev/null +++ b/pack.json @@ -0,0 +1,207 @@ +{ + "key": "e", + "name": "第五组 · 留学 & 职场:热点里的 9 个词", + "zip": "study-abroad-workplace-live-photos.zip", + "zipMB": 40.8, + "items": [ + { + "id": "41", + "index": 1, + "zh": "监考老师", + "en": "invigilator", + "ipa": "/ɪnˈvɪdʒɪleɪtər/", + "pos": "n.", + "cat": "人", + "hook": "10月雅思机考系统故障、全国连停4天,改期重考成热词", + "source": "ai", + "duration": 3.0, + "cover": "cover_41.jpg", + "final": "final_41.jpg", + "preview": "preview_41.mp4", + "identifier": "6FAD3675-4AC8-4F4C-BDAE-5606E6084920", + "file": "LIVE_41_invigilator" + }, + { + "id": "42", + "index": 2, + "zh": "成绩单", + "en": "transcript", + "ipa": "/ˈtrænskrɪpt/", + "pos": "n.", + "cat": "物", + "hook": "托福改用1–6新分制、申请季递交材料", + "source": "ai", + "duration": 3.0, + "cover": "cover_42.jpg", + "final": "final_42.jpg", + "preview": "preview_42.mp4", + "identifier": "28383060-C341-41E7-B302-8D4D6F1101DD", + "file": "LIVE_42_transcript" + }, + { + "id": "43", + "index": 3, + "zh": "录指纹", + "en": "biometrics", + "ipa": "/ˌbaɪoʊˈmetrɪks/", + "pos": "n.", + "cat": "事", + "hook": "美签F-1改4年固定期限、英国毕业生签证明年缩至18个月,签证预约扎堆", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_43.jpg", + "final": "final_43.jpg", + "preview": "preview_43.mp4", + "identifier": "35C09A85-18A2-4BED-A985-ABB684531FC9", + "file": "LIVE_43_biometrics" + }, + { + "id": "44", + "index": 4, + "zh": "转机", + "en": "layover", + "ipa": "/ˈleɪoʊvər/", + "pos": "n.", + "cat": "事", + "hook": "开学季与假期往返机票", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_44.jpg", + "final": "final_44.jpg", + "preview": "preview_44.mp4", + "identifier": "EBD6CFEE-FB1D-4299-A243-AF266EDF11FC", + "file": "LIVE_44_layover" + }, + { + "id": "45", + "index": 5, + "zh": "时差", + "en": "jet lag", + "ipa": "/ˈdʒet læɡ/", + "pos": "n.", + "cat": "事", + "hook": "长途飞行后倒时差", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_45.jpg", + "final": "final_45.jpg", + "preview": "preview_45.mp4", + "identifier": "2C52A202-0F6B-49E3-8C6A-6B2206E4B2CF", + "file": "LIVE_45_jet-lag" + }, + { + "id": "46", + "index": 6, + "zh": "押金", + "en": "security deposit", + "ipa": "/sɪˈkjʊrəti dɪˌpɑːzɪt/", + "pos": "n.", + "cat": "物", + "hook": "留学生租房季,澳洲、英国租房紧张", + "source": "ai", + "duration": 2.87, + "cover": "cover_46.jpg", + "final": "final_46.jpg", + "preview": "preview_46.mp4", + "identifier": "5372036C-68D4-41FF-83E6-AA68889676E3", + "file": "LIVE_46_security-deposit" + }, + { + "id": "47", + "index": 7, + "zh": "试用期", + "en": "probation period", + "ipa": "/proʊˈbeɪʃn ˌpɪriəd/", + "pos": "n.", + "cat": "事", + "hook": "秋招8–11月进入主批,应届生陆续入职", + "source": "ai", + "duration": 2.53, + "cover": "cover_47.jpg", + "final": "final_47.jpg", + "preview": "preview_47.mp4", + "identifier": "49F09809-A252-47F8-91B2-F842F317972B", + "file": "LIVE_47_probation-period" + }, + { + "id": "48", + "index": 8, + "zh": "工位", + "en": "cubicle", + "ipa": "/ˈkjuːbɪkl/", + "pos": "n.", + "cat": "物", + "hook": "职场新人日常", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_48.jpg", + "final": "final_48.jpg", + "preview": "preview_48.mp4", + "identifier": "C6C84B3A-2531-4CF2-931E-4E92785EB2E6", + "file": "LIVE_48_cubicle" + }, + { + "id": "49", + "index": 9, + "zh": "工资条", + "en": "payslip", + "ipa": "/ˈpeɪslɪp/", + "pos": "n.", + "cat": "物", + "hook": "第一份工资到账", + "source": "ai", + "duration": 3.0, + "cover": "cover_49.jpg", + "final": "final_49.jpg", + "preview": "preview_49.mp4", + "identifier": "7DC3EEFD-CD6B-4C24-8525-1C9CE46A27B5", + "file": "LIVE_49_payslip" + } + ], + "copy": { + "title": "雅思停考、签证新规、秋招入职……这 9 个词你能用英语说出来吗?", + "body": "最近留学圈和职场圈都挺热闹:雅思机考故障停考 4 天、美国 F-1 改 4 年固定期限、英国毕业生签证明年缩到 18 个月、秋招进入高峰……这些场景里天天碰到的人和事,换成英文你能马上说出来吗👀\n先看封面猜一猜,再长按实况看答案(记得开声音🔊)\n评论区报一下你答对了几个~\n\n监考老师 / 成绩单 / 录指纹 / 转机 / 时差 / 押金 / 试用期 / 工位 / 工资条\n\n图片来源:4 张为 Wikimedia Commons 授权照片(作者与授权见素材包内说明),5 张为 AI 生成\n\n#雅思 #托福 #留学 #留学生 #职场英语 #英语单词 #实况图 #每日英语 #秋招 #英语学习" + }, + "credits": [ + { + "id": "44", + "zh": "转机", + "en": "layover", + "author": "No Swan So Fine", + "license": "CC BY-SA 4.0", + "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0", + "page": "https://commons.wikimedia.org/wiki/File:Departure_board_at_Kuala_Lumpur_International_Airport,_January_2023.jpg", + "file": "Departure board at Kuala Lumpur International Airport, January 2023.jpg" + }, + { + "id": "43", + "zh": "录指纹", + "en": "biometrics", + "author": "U.S. Customs and Border Protection", + "license": "Public domain", + "licenseUrl": "", + "page": "https://commons.wikimedia.org/wiki/File:161129-Dulles-OFO-Ops-GF-372_(30534091333).jpg", + "file": "161129-Dulles-OFO-Ops-GF-372 (30534091333).jpg" + }, + { + "id": "48", + "zh": "工位", + "en": "cubicle", + "author": "Asa Wilson", + "license": "CC BY-SA 2.0", + "licenseUrl": "https://creativecommons.org/licenses/by-sa/2.0", + "page": "https://commons.wikimedia.org/wiki/File:CubeSpace.jpg", + "file": "CubeSpace.jpg" + }, + { + "id": "45", + "zh": "时差", + "en": "jet lag", + "author": "Saimmx", + "license": "CC0", + "licenseUrl": "http://creativecommons.org/publicdomain/zero/1.0/deed.en", + "page": "https://commons.wikimedia.org/wiki/File:20260908_093742_Taoyuan_airport_woman_napping_closer.jpg", + "file": "20260908 093742 Taoyuan airport woman napping closer.jpg" + } + ] +} \ No newline at end of file diff --git a/pack6.json b/pack6.json new file mode 100644 index 0000000000000000000000000000000000000000..5b0e873aab5b7b5b72625f2985a5e5ef98d3ea7f --- /dev/null +++ b/pack6.json @@ -0,0 +1,237 @@ +{ + "key": "f", + "name": "第六组 · 本周热点事件里的 9 个词", + "zip": "hot-news-words-live-photos.zip", + "zipMB": 43.0, + "items": [ + { + "id": "50", + "index": 1, + "zh": "小黑屋(二次检查)", + "en": "secondary inspection", + "ipa": "/ˌsekənderi ɪnˈspekʃn/", + "pos": "n.", + "cat": "事", + "hook": "10月25日中方再称留学生入境美国时被长时间盘查、遣返,有人被限制人身自由10余小时", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_50.jpg", + "final": "final_50.jpg", + "preview": "preview_50.mp4", + "identifier": "36AD717E-16CF-43BB-A80C-7A15FBAC4718", + "file": "LIVE_50_secondary-inspection" + }, + { + "id": "51", + "index": 2, + "zh": "公务员", + "en": "civil servant", + "ipa": "/ˌsɪvl ˈsɜːrvənt/", + "pos": "n.", + "cat": "人", + "hook": "2027国考10月14–24日报名,计划招录3.57万人、连续两年缩招,笔试11月29日", + "source": "ai", + "duration": 2.4, + "cover": "cover_51.jpg", + "final": "final_51.jpg", + "preview": "preview_51.mp4", + "identifier": "D0B6CF58-5285-4551-ADB3-A997E774A170", + "file": "LIVE_51_civil-servant" + }, + { + "id": "52", + "index": 3, + "zh": "遣散费(N+1)", + "en": "severance pay", + "ipa": "/ˈsevərəns peɪ/", + "pos": "n.", + "cat": "物", + "hook": "10月巴克莱宣布裁员约5,000人,Amazon、Salesforce等AI裁员潮持续", + "source": "ai", + "duration": 2.4, + "cover": "cover_52.jpg", + "final": "final_52.jpg", + "preview": "preview_52.mp4", + "identifier": "BD133399-7EBB-4341-93DE-0D1EC29B9C1D", + "file": "LIVE_52_severance-pay" + }, + { + "id": "53", + "index": 4, + "zh": "关税", + "en": "tariff", + "ipa": "/ˈtærɪf/", + "pos": "n.", + "cat": "事", + "hook": "10月23日特朗普签令调整对加拿大产品的关税,部分农林产品50%关税取消", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_53.jpg", + "final": "final_53.jpg", + "preview": "preview_53.mp4", + "identifier": "1481A70E-41B9-405A-B529-53532C8568E1", + "file": "LIVE_53_tariff" + }, + { + "id": "54", + "index": 5, + "zh": "中期选举", + "en": "midterm elections", + "ipa": "/ˈmɪdtɜːrm ɪˈlekʃnz/", + "pos": "n.", + "cat": "事", + "hook": "11月3日美国中期选举(众议院全部+参议院1/3改选);校园里 midterm 还是期中考", + "source": "wikimedia", + "duration": 2.7, + "cover": "cover_54.jpg", + "final": "final_54.jpg", + "preview": "preview_54.mp4", + "identifier": "8CC4B3AC-4EC0-45B6-8E6F-BBA9E7E66EC4", + "file": "LIVE_54_midterm-elections" + }, + { + "id": "55", + "index": 6, + "zh": "(诺奖)得主", + "en": "laureate", + "ipa": "/ˈlɔːriət/", + "pos": "n.", + "cat": "人", + "hook": "10月5–12日诺贝尔奖揭晓:和平奖授予Navi Pillay,医学奖授予光遗传学三位科学家", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_55.jpg", + "final": "final_55.jpg", + "preview": "preview_55.mp4", + "identifier": "6C351C34-8B12-4E74-B9B0-8D165C968D46", + "file": "LIVE_55_laureate" + }, + { + "id": "56", + "index": 7, + "zh": "停火", + "en": "ceasefire", + "ipa": "/ˈsiːsfaɪər/", + "pos": "n.", + "cat": "事", + "hook": "10月23日俄乌同意在Oleshky实施局部停火(10月27日生效)并定于下月和谈", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_56.jpg", + "final": "final_56.jpg", + "preview": "preview_56.mp4", + "identifier": "03380A0C-D4B0-4B85-ACF7-9730C9CD01F4", + "file": "LIVE_56_ceasefire" + }, + { + "id": "57", + "index": 8, + "zh": "流感疫苗", + "en": "flu shot", + "ipa": "/ˈfluː ʃɑːt/", + "pos": "n.", + "cat": "物", + "hook": "流感季开始:美国高校9–10月开设校园流感疫苗诊所,两岸疾控均提示流感处于流行期", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_57.jpg", + "final": "final_57.jpg", + "preview": "preview_57.mp4", + "identifier": "9D7ED32C-3E8C-4460-A283-35583AC4C805", + "file": "LIVE_57_flu-shot" + }, + { + "id": "58", + "index": 9, + "zh": "疫情暴发", + "en": "outbreak", + "ipa": "/ˈaʊtbreɪk/", + "pos": "n.", + "cat": "事", + "hook": "10月20日尼日利亚确认埃博拉(本迪布焦型)输入病例,非洲疾控召开紧急会议;中国疾控10月风险评估提示登革热等", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_58.jpg", + "final": "final_58.jpg", + "preview": "preview_58.mp4", + "identifier": "2D30495A-F330-4B3A-8CCE-80D9F98D958F", + "file": "LIVE_58_outbreak" + } + ], + "copy": { + "title": "入境被关小黑屋、国考报名、AI 裁员、中期选举……这 9 个新闻词你会用英语说吗?", + "body": "这两周的新闻你肯定刷到过:留学生入境美国被盘查遣返、2027 国考报名收官、Barclays/Amazon 的 AI 裁员潮、特朗普调关税、11 月 3 日美国中期选举、诺贝尔奖揭晓、俄乌局部停火、流感季开打疫苗、尼日利亚出现埃博拉病例……新闻标题天天见,可换成英文,这些词你能马上说出来吗👀\n先看封面猜一猜,再长按实况看答案(记得开声音🔊)\n评论区报一下你答对了几个~\n\n小黑屋(二次检查) / 公务员 / 遣散费(N+1) / 关税 / 中期选举 / (诺奖)得主 / 停火 / 流感疫苗 / 疫情暴发\n\n图片来源:7 张为 Wikimedia Commons 授权照片(作者与授权见素材包内说明),2 张为 AI 生成\n\n#雅思 #托福 #留学 #留学生 #职场英语 #新闻英语 #英语单词 #实况图 #每日英语 #英语学习 #热点" + }, + "credits": [ + { + "id": "50", + "zh": "小黑屋(二次检查)", + "en": "secondary inspection", + "author": "U.S. Customs and Border Protection", + "license": "Public domain", + "licenseUrl": "", + "page": "https://commons.wikimedia.org/wiki/File:161129-Dulles-OFO-Ops-GF-369_(30534092503).jpg", + "file": "161129-Dulles-OFO-Ops-GF-369 (30534092503).jpg" + }, + { + "id": "53", + "zh": "关税", + "en": "tariff", + "author": "Steven Lek", + "license": "CC BY-SA 4.0", + "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0", + "page": "https://commons.wikimedia.org/wiki/File:Containers_Rotterdam.JPG", + "file": "Containers Rotterdam.JPG" + }, + { + "id": "54", + "zh": "中期选举", + "en": "midterm elections", + "author": "Ktkvtsh", + "license": "CC BY 4.0", + "licenseUrl": "https://creativecommons.org/licenses/by/4.0", + "page": "https://commons.wikimedia.org/wiki/File:Louisiana_%E2%80%9CI_Voted%E2%80%9D_sticker.jpg", + "file": "Louisiana “I Voted” sticker.jpg" + }, + { + "id": "55", + "zh": "(诺奖)得主", + "en": "laureate", + "author": "Osama Shukir Muhammed Amin FRCP(Glasg)", + "license": "CC BY-SA 4.0", + "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0", + "page": "https://commons.wikimedia.org/wiki/File:Nobel_prize_medal_for_medicine,_Sweden,_1945,_to_Sir_Alexander_Fleming_(1881-1955)_who_discovered_Penicillin._On_display_at_the_National_Museum_of_Scotland.jpg", + "file": "Nobel prize medal for medicine, Sweden, 1945, to Sir Alexander Fleming (1881-1955) who discovered Penicillin. On display at the National Museum of Scotland.jpg" + }, + { + "id": "56", + "zh": "停火", + "en": "ceasefire", + "author": "Dietmar Rabich", + "license": "CC BY-SA 4.0", + "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0", + "page": "https://commons.wikimedia.org/wiki/File:D%C3%BClmen,_Hausd%C3%BClmen,_Friedenstaube_an_einem_Wohnhaus_--_2022_--_1450_(bw).jpg", + "file": "Dülmen, Hausdülmen, Friedenstaube an einem Wohnhaus -- 2022 -- 1450 (bw).jpg" + }, + { + "id": "57", + "zh": "流感疫苗", + "en": "flu shot", + "author": "Staff Sgt. Samara Taylor", + "license": "Public domain", + "licenseUrl": "", + "page": "https://commons.wikimedia.org/wiki/File:Immunization_season_150508-Z-YW189-002.jpg", + "file": "Immunization season 150508-Z-YW189-002.jpg" + }, + { + "id": "58", + "zh": "疫情暴发", + "en": "outbreak", + "author": "CDC Global", + "license": "CC BY 2.0", + "licenseUrl": "https://creativecommons.org/licenses/by/2.0", + "page": "https://commons.wikimedia.org/wiki/File:CDC_Director_exiting_Ebola_treatment_unit.jpg", + "file": "CDC Director exiting Ebola treatment unit.jpg" + } + ] +} \ No newline at end of file diff --git a/pack7.json b/pack7.json new file mode 100644 index 0000000000000000000000000000000000000000..7e63565547869ca95938f1a9ad09356352930d22 --- /dev/null +++ b/pack7.json @@ -0,0 +1,207 @@ +{ + "key": "g", + "name": "第七组 · 本周国内社会热点里的 9 个词", + "zip": "china-hot-topics-live-photos.zip", + "zipMB": 39.6, + "items": [ + { + "id": "60", + "index": 1, + "zh": "余震", + "en": "aftershock", + "ipa": "/ˈæftərʃɑːk/", + "pos": "n.", + "cat": "事", + "hook": "10月22日西藏那曲巴青县7.0级地震,已致16人遇难、1600余名搜救人员驰援,余震不断", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_60.jpg", + "final": "final_60.jpg", + "preview": "preview_60.mp4", + "identifier": "B62F2688-9B6B-408B-9687-DB0B879231E0", + "file": "LIVE_60_aftershock" + }, + { + "id": "61", + "index": 2, + "zh": "秋裤", + "en": "long johns", + "ipa": "/ˈlɔːŋ dʒɑːnz/", + "pos": "n.", + "cat": "物", + "hook": "10月21–25日冷空气连番南下,中国天气网「全国秋裤预警地图」显示超15省份需穿秋裤,北方降幅达10℃", + "source": "ai", + "duration": 2.4, + "cover": "cover_61.jpg", + "final": "final_61.jpg", + "preview": "preview_61.mp4", + "identifier": "8D152DD3-6F1A-4E6C-8152-3710ABE0F271", + "file": "LIVE_61_long-johns" + }, + { + "id": "62", + "index": 3, + "zh": "读研 / 考研", + "en": "grad school", + "ipa": "/ˈɡræd skuːl/", + "pos": "n.", + "cat": "事", + "hook": "2027年全国硕士研究生招生考试10月15–24日网上报名收官,机构预测报名约320万–335万人", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_62.jpg", + "final": "final_62.jpg", + "preview": "preview_62.mp4", + "identifier": "240A862A-C322-4012-8395-F96E31A889D8", + "file": "LIVE_62_grad-school" + }, + { + "id": "63", + "index": 4, + "zh": "导师", + "en": "supervisor", + "ipa": "/ˈsuːpərvaɪzər/", + "pos": "n.", + "cat": "人", + "hook": "考研报名季,选导师、联系导师成为热门话题", + "source": "ai", + "duration": 3.0, + "cover": "cover_63.jpg", + "final": "final_63.jpg", + "preview": "preview_63.mp4", + "identifier": "D0CC7A73-3096-4061-8659-DA686880B408", + "file": "LIVE_63_supervisor" + }, + { + "id": "64", + "index": 5, + "zh": "以旧换新(国补)", + "en": "trade-in", + "ipa": "/ˈtreɪd ɪn/", + "pos": "n.", + "cat": "事", + "hook": "2026年中央安排2500亿元支持消费品以旧换新;双11期间「国补+满减+红包」叠加成最热省钱攻略", + "source": "ai", + "duration": 3.0, + "cover": "cover_64.jpg", + "final": "final_64.jpg", + "preview": "preview_64.mp4", + "identifier": "3957D8F1-1155-4140-9045-5EF1608707D6", + "file": "LIVE_64_trade-in" + }, + { + "id": "65", + "index": 6, + "zh": "尾款", + "en": "final payment", + "ipa": "/ˈfaɪnl ˈpeɪmənt/", + "pos": "n.", + "cat": "物", + "hook": "双11预售:天猫10月15日开启预售、10月20日晚8点集中付尾款,京东10月12日先开抢", + "source": "ai", + "duration": 3.0, + "cover": "cover_65.jpg", + "final": "final_65.jpg", + "preview": "preview_65.mp4", + "identifier": "4C703D86-A239-4CB7-9EAE-CBC362D99784", + "file": "LIVE_65_final-payment" + }, + { + "id": "66", + "index": 7, + "zh": "结婚登记", + "en": "marriage registration", + "ipa": "/ˈmærɪdʒ ˌredʒɪˈstreɪʃn/", + "pos": "n.", + "cat": "事", + "hook": "10月24日《中国统计年鉴2026》:2025年全国初婚人数1042万、重回千万,结婚登记676.5万对、增长10.8%", + "source": "ai", + "duration": 3.0, + "cover": "cover_66.jpg", + "final": "final_66.jpg", + "preview": "preview_66.mp4", + "identifier": "1D33CABB-EDFB-4D4D-9FEE-AED5BFB066FE", + "file": "LIVE_66_marriage-registration" + }, + { + "id": "67", + "index": 8, + "zh": "生育率", + "en": "fertility rate", + "ipa": "/fərˈtɪləti reɪt/", + "pos": "n.", + "cat": "事", + "hook": "10月24–25日热搜:2025年末全国总人口14.05亿、全年净减339万,连续四年负增长,出生792万人", + "source": "wikimedia", + "duration": 3.0, + "cover": "cover_67.jpg", + "final": "final_67.jpg", + "preview": "preview_67.mp4", + "identifier": "83789D12-C8D2-44B0-91D4-2347DBCE82CD", + "file": "LIVE_67_fertility-rate" + }, + { + "id": "68", + "index": 9, + "zh": "续航焦虑", + "en": "range anxiety", + "ipa": "/ˈreɪndʒ æŋˌzaɪəti/", + "pos": "n.", + "cat": "事", + "hook": "10月20日微博热搜第一「油车电车10年成本账怎么算」,新能源车续航与充电再成焦点", + "source": "wikimedia", + "duration": 2.7, + "cover": "cover_68.jpg", + "final": "final_68.jpg", + "preview": "preview_68.mp4", + "identifier": "B8F8C7B3-57C2-4E52-BF88-CB58B901D56F", + "file": "LIVE_68_range-anxiety" + } + ], + "copy": { + "title": "那曲地震、秋裤预警、考研报名、双11尾款、人口负增长……这 9 个国内热点词你会用英语说吗?", + "body": "这一周国内的热搜你肯定刷到过:西藏那曲 7.0 级地震、全国秋裤预警地图、2027 考研报名收官、双 11 付尾款 + 国补以旧换新、初婚人数重回千万、总人口面临跌破 14 亿、油车电车十年成本账……中文天天说,可换成英文,这些词你能马上说出来吗👀\n先看封面猜一猜,再长按实况看答案(记得开声音🔊)\n评论区报一下你答对了几个~\n\n余震 / 秋裤 / 读研 / 考研 / 导师 / 以旧换新(国补) / 尾款 / 结婚登记 / 生育率 / 续航焦虑\n\n图片来源:4 张为 Wikimedia Commons 授权照片(作者与授权见素材包内说明),5 张为 AI 生成\n\n#雅思 #托福 #留学 #留学生 #职场英语 #新闻英语 #英语单词 #实况图 #每日英语 #英语学习 #热搜" + }, + "credits": [ + { + "id": "60", + "zh": "余震", + "en": "aftershock", + "author": "U.S. Geological Survey", + "license": "CC0", + "licenseUrl": "http://creativecommons.org/publicdomain/zero/1.0/deed.en", + "page": "https://commons.wikimedia.org/wiki/File:Building_Safer_Structures_-_Damage_to_a_village_house_in_Sichuan,_China_after_the_Mw6.6_Lushan_China_Earthquake_on_April_20_2013.jpg", + "file": "Building Safer Structures - Damage to a village house in Sichuan, China after the Mw6.6 Lushan China Earthquake on April 20 2013.jpg" + }, + { + "id": "62", + "zh": "读研 / 考研", + "en": "grad school", + "author": "Gary Todd", + "license": "CC0", + "licenseUrl": "http://creativecommons.org/publicdomain/zero/1.0/deed.en", + "page": "https://commons.wikimedia.org/wiki/File:Sias_Library_-_Students_Studying_2017.jpg", + "file": "Sias Library - Students Studying 2017.jpg" + }, + { + "id": "67", + "zh": "生育率", + "en": "fertility rate", + "author": "Shixart1985", + "license": "CC BY 2.0", + "licenseUrl": "https://creativecommons.org/licenses/by/2.0", + "page": "https://commons.wikimedia.org/wiki/File:Baby_enjoying_a_stroll_in_a_stroller_with_a_cozy_pink_blanket.jpg", + "file": "Baby enjoying a stroll in a stroller with a cozy pink blanket.jpg" + }, + { + "id": "68", + "zh": "续航焦虑", + "en": "range anxiety", + "author": "Jengtingchen", + "license": "CC BY-SA 4.0", + "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0", + "page": "https://commons.wikimedia.org/wiki/File:Roewe_ERX5_EV_charging.jpg", + "file": "Roewe ERX5 EV charging.jpg" + } + ] +} \ No newline at end of file diff --git a/source/photos/43_pick.jpg b/source/photos/43_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e219a19992091bdf467cbf83d939303d56dda306 --- /dev/null +++ b/source/photos/43_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee5adf7dbc942e50ac2cba2fa13de81585382675948dabb40a462844562ae731 +size 612854 diff --git a/source/photos/44_pick.jpg b/source/photos/44_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a958726d4bdd26075e04f2c723a5dec7ec1b0453 --- /dev/null +++ b/source/photos/44_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd4067020862b1bc297f5437f66a0098f0ff033b741f5246c85d0602587b7943 +size 1014797 diff --git a/source/photos/45_pick.jpg b/source/photos/45_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..43effa436e4361116c82c8acb501e023ede4c0e2 --- /dev/null +++ b/source/photos/45_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2b798f3c7587652bc7131dfbdd91d7e790189ca876695d8d607025b318a4dd7 +size 575497 diff --git a/source/photos/48_pick.jpg b/source/photos/48_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3affc0f7069de656cda2b93f1e2cbf5f8fe4afb6 --- /dev/null +++ b/source/photos/48_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aeb32a6bb093ed24605c102fb07ae4187ea8042e3782fa4029b1f2925cd009b6 +size 994511 diff --git a/source/photos/50_pick.jpg b/source/photos/50_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..56d0905ee830ac3279ae935af940d844f7f5dad5 --- /dev/null +++ b/source/photos/50_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc98cb7234b70508aba2d0f079a296fcf18e1ba4e890ad3f7cc1c777289a37dd +size 638850 diff --git a/source/photos/53_pick.jpg b/source/photos/53_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f8e29109f30824af6fb9d1bd0a3784d7338f8c4b --- /dev/null +++ b/source/photos/53_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6dc60f915c3e468582733e2a5b6f47130a977fe671a6d95fc004f3cacbb96879 +size 1000937 diff --git a/source/photos/54_pick.jpg b/source/photos/54_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b50d67473f3e384249daa9aeb55c573c3fbc5d65 --- /dev/null +++ b/source/photos/54_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ba82d11780fe303f1d61b84d5d6ddede4f8f6e1ed4e44073335ddcee24b479f +size 859404 diff --git a/source/photos/55_pick.jpg b/source/photos/55_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f57c2908a95581d3ffa08b159bad2ffa63216257 --- /dev/null +++ b/source/photos/55_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8bbb64a40c34c45780474f4893c5f19d8a932b23652038b017944ac3cbf8b639 +size 1398508 diff --git a/source/photos/56_pick.jpg b/source/photos/56_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1a7b6e4f90170990fc0fb6a2edc24f7f086a13de --- /dev/null +++ b/source/photos/56_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ae87fa5ac6966a6630aaad8412031726bc4a81402bdd70a3f7524606bc8cc80d +size 785428 diff --git a/source/photos/57_pick.jpg b/source/photos/57_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fbe3d14805f85507cb0747502acd6048a9d1c763 --- /dev/null +++ b/source/photos/57_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a1d96fe703bb347da4e715b1a74737dc6685c85ce9ee5285b0d81103ee0e69f +size 759370 diff --git a/source/photos/58_pick.jpg b/source/photos/58_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d45a3273cd6b7f2ac2ea307e1df79a2dca6ef834 --- /dev/null +++ b/source/photos/58_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d11b18d90580d7c0381e8c7abc9798c7e9902a53d5cec677ffb3cf272609c2b +size 559602 diff --git a/source/photos/60_pick.jpg b/source/photos/60_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..142ca99d13cd8e0c7726c39eecb7f668a9f35eae --- /dev/null +++ b/source/photos/60_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:745dcd55b178382f0c4d02a9021d78f87833695f0ac7b1226c8badcec5c8e06f +size 965161 diff --git a/source/photos/62_pick.jpg b/source/photos/62_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..756ccc208f5167f4990ff87582d279d7ef0ab717 --- /dev/null +++ b/source/photos/62_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4bb381277acce3721ec4fb649b06637a31b798a5973424414980f8e5cf1f0a76 +size 839241 diff --git a/source/photos/67_pick.jpg b/source/photos/67_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..332b31da29bef6201b38e99136de2959af40fada --- /dev/null +++ b/source/photos/67_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c65392d2a7bf23f8cc06e9bb216e96eecfee025288f73ea3139168dcb0ad1bb +size 362748 diff --git a/source/photos/68_pick.jpg b/source/photos/68_pick.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d3a02f61e0fbc386b42e3d21cb2a94079b154ce4 --- /dev/null +++ b/source/photos/68_pick.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f21d800dc3ae00529633ce140cde7d061d5a7b78ea28f488c480ebe9fb29446 +size 794480 diff --git a/source/photos/live-civil-servant.png b/source/photos/live-civil-servant.png new file mode 100644 index 0000000000000000000000000000000000000000..e063504ce166b8f0e09e28eae19fde35bee2401d --- /dev/null +++ b/source/photos/live-civil-servant.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e7fad3d01c3b8750f9de5e70dd02b6c2d71eccbaac7009b1ae4a3d65f71d5d1 +size 2010162 diff --git a/source/photos/live-final-payment.png b/source/photos/live-final-payment.png new file mode 100644 index 0000000000000000000000000000000000000000..6a1801df9eb179a95e85011a6a94cbd43d237a08 --- /dev/null +++ b/source/photos/live-final-payment.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:72ce986b37b15df4d5d4bcb7aba388038445c511b744c7347bfaede318dc8e51 +size 1976732 diff --git a/source/photos/live-invigilator.png b/source/photos/live-invigilator.png new file mode 100644 index 0000000000000000000000000000000000000000..59f2a650b683a897a9ecd24dcde3fb04cda6bf46 --- /dev/null +++ b/source/photos/live-invigilator.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c062fd5366729a6dd84e5e2fd8df052f0c6de73ec40f5020ba4b66b8ef3f7e9e +size 2013961 diff --git a/source/photos/live-long-johns.png b/source/photos/live-long-johns.png new file mode 100644 index 0000000000000000000000000000000000000000..f02b9c9105cba5f23532bbb2bbdfbe53e1f2de51 --- /dev/null +++ b/source/photos/live-long-johns.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53545867670f478a4b9c70efa60f841a9cbafdf3a92f259b05e9d5957f8e000e +size 2468463 diff --git a/source/photos/live-marriage-registration.png b/source/photos/live-marriage-registration.png new file mode 100644 index 0000000000000000000000000000000000000000..b2dfd3283e4914dc45566e2ab279f9c58fcc6a51 --- /dev/null +++ b/source/photos/live-marriage-registration.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5c69be95f4805db15a2209259d8ce5f657172c896791b1d8b07d005db3f1963b +size 2084012 diff --git a/source/photos/live-payslip.png b/source/photos/live-payslip.png new file mode 100644 index 0000000000000000000000000000000000000000..79733e079e996c3fdb9a8eb8193848f1b53a82ec --- /dev/null +++ b/source/photos/live-payslip.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1a1deae9362d277d435acb014b221784b98f500a538835f6049216a1505dbaa +size 1798872 diff --git a/source/photos/live-probation-period.png b/source/photos/live-probation-period.png new file mode 100644 index 0000000000000000000000000000000000000000..147376ff481d223e118f87b4d4bfe0556126999a --- /dev/null +++ b/source/photos/live-probation-period.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81db30d6f50724ea500b4163d7a8d6e01a9cd29b832c452dd321a05b20421088 +size 2061819 diff --git a/source/photos/live-security-deposit.png b/source/photos/live-security-deposit.png new file mode 100644 index 0000000000000000000000000000000000000000..11156633431d159d8dec97a6f2d5d83663fc9afb --- /dev/null +++ b/source/photos/live-security-deposit.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b99c28637d43aee45234841653ab7644bf35a4d4e7d408803430f29a9bec44eb +size 1972080 diff --git a/source/photos/live-severance-pay.png b/source/photos/live-severance-pay.png new file mode 100644 index 0000000000000000000000000000000000000000..2a4d7640e28ca1a5c7aa13a7689b6219ad4bd0d9 --- /dev/null +++ b/source/photos/live-severance-pay.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c6898cfe0a12c7e9905dd2641c76d70d82ad69141a31c1ad5cab5ba2145620f +size 2120095 diff --git a/source/photos/live-supervisor.png b/source/photos/live-supervisor.png new file mode 100644 index 0000000000000000000000000000000000000000..6583f553d24da866c4369613ed05c8882491c8c7 --- /dev/null +++ b/source/photos/live-supervisor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb91c78040834ef8554a17137a86d7b7d813a4ec8fd8c6c9dfa8072bfa73eddd +size 2069079 diff --git a/source/photos/live-trade-in.png b/source/photos/live-trade-in.png new file mode 100644 index 0000000000000000000000000000000000000000..a32e576b37e7d07446f5c1be2dc87bad41561a35 --- /dev/null +++ b/source/photos/live-trade-in.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75f2c122ff3dbda953afc80396b6e25052dbad5f7d945d73416e46982a2c0789 +size 1912712 diff --git a/source/photos/live-transcript.png b/source/photos/live-transcript.png new file mode 100644 index 0000000000000000000000000000000000000000..f36aa0a416d08b6c31a9ab5b2392873b625c49ef --- /dev/null +++ b/source/photos/live-transcript.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f31d03f045211c46874b8f6d79545033138c91a436dbc758dac4b0e6af9ae1c8 +size 2407799 diff --git a/source/studio/audio.py b/source/studio/audio.py new file mode 100644 index 0000000000000000000000000000000000000000..e1aa0d61659c58b3c23c9e7e6b0af4e984cdff11 --- /dev/null +++ b/source/studio/audio.py @@ -0,0 +1,143 @@ +"""Sound design + TTS helpers (48 kHz stereo float32).""" +import asyncio, os, subprocess, hashlib +import numpy as np + +SR = 48000 +CACHE = '/tmp/work/tts' +os.makedirs(CACHE, exist_ok=True) + + +def tts(text, voice, rate='+0%', pitch='+0Hz'): + """Return trimmed mono float32 voice clip.""" + import edge_tts + tag = hashlib.md5(f"{text}|{voice}|{rate}|{pitch}".encode()).hexdigest()[:12] + mp3 = f"{CACHE}/{tag}.mp3" + if not os.path.exists(mp3) or os.path.getsize(mp3) < 2000: + for _ in range(4): + try: + asyncio.run(edge_tts.Communicate(text, voice, rate=rate, pitch=pitch).save(mp3)) + if os.path.getsize(mp3) > 2000: + break + except Exception as e: # network hiccup + print('tts retry', e) + raw = subprocess.run(['ffmpeg', '-v', 'error', '-i', mp3, '-f', 'f32le', '-ac', '1', '-ar', str(SR), '-'], + check=True, capture_output=True).stdout + x = np.frombuffer(raw, dtype=np.float32).astype(np.float64) + env = np.convolve(np.abs(x), np.ones(480) / 480, mode='same') + idx = np.where(env > 0.012)[0] + if len(idx): + a = max(0, idx[0] - 720) + b = min(len(x), idx[-1] + 2400) + x = x[a:b] + f = min(480, len(x) // 4) + x[:f] *= np.linspace(0, 1, f) + x[-f:] *= np.linspace(1, 0, f) + return x / (np.abs(x).max() + 1e-6) * 0.92 + + +def _t(d): + return np.arange(int(SR * d)) / SR + + +def _onepole_lp(x, fc): + """Time-varying one-pole low-pass (vectorised in blocks).""" + out = np.empty_like(x) + y = 0.0 + blk = 64 + for s in range(0, len(x), blk): + a = np.exp(-2 * np.pi * fc[s] / SR) + seg = x[s:s + blk] + for i, v in enumerate(seg): + y = (1 - a) * v + a * y + out[s + i] = y + return out + + +def whoosh(d=0.45): + t = _t(d) + rng = np.random.default_rng(3) + n = rng.standard_normal(len(t)) + fc_hi = 500 + 6500 * (t / d) ** 1.4 + fc_lo = 150 + 1800 * (t / d) ** 1.4 + band = _onepole_lp(n, fc_hi) - _onepole_lp(n, fc_lo) + env = np.sin(np.pi * np.clip(t / d, 0, 1) ** 0.7) ** 2 + out = band * env + return out / (np.abs(out).max() + 1e-6) * 0.42 + + +def tick(i): + """Plucky marimba-ish tick; pitch climbs a pentatonic scale across the word.""" + scale = [0, 2, 4, 7, 9, 12, 14, 16, 19, 21, 24, 26, 28, 31, 33, 36] + f = 587.33 * 2 ** (scale[min(i, len(scale) - 1)] / 12) + t = _t(0.18) + s = np.sin(2 * np.pi * f * t) * 0.8 + np.sin(2 * np.pi * f * 4 * t) * 0.15 * np.exp(-t * 70) + s *= np.exp(-t * 26) * (1 - np.exp(-t * 2000)) + return s * 0.30 + + +def chime(): + out = np.zeros(int(SR * 1.4)) + for k, (f, dt) in enumerate([(1046.5, 0.0), (1318.5, 0.055), (1568.0, 0.11), (2093.0, 0.165)]): + t = _t(1.4 - dt) + tone = np.sin(2 * np.pi * f * t) + 0.35 * np.sin(2 * np.pi * f * 2.76 * t) * np.exp(-t * 9) \ + + 0.15 * np.sin(2 * np.pi * f * 5.4 * t) * np.exp(-t * 16) + tone *= np.exp(-t * 4.0) * (1 - np.exp(-t * 900)) + s = int(SR * dt) + out[s:s + len(tone)] += tone * (0.9 - k * 0.12) + return out / np.abs(out).max() * 0.26 + + +def pop(): + t = _t(0.12) + f = 1100 * np.exp(-t * 22) + 260 + ph = 2 * np.pi * np.cumsum(f) / SR + return np.sin(ph) * np.exp(-t * 32) * (1 - np.exp(-t * 3000)) * 0.32 + + +def shimmer(d=1.0): + rng = np.random.default_rng(11) + out = np.zeros(int(SR * d)) + for _ in range(30): + st = rng.uniform(0, d * 0.55) + f = rng.uniform(2800, 6800) + t = _t(0.2) + g = np.sin(2 * np.pi * f * t) * np.exp(-t * 28) * rng.uniform(0.2, 0.5) + s = int(st * SR) + n = min(len(g), len(out) - s) + out[s:s + n] += g[:n] + return out * np.exp(-_t(d) * 2.4) * 0.16 + + +class Mixer: + def __init__(self, dur): + self.buf = np.zeros((int(SR * (dur + 2)), 2), dtype=np.float64) + + def add(self, clip, at, gain=1.0, pan=0.0): + s = int(round(at * SR)) + n = min(len(clip), len(self.buf) - s) + if n <= 0: + return + l = np.cos((pan + 1) * np.pi / 4) * np.sqrt(2) + r = np.sin((pan + 1) * np.pi / 4) * np.sqrt(2) + self.buf[s:s + n, 0] += clip[:n] * gain * l + self.buf[s:s + n, 1] += clip[:n] * gain * r + + def render(self, dur, path): + b = self.buf[:int(round(SR * dur))].copy() + b = np.tanh(b * 1.1) / np.tanh(1.1) + fade = int(SR * 0.06) + b[-fade:] *= np.linspace(1, 0, fade)[:, None] + b[:240] *= np.linspace(0, 1, 240)[:, None] + raw = path + '.f32' + b.astype(']+>', '', h or '').strip() +def commons(q): + p = urllib.parse.urlencode({'action':'query','format':'json','generator':'search','gsrsearch':f'{q} filetype:bitmap','gsrnamespace':6,'gsrlimit':30,'prop':'imageinfo','iiprop':'url|size|extmetadata|mime','iiurlwidth':400}) + d = json.loads(get('https://commons.wikimedia.org/w/api.php?'+p)) + out=[] + for pg in d.get('query',{}).get('pages',{}).values(): + ii=(pg.get('imageinfo') or [{}])[0] + if ii.get('mime') not in ('image/jpeg','image/png'): continue + md=ii.get('extmetadata',{}) + out.append(dict(id=pg['pageid'], title=pg['title'].replace('File:',''), author=strip(md.get('Artist',{}).get('value'))[:80], license=strip(md.get('LicenseShortName',{}).get('value')), license_url=md.get('LicenseUrl',{}).get('value'), page=ii.get('descriptionurl'), url=ii.get('url'), thumb=ii.get('thumburl'), w=ii.get('width'), h=ii.get('height'))) + return out +def ok(l): + l=(l or '').lower() + return any(k in l for k in ('cc0','public domain','cc by','cc-by','pdm')) and '-nc' not in l and ' nc' not in l and '-nd' not in l and ' nd' not in l +want = sys.argv[1].split(',') if len(sys.argv)>1 else None +for it in ITEMS: + if want and it['id'] not in want: continue + cands, seen = [], set() + for q in it['q']: + try: res = commons(q) + except Exception as e: print('err', q, e); continue + for c in res: + if c['id'] in seen or not ok(c['license']) or not c['w'] or min(c['w'],c['h'])<900: continue + seen.add(c['id']); c['q']=q; cands.append(c) + cands = cands[:24] + def fetch(c): + try: return Image.open(io.BytesIO(get(c['thumb'],40))).convert('RGB') + except Exception: return None + with ThreadPoolExecutor(8) as ex: imgs=list(ex.map(fetch,cands)) + cols=6; cw,chh=300,300 + rows=(len(cands)+cols-1)//cols or 1 + sheet=Image.new('RGB',(cols*cw,rows*(chh+30)),'white'); d=ImageDraw.Draw(sheet) + f=ImageFont.truetype('/tmp/work/fonts/NotoSans.ttf',16) + meta=[] + for k,(c,im) in enumerate(zip(cands,imgs)): + if im is None: continue + im.thumbnail((cw-6,chh-6)); x=(k%cols)*cw; y=(k//cols)*(chh+30) + sheet.paste(im,(x+3,y+3)); d.text((x+4,y+chh+2),f"#{k} {c['w']}x{c['h']} {c['license'][:12]}",font=f,fill='black') + meta.append(dict(k=k,**c)) + sheet.save(f"{OUT}/{it['id']}_sheet.jpg",quality=80) + json.dump(meta,open(f"{OUT}/{it['id']}_cands.json",'w'),ensure_ascii=False,indent=1) + print(it['id'],it['en'],len(meta),'cands') diff --git a/source/studio/find6.py b/source/studio/find6.py new file mode 100644 index 0000000000000000000000000000000000000000..808ac880ffe382de33404f196cf28d65376bd735 --- /dev/null +++ b/source/studio/find6.py @@ -0,0 +1,51 @@ +"""Search Wikimedia Commons for CC-licensed photos per item, download thumbs, build contact sheets.""" +import io, json, os, re, sys, urllib.parse, urllib.request +from concurrent.futures import ThreadPoolExecutor +from PIL import Image, ImageDraw, ImageFont +ITEMS = json.load(open('/tmp/work/studio/items6.json')) +OUT = '/tmp/work/cands' +UA = {'User-Agent': 'LiveWordsStudio/1.0 (https://huggingface.co/spaces/Ethscriptions/pols; educational)'} +def get(url, timeout=60): + return urllib.request.urlopen(urllib.request.Request(url, headers=UA), timeout=timeout).read() +def strip(h): return re.sub(r'<[^>]+>', '', h or '').strip() +def commons(q): + p = urllib.parse.urlencode({'action':'query','format':'json','generator':'search','gsrsearch':f'{q} filetype:bitmap','gsrnamespace':6,'gsrlimit':30,'prop':'imageinfo','iiprop':'url|size|extmetadata|mime','iiurlwidth':400}) + d = json.loads(get('https://commons.wikimedia.org/w/api.php?'+p)) + out=[] + for pg in d.get('query',{}).get('pages',{}).values(): + ii=(pg.get('imageinfo') or [{}])[0] + if ii.get('mime') not in ('image/jpeg','image/png'): continue + md=ii.get('extmetadata',{}) + out.append(dict(id=pg['pageid'], title=pg['title'].replace('File:',''), author=strip(md.get('Artist',{}).get('value'))[:80], license=strip(md.get('LicenseShortName',{}).get('value')), license_url=md.get('LicenseUrl',{}).get('value'), page=ii.get('descriptionurl'), url=ii.get('url'), thumb=ii.get('thumburl'), w=ii.get('width'), h=ii.get('height'))) + return out +def ok(l): + l=(l or '').lower() + return any(k in l for k in ('cc0','public domain','cc by','cc-by','pdm')) and '-nc' not in l and ' nc' not in l and '-nd' not in l and ' nd' not in l +want = sys.argv[1].split(',') if len(sys.argv)>1 else None +for it in ITEMS: + if want and it['id'] not in want: continue + cands, seen = [], set() + for q in it['q']: + try: res = commons(q) + except Exception as e: print('err', q, e); continue + for c in res: + if c['id'] in seen or not ok(c['license']) or not c['w'] or min(c['w'],c['h'])<900: continue + seen.add(c['id']); c['q']=q; cands.append(c) + cands = cands[:24] + def fetch(c): + try: return Image.open(io.BytesIO(get(c['thumb'],40))).convert('RGB') + except Exception: return None + with ThreadPoolExecutor(8) as ex: imgs=list(ex.map(fetch,cands)) + cols=6; cw,chh=300,300 + rows=(len(cands)+cols-1)//cols or 1 + sheet=Image.new('RGB',(cols*cw,rows*(chh+30)),'white'); d=ImageDraw.Draw(sheet) + f=ImageFont.truetype('/tmp/work/fonts/NotoSans.ttf',16) + meta=[] + for k,(c,im) in enumerate(zip(cands,imgs)): + if im is None: continue + im.thumbnail((cw-6,chh-6)); x=(k%cols)*cw; y=(k//cols)*(chh+30) + sheet.paste(im,(x+3,y+3)); d.text((x+4,y+chh+2),f"#{k} {c['w']}x{c['h']} {c['license'][:12]}",font=f,fill='black') + meta.append(dict(k=k,**c)) + sheet.save(f"{OUT}/{it['id']}_sheet.jpg",quality=80) + json.dump(meta,open(f"{OUT}/{it['id']}_cands.json",'w'),ensure_ascii=False,indent=1) + print(it['id'],it['en'],len(meta),'cands') diff --git a/source/studio/find7.py b/source/studio/find7.py new file mode 100644 index 0000000000000000000000000000000000000000..3e410a45fc11d4c80eaa6f923e0a7cac57cf8fa3 --- /dev/null +++ b/source/studio/find7.py @@ -0,0 +1,51 @@ +"""Search Wikimedia Commons for CC-licensed photos per item, download thumbs, build contact sheets.""" +import io, json, os, re, sys, urllib.parse, urllib.request +from concurrent.futures import ThreadPoolExecutor +from PIL import Image, ImageDraw, ImageFont +ITEMS = json.load(open('/tmp/work/studio/items7.json')) +OUT = '/tmp/work/cands' +UA = {'User-Agent': 'LiveWordsStudio/1.0 (https://huggingface.co/spaces/Ethscriptions/pols; educational)'} +def get(url, timeout=60): + return urllib.request.urlopen(urllib.request.Request(url, headers=UA), timeout=timeout).read() +def strip(h): return re.sub(r'<[^>]+>', '', h or '').strip() +def commons(q): + p = urllib.parse.urlencode({'action':'query','format':'json','generator':'search','gsrsearch':f'{q} filetype:bitmap','gsrnamespace':6,'gsrlimit':30,'prop':'imageinfo','iiprop':'url|size|extmetadata|mime','iiurlwidth':400}) + d = json.loads(get('https://commons.wikimedia.org/w/api.php?'+p)) + out=[] + for pg in d.get('query',{}).get('pages',{}).values(): + ii=(pg.get('imageinfo') or [{}])[0] + if ii.get('mime') not in ('image/jpeg','image/png'): continue + md=ii.get('extmetadata',{}) + out.append(dict(id=pg['pageid'], title=pg['title'].replace('File:',''), author=strip(md.get('Artist',{}).get('value'))[:80], license=strip(md.get('LicenseShortName',{}).get('value')), license_url=md.get('LicenseUrl',{}).get('value'), page=ii.get('descriptionurl'), url=ii.get('url'), thumb=ii.get('thumburl'), w=ii.get('width'), h=ii.get('height'))) + return out +def ok(l): + l=(l or '').lower() + return any(k in l for k in ('cc0','public domain','cc by','cc-by','pdm')) and '-nc' not in l and ' nc' not in l and '-nd' not in l and ' nd' not in l +want = sys.argv[1].split(',') if len(sys.argv)>1 else None +for it in ITEMS: + if want and it['id'] not in want: continue + cands, seen = [], set() + for q in it['q']: + try: res = commons(q) + except Exception as e: print('err', q, e); continue + for c in res: + if c['id'] in seen or not ok(c['license']) or not c['w'] or min(c['w'],c['h'])<900: continue + seen.add(c['id']); c['q']=q; cands.append(c) + cands = cands[:24] + def fetch(c): + try: return Image.open(io.BytesIO(get(c['thumb'],40))).convert('RGB') + except Exception: return None + with ThreadPoolExecutor(8) as ex: imgs=list(ex.map(fetch,cands)) + cols=6; cw,chh=300,300 + rows=(len(cands)+cols-1)//cols or 1 + sheet=Image.new('RGB',(cols*cw,rows*(chh+30)),'white'); d=ImageDraw.Draw(sheet) + f=ImageFont.truetype('/tmp/work/fonts/NotoSans.ttf',16) + meta=[] + for k,(c,im) in enumerate(zip(cands,imgs)): + if im is None: continue + im.thumbnail((cw-6,chh-6)); x=(k%cols)*cw; y=(k//cols)*(chh+30) + sheet.paste(im,(x+3,y+3)); d.text((x+4,y+chh+2),f"#{k} {c['w']}x{c['h']} {c['license'][:12]}",font=f,fill='black') + meta.append(dict(k=k,**c)) + sheet.save(f"{OUT}/{it['id']}_sheet.jpg",quality=80) + json.dump(meta,open(f"{OUT}/{it['id']}_cands.json",'w'),ensure_ascii=False,indent=1) + print(it['id'],it['en'],len(meta),'cands') diff --git a/source/studio/items5.json b/source/studio/items5.json new file mode 100644 index 0000000000000000000000000000000000000000..955a6f240e20b914f613d31e9c40621eae265280 --- /dev/null +++ b/source/studio/items5.json @@ -0,0 +1,146 @@ +[ + { + "id": "41", + "zh": "监考老师", + "en": "invigilator", + "ipa": "/ɪnˈvɪdʒɪleɪtər/", + "pos": "n.", + "cat": "人", + "hook": "10月雅思机考系统故障、全国连停4天,改期重考成热词", + "q": [ + "examination hall invigilator", + "exam hall students desks", + "students taking exam classroom" + ], + "tts": "invigilator", + "card_y": 1120 + }, + { + "id": "42", + "zh": "成绩单", + "en": "transcript", + "ipa": "/ˈtrænskrɪpt/", + "pos": "n.", + "cat": "物", + "hook": "托福改用1–6新分制、申请季递交材料", + "q": [ + "academic transcript", + "university transcript document", + "grade report university" + ], + "tts": "transcript", + "card_y": 1130 + }, + { + "id": "43", + "zh": "录指纹", + "en": "biometrics", + "ipa": "/ˌbaɪoʊˈmetrɪks/", + "pos": "n.", + "cat": "事", + "hook": "美签F-1改4年固定期限、英国毕业生签证明年缩至18个月,签证预约扎堆", + "q": [ + "fingerprint scanner biometric", + "fingerprint scanning airport immigration", + "biometric fingerprint" + ], + "tts": "biometrics", + "card_y": 1130 + }, + { + "id": "44", + "zh": "转机", + "en": "layover", + "ipa": "/ˈleɪoʊvər/", + "pos": "n.", + "cat": "事", + "hook": "开学季与假期往返机票", + "q": [ + "airport departure board", + "airport terminal waiting passengers", + "airport gate waiting" + ], + "tts": "layover", + "card_y": 290 + }, + { + "id": "45", + "zh": "时差", + "en": "jet lag", + "ipa": "/ˈdʒet læɡ/", + "pos": "n.", + "cat": "事", + "hook": "长途飞行后倒时差", + "q": [ + "sleeping passenger airplane", + "tired traveler sleeping airport", + "passenger asleep airport bench" + ], + "tts": "jet lag", + "card_y": 330 + }, + { + "id": "46", + "zh": "押金", + "en": "security deposit", + "ipa": "/sɪˈkjʊrəti dɪˌpɑːzɪt/", + "pos": "n.", + "cat": "物", + "hook": "留学生租房季,澳洲、英国租房紧张", + "q": [ + "house keys lease contract", + "apartment keys handover", + "keys rental agreement" + ], + "tts": "security deposit", + "card_y": 1130 + }, + { + "id": "47", + "zh": "试用期", + "en": "probation period", + "ipa": "/proʊˈbeɪʃn ˌpɪriəd/", + "pos": "n.", + "cat": "事", + "hook": "秋招8–11月进入主批,应届生陆续入职", + "q": [ + "signing employment contract office", + "handshake office new employee", + "job interview office handshake" + ], + "tts": "probation period", + "card_y": 1130 + }, + { + "id": "48", + "zh": "工位", + "en": "cubicle", + "ipa": "/ˈkjuːbɪkl/", + "pos": "n.", + "cat": "物", + "hook": "职场新人日常", + "q": [ + "office cubicles", + "cubicle office workspace", + "open plan office desks" + ], + "tts": "cubicle", + "card_y": 380 + }, + { + "id": "49", + "zh": "工资条", + "en": "payslip", + "ipa": "/ˈpeɪslɪp/", + "pos": "n.", + "cat": "物", + "hook": "第一份工资到账", + "q": [ + "payslip", + "pay stub salary", + "salary slip document" + ], + "tts": "payslip", + "card_y": 1130 + } +] \ No newline at end of file diff --git a/source/studio/items6.json b/source/studio/items6.json new file mode 100644 index 0000000000000000000000000000000000000000..b4f1c802a5f6ea262466ba7e09f66ac8070940d0 --- /dev/null +++ b/source/studio/items6.json @@ -0,0 +1,146 @@ +[ + { + "id": "50", + "zh": "小黑屋(二次检查)", + "en": "secondary inspection", + "ipa": "/ˌsekənderi ɪnˈspekʃn/", + "pos": "n.", + "cat": "事", + "hook": "10月25日中方再称留学生入境美国时被长时间盘查、遣返,有人被限制人身自由10余小时", + "q": [ + "CBP officer airport passport control", + "U.S. Customs and Border Protection airport inspection", + "border control booth airport traveler" + ], + "tts": "secondary inspection", + "card_y": 1130 + }, + { + "id": "51", + "zh": "公务员", + "en": "civil servant", + "ipa": "/ˌsɪvl ˈsɜːrvənt/", + "pos": "n.", + "cat": "人", + "hook": "2027国考10月14–24日报名,计划招录3.57万人、连续两年缩招,笔试11月29日", + "q": [ + "civil service examination China candidates", + "公务员考试 考场", + "exam candidates crowd entering test center" + ], + "tts": "civil servant", + "card_y": 1130 + }, + { + "id": "52", + "zh": "遣散费(N+1)", + "en": "severance pay", + "ipa": "/ˈsevərəns peɪ/", + "pos": "n.", + "cat": "物", + "hook": "10月巴克莱宣布裁员约5,000人,Amazon、Salesforce等AI裁员潮持续", + "q": [ + "employee leaving office cardboard box belongings", + "layoff cardboard box office", + "packing desk box office" + ], + "tts": "severance pay", + "card_y": 1130 + }, + { + "id": "53", + "zh": "关税", + "en": "tariff", + "ipa": "/ˈtærɪf/", + "pos": "n.", + "cat": "事", + "hook": "10月23日特朗普签令调整对加拿大产品的关税,部分农林产品50%关税取消", + "q": [ + "container port cranes ship", + "shipping containers stacked port", + "container terminal aerial" + ], + "tts": "tariff", + "card_y": 720 + }, + { + "id": "54", + "zh": "中期选举", + "en": "midterm elections", + "ipa": "/ˈmɪdtɜːrm ɪˈlekʃnz/", + "pos": "n.", + "cat": "事", + "hook": "11月3日美国中期选举(众议院全部+参议院1/3改选);校园里 midterm 还是期中考", + "q": [ + "polling place voting booth USA", + "I Voted sticker", + "election day polling station voters" + ], + "tts": "midterm elections", + "card_y": 1140 + }, + { + "id": "55", + "zh": "(诺奖)得主", + "en": "laureate", + "ipa": "/ˈlɔːriət/", + "pos": "n.", + "cat": "人", + "hook": "10月5–12日诺贝尔奖揭晓:和平奖授予Navi Pillay,医学奖授予光遗传学三位科学家", + "q": [ + "Nobel Prize medal", + "Nobel Prize ceremony Stockholm", + "Nobel medal gold" + ], + "tts": "laureate", + "card_y": 1140 + }, + { + "id": "56", + "zh": "停火", + "en": "ceasefire", + "ipa": "/ˈsiːsfaɪər/", + "pos": "n.", + "cat": "事", + "hook": "10月23日俄乌同意在Oleshky实施局部停火(10月27日生效)并定于下月和谈", + "q": [ + "peace negotiations table flags handshake", + "white dove peace", + "UN peacekeepers" + ], + "tts": "ceasefire", + "card_y": 1130 + }, + { + "id": "57", + "zh": "流感疫苗", + "en": "flu shot", + "ipa": "/ˈfluː ʃɑːt/", + "pos": "n.", + "cat": "物", + "hook": "流感季开始:美国高校9–10月开设校园流感疫苗诊所,两岸疾控均提示流感处于流行期", + "q": [ + "flu vaccination arm injection", + "influenza vaccine shot nurse", + "vaccination clinic injection arm" + ], + "tts": "flu shot", + "card_y": 1130 + }, + { + "id": "58", + "zh": "疫情暴发", + "en": "outbreak", + "ipa": "/ˈaʊtbreɪk/", + "pos": "n.", + "cat": "事", + "hook": "10月20日尼日利亚确认埃博拉(本迪布焦型)输入病例,非洲疾控召开紧急会议;中国疾控10月风险评估提示登革热等", + "q": [ + "health workers protective suits ebola", + "Ebola treatment center PPE", + "thermal screening airport fever" + ], + "tts": "outbreak", + "card_y": 1130 + } +] \ No newline at end of file diff --git a/source/studio/items7.json b/source/studio/items7.json new file mode 100644 index 0000000000000000000000000000000000000000..e6b416ef76cfe0b04fc79187b604dde246992d20 --- /dev/null +++ b/source/studio/items7.json @@ -0,0 +1,146 @@ +[ + { + "id": "60", + "zh": "余震", + "en": "aftershock", + "ipa": "/ˈæftərʃɑːk/", + "pos": "n.", + "cat": "事", + "hook": "10月22日西藏那曲巴青县7.0级地震,已致16人遇难、1600余名搜救人员驰援,余震不断", + "q": [ + "earthquake rubble collapsed house rescue", + "earthquake damaged building Sichuan", + "earthquake aftermath collapsed wall" + ], + "tts": "aftershock", + "card_y": 1130 + }, + { + "id": "61", + "zh": "秋裤", + "en": "long johns", + "ipa": "/ˈlɔːŋ dʒɑːnz/", + "pos": "n.", + "cat": "物", + "hook": "10月21–25日冷空气连番南下,中国天气网「全国秋裤预警地图」显示超15省份需穿秋裤,北方降幅达10℃", + "q": [ + "thermal underwear long johns", + "long underwear folded", + "thermal leggings" + ], + "tts": "long johns", + "card_y": 1140 + }, + { + "id": "62", + "zh": "读研 / 考研", + "en": "grad school", + "ipa": "/ˈɡræd skuːl/", + "pos": "n.", + "cat": "事", + "hook": "2027年全国硕士研究生招生考试10月15–24日网上报名收官,机构预测报名约320万–335万人", + "q": [ + "university library students studying China", + "students studying library desks lamps", + "lecture hall university students" + ], + "tts": "grad school", + "card_y": 330 + }, + { + "id": "63", + "zh": "导师", + "en": "supervisor", + "ipa": "/ˈsuːpərvaɪzər/", + "pos": "n.", + "cat": "人", + "hook": "考研报名季,选导师、联系导师成为热门话题", + "q": [ + "professor talking with student office", + "professor and graduate student discussion", + "academic advisor student meeting" + ], + "tts": "supervisor", + "card_y": 1130 + }, + { + "id": "64", + "zh": "以旧换新(国补)", + "en": "trade-in", + "ipa": "/ˈtreɪd ɪn/", + "pos": "n.", + "cat": "事", + "hook": "2026年中央安排2500亿元支持消费品以旧换新;双11期间「国补+满减+红包」叠加成最热省钱攻略", + "q": [ + "appliance store washing machines showroom", + "electronics store smartphones display China", + "home appliance shop" + ], + "tts": "trade-in", + "card_y": 1180 + }, + { + "id": "65", + "zh": "尾款", + "en": "final payment", + "ipa": "/ˈfaɪnl ˈpeɪmənt/", + "pos": "n.", + "cat": "物", + "hook": "双11预售:天猫10月15日开启预售、10月20日晚8点集中付尾款,京东10月12日先开抢", + "q": [ + "online shopping smartphone hand", + "mobile payment phone shopping", + "person using smartphone shopping app" + ], + "tts": "final payment", + "card_y": 1140 + }, + { + "id": "66", + "zh": "结婚登记", + "en": "marriage registration", + "ipa": "/ˈmærɪdʒ ˌredʒɪˈstreɪʃn/", + "pos": "n.", + "cat": "事", + "hook": "10月24日《中国统计年鉴2026》:2025年全国初婚人数1042万、重回千万,结婚登记676.5万对、增长10.8%", + "q": [ + "marriage certificate China red", + "结婚证", + "wedding rings hands couple" + ], + "tts": "marriage registration", + "card_y": 1130 + }, + { + "id": "67", + "zh": "生育率", + "en": "fertility rate", + "ipa": "/fərˈtɪləti reɪt/", + "pos": "n.", + "cat": "事", + "hook": "10月24–25日热搜:2025年末全国总人口14.05亿、全年净减339万,连续四年负增长,出生792万人", + "q": [ + "baby stroller park", + "newborn baby hospital", + "mother pushing stroller" + ], + "tts": "fertility rate", + "card_y": 1130 + }, + { + "id": "68", + "zh": "续航焦虑", + "en": "range anxiety", + "ipa": "/ˈreɪndʒ æŋˌzaɪəti/", + "pos": "n.", + "cat": "事", + "hook": "10月20日微博热搜第一「油车电车10年成本账怎么算」,新能源车续航与充电再成焦点", + "q": [ + "electric car charging station China", + "EV charging plug", + "electric vehicle charging" + ], + "tts": "range anxiety", + "card_y": 300 + } +] \ No newline at end of file diff --git a/source/studio/package5.py b/source/studio/package5.py new file mode 100644 index 0000000000000000000000000000000000000000..17685037edfe2123b59e7536dc127a2462e3e3f4 --- /dev/null +++ b/source/studio/package5.py @@ -0,0 +1,79 @@ +"""Pair rendered clips as Apple Live Photos (JPG + MOV, with audio), build web previews, ZIP and manifest for set 5.""" +import json, os, shutil, subprocess, sys, zipfile +sys.path.insert(0, os.path.dirname(__file__)) +from pair_live_photo import pair + +OUT = '/tmp/work/out' +PUB = '/tmp/work/site/live' +SET = dict(key='e', items='items5.json', credits='credits5.json', + name='第五组 · 留学 & 职场:热点里的 9 个词', + folder='留学职场英语实况图-第五组', zip='study-abroad-workplace-live-photos.zip', + title='雅思停考、签证新规、秋招入职……这 9 个词你能用英语说出来吗?', + intro='最近留学圈和职场圈都挺热闹:雅思机考故障停考 4 天、美国 F-1 改 4 年固定期限、英国毕业生签证明年缩到 18 个月、秋招进入高峰……这些场景里天天碰到的人和事,换成英文你能马上说出来吗👀', + tags='#雅思 #托福 #留学 #留学生 #职场英语 #英语单词 #实况图 #每日英语 #秋招 #英语学习') + +README = """留学 & 职场英语 · 实况图素材包({n} 张) + +每张实况图 = 一对同名的 .JPG + .MOV(例如 {example}.JPG / {example}.MOV)。 +两个文件里写入了相同的苹果实况标识,视频带声音(英语发音 + 音效),全部 ≤ 3 秒,可发微信朋友圈 / 小红书 / 抖音图文。 + +Mac 导入方法: +1. 解压本压缩包; +2. 全选全部 JPG 和 MOV,一起拖进「照片」App(或 照片 → 文件 → 导入); +3. 照片会把每一对识别为一张 LIVE 实况照片; +4. 通过 iCloud 照片或隔空投送到 iPhone,发图文时选择这些照片并保持「实况」开启。 + +注意:JPG 和 MOV 必须成对导入;不要用其他软件重新转码 MOV,否则会丢失配对信息。 +尺寸 1080×1440(3:4 竖屏),30fps,H.264 + AAC。 + +建议标题:{title} + +建议正文: +{body} + +图片来源: +{credits} +""" + + +def main(): + items = json.load(open(os.path.join(os.path.dirname(__file__), SET['items']))) + credits = json.load(open(os.path.join(os.path.dirname(__file__), SET['credits']))) + cmap = {c['id']: c for c in credits} + dist = f"/tmp/work/dist/{SET['folder']}" + shutil.rmtree(dist, ignore_errors=True); os.makedirs(dist); os.makedirs(PUB, exist_ok=True) + out_items = [] + for k, it in enumerate(items, 1): + d = os.path.join(OUT, it['id']) + meta = json.load(open(os.path.join(d, 'render.json'))) + live = os.path.join(d, 'live'); shutil.rmtree(live, ignore_errors=True) + m = pair(os.path.join(d, 'cover.jpg'), os.path.join(d, 'motion.mp4'), live, meta['coverTime'], meta['fps']) + assert m['metadataVerified'], m + base = f"LIVE_{it['id']}_{it['en'].replace(' ', '-')}" + shutil.copy(os.path.join(live, 'live.jpg'), os.path.join(dist, base + '.JPG')) + shutil.copy(os.path.join(live, 'live.mov'), os.path.join(dist, base + '.MOV')) + subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'cover.jpg'), '-vf', 'scale=720:-2', '-q:v', '3', os.path.join(PUB, f"cover_{it['id']}.jpg")], check=True) + subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'final.jpg'), '-vf', 'scale=720:-2', '-q:v', '3', os.path.join(PUB, f"final_{it['id']}.jpg")], check=True) + subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'motion.mp4'), '-vf', 'scale=720:-2', '-c:v', 'libx264', '-crf', '24', '-preset', 'medium', '-pix_fmt', 'yuv420p', '-c:a', 'aac', '-b:a', '128k', '-movflags', '+faststart', os.path.join(PUB, f"preview_{it['id']}.mp4")], check=True) + src = 'wikimedia' if it['id'] in cmap else 'ai' + out_items.append({'id': it['id'], 'index': k, 'zh': it['zh'], 'en': it['en'], 'ipa': it['ipa'], 'pos': it['pos'], 'cat': it['cat'], 'hook': it['hook'], + 'source': src, 'duration': round(meta['duration'], 2), 'cover': f"cover_{it['id']}.jpg", 'final': f"final_{it['id']}.jpg", + 'preview': f"preview_{it['id']}.mp4", 'identifier': m['identifier'], 'file': base}) + print('paired', base, m['identifier'], flush=True) + body = (SET['intro'] + '\n先看封面猜一猜,再长按实况看答案(记得开声音🔊)\n评论区报一下你答对了几个~\n\n' + + ' / '.join(i['zh'] for i in items) + '\n\n图片来源:4 张为 Wikimedia Commons 授权照片(作者与授权见素材包内说明),5 张为 AI 生成\n\n' + SET['tags']) + cred_txt = '\n'.join(f"- {c['zh']} / {c['en']}: 「{c['file']}」 by {c['author']} · {c['license']} · {c['page']}" for c in credits) + '\n- 其余 5 张(监考老师 / 成绩单 / 押金 / 试用期 / 工资条)为 AI 生成图片' + open(os.path.join(dist, '使用说明.txt'), 'w', encoding='utf-8').write(README.format(n=len(items), example=f"LIVE_{items[0]['id']}_{items[0]['en']}", title=SET['title'], body=body, credits=cred_txt)) + zp = os.path.join(PUB, SET['zip']) + with zipfile.ZipFile(zp, 'w', zipfile.ZIP_STORED) as z: + for f in sorted(os.listdir(dist)): + z.write(os.path.join(dist, f), f"{SET['folder']}/{f}") + manifest = {'key': SET['key'], 'name': SET['name'], 'zip': SET['zip'], 'zipMB': round(os.path.getsize(zp) / 1e6, 1), 'items': out_items, + 'copy': {'title': SET['title'], 'body': body}, + 'credits': [{'id': c['id'], 'zh': c['zh'], 'en': c['en'], 'author': c['author'], 'license': c['license'], 'licenseUrl': c.get('license_url') or '', 'page': c['page'], 'file': c['file']} for c in credits]} + json.dump(manifest, open('/tmp/work/site/pack.json', 'w'), ensure_ascii=False, indent=1) + print('zip MB', manifest['zipMB']) + + +if __name__ == '__main__': + main() diff --git a/source/studio/package6.py b/source/studio/package6.py new file mode 100644 index 0000000000000000000000000000000000000000..b9bee090e33448f9f8f9822bf56e3bd7e2314fda --- /dev/null +++ b/source/studio/package6.py @@ -0,0 +1,79 @@ +"""Pair rendered clips as Apple Live Photos (JPG + MOV, with audio), build web previews, ZIP and manifest for set 5.""" +import json, os, shutil, subprocess, sys, zipfile +sys.path.insert(0, os.path.dirname(__file__)) +from pair_live_photo import pair + +OUT = '/tmp/work/out' +PUB = '/tmp/work/site/live' +SET = dict(key='f', items='items6.json', credits='credits6.json', + name='第六组 · 本周热点事件里的 9 个词', + folder='热点事件英语实况图-第六组', zip='hot-news-words-live-photos.zip', + title='入境被关小黑屋、国考报名、AI 裁员、中期选举……这 9 个新闻词你会用英语说吗?', + intro='这两周的新闻你肯定刷到过:留学生入境美国被盘查遣返、2027 国考报名收官、Barclays/Amazon 的 AI 裁员潮、特朗普调关税、11 月 3 日美国中期选举、诺贝尔奖揭晓、俄乌局部停火、流感季开打疫苗、尼日利亚出现埃博拉病例……新闻标题天天见,可换成英文,这些词你能马上说出来吗👀', + tags='#雅思 #托福 #留学 #留学生 #职场英语 #新闻英语 #英语单词 #实况图 #每日英语 #英语学习 #热点') + +README = """热点事件英语 · 实况图素材包({n} 张) + +每张实况图 = 一对同名的 .JPG + .MOV(例如 {example}.JPG / {example}.MOV)。 +两个文件里写入了相同的苹果实况标识,视频带声音(英语发音 + 音效),全部 ≤ 3 秒,可发微信朋友圈 / 小红书 / 抖音图文。 + +Mac 导入方法: +1. 解压本压缩包; +2. 全选全部 JPG 和 MOV,一起拖进「照片」App(或 照片 → 文件 → 导入); +3. 照片会把每一对识别为一张 LIVE 实况照片; +4. 通过 iCloud 照片或隔空投送到 iPhone,发图文时选择这些照片并保持「实况」开启。 + +注意:JPG 和 MOV 必须成对导入;不要用其他软件重新转码 MOV,否则会丢失配对信息。 +尺寸 1080×1440(3:4 竖屏),30fps,H.264 + AAC。 + +建议标题:{title} + +建议正文: +{body} + +图片来源: +{credits} +""" + + +def main(): + items = json.load(open(os.path.join(os.path.dirname(__file__), SET['items']))) + credits = json.load(open(os.path.join(os.path.dirname(__file__), SET['credits']))) + cmap = {c['id']: c for c in credits} + dist = f"/tmp/work/dist/{SET['folder']}" + shutil.rmtree(dist, ignore_errors=True); os.makedirs(dist); os.makedirs(PUB, exist_ok=True) + out_items = [] + for k, it in enumerate(items, 1): + d = os.path.join(OUT, it['id']) + meta = json.load(open(os.path.join(d, 'render.json'))) + live = os.path.join(d, 'live'); shutil.rmtree(live, ignore_errors=True) + m = pair(os.path.join(d, 'cover.jpg'), os.path.join(d, 'motion.mp4'), live, meta['coverTime'], meta['fps']) + assert m['metadataVerified'], m + base = f"LIVE_{it['id']}_{it['en'].replace(' ', '-')}" + shutil.copy(os.path.join(live, 'live.jpg'), os.path.join(dist, base + '.JPG')) + shutil.copy(os.path.join(live, 'live.mov'), os.path.join(dist, base + '.MOV')) + subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'cover.jpg'), '-vf', 'scale=720:-2', '-q:v', '3', os.path.join(PUB, f"cover_{it['id']}.jpg")], check=True) + subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'final.jpg'), '-vf', 'scale=720:-2', '-q:v', '3', os.path.join(PUB, f"final_{it['id']}.jpg")], check=True) + subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'motion.mp4'), '-vf', 'scale=720:-2', '-c:v', 'libx264', '-crf', '24', '-preset', 'medium', '-pix_fmt', 'yuv420p', '-c:a', 'aac', '-b:a', '128k', '-movflags', '+faststart', os.path.join(PUB, f"preview_{it['id']}.mp4")], check=True) + src = 'wikimedia' if it['id'] in cmap else 'ai' + out_items.append({'id': it['id'], 'index': k, 'zh': it['zh'], 'en': it['en'], 'ipa': it['ipa'], 'pos': it['pos'], 'cat': it['cat'], 'hook': it['hook'], + 'source': src, 'duration': round(meta['duration'], 2), 'cover': f"cover_{it['id']}.jpg", 'final': f"final_{it['id']}.jpg", + 'preview': f"preview_{it['id']}.mp4", 'identifier': m['identifier'], 'file': base}) + print('paired', base, m['identifier'], flush=True) + body = (SET['intro'] + '\n先看封面猜一猜,再长按实况看答案(记得开声音🔊)\n评论区报一下你答对了几个~\n\n' + + ' / '.join(i['zh'] for i in items) + '\n\n图片来源:7 张为 Wikimedia Commons 授权照片(作者与授权见素材包内说明),2 张为 AI 生成\n\n' + SET['tags']) + cred_txt = '\n'.join(f"- {c['zh']} / {c['en']}: 「{c['file']}」 by {c['author']} · {c['license']} · {c['page']}" for c in credits) + '\n- 其余 2 张(公务员 / 遣散费)为 AI 生成图片' + open(os.path.join(dist, '使用说明.txt'), 'w', encoding='utf-8').write(README.format(n=len(items), example=f"LIVE_{items[0]['id']}_{items[0]['en']}", title=SET['title'], body=body, credits=cred_txt)) + zp = os.path.join(PUB, SET['zip']) + with zipfile.ZipFile(zp, 'w', zipfile.ZIP_STORED) as z: + for f in sorted(os.listdir(dist)): + z.write(os.path.join(dist, f), f"{SET['folder']}/{f}") + manifest = {'key': SET['key'], 'name': SET['name'], 'zip': SET['zip'], 'zipMB': round(os.path.getsize(zp) / 1e6, 1), 'items': out_items, + 'copy': {'title': SET['title'], 'body': body}, + 'credits': [{'id': c['id'], 'zh': c['zh'], 'en': c['en'], 'author': c['author'], 'license': c['license'], 'licenseUrl': c.get('license_url') or '', 'page': c['page'], 'file': c['file']} for c in credits]} + json.dump(manifest, open('/tmp/work/site/pack6.json', 'w'), ensure_ascii=False, indent=1) + print('zip MB', manifest['zipMB']) + + +if __name__ == '__main__': + main() diff --git a/source/studio/package7.py b/source/studio/package7.py new file mode 100644 index 0000000000000000000000000000000000000000..e2f11ec7e27f088fc2900546be9b05e05d4957b4 --- /dev/null +++ b/source/studio/package7.py @@ -0,0 +1,79 @@ +"""Pair rendered clips as Apple Live Photos (JPG + MOV, with audio), build web previews, ZIP and manifest for set 5.""" +import json, os, shutil, subprocess, sys, zipfile +sys.path.insert(0, os.path.dirname(__file__)) +from pair_live_photo import pair + +OUT = '/tmp/work/out' +PUB = '/tmp/work/site/live' +SET = dict(key='g', items='items7.json', credits='credits7.json', + name='第七组 · 本周国内社会热点里的 9 个词', + folder='国内热点英语实况图-第七组', zip='china-hot-topics-live-photos.zip', + title='那曲地震、秋裤预警、考研报名、双11尾款、人口负增长……这 9 个国内热点词你会用英语说吗?', + intro='这一周国内的热搜你肯定刷到过:西藏那曲 7.0 级地震、全国秋裤预警地图、2027 考研报名收官、双 11 付尾款 + 国补以旧换新、初婚人数重回千万、总人口面临跌破 14 亿、油车电车十年成本账……中文天天说,可换成英文,这些词你能马上说出来吗👀', + tags='#雅思 #托福 #留学 #留学生 #职场英语 #新闻英语 #英语单词 #实况图 #每日英语 #英语学习 #热搜') + +README = """国内热点英语 · 实况图素材包({n} 张) + +每张实况图 = 一对同名的 .JPG + .MOV(例如 {example}.JPG / {example}.MOV)。 +两个文件里写入了相同的苹果实况标识,视频带声音(英语发音 + 音效),全部 ≤ 3 秒,可发微信朋友圈 / 小红书 / 抖音图文。 + +Mac 导入方法: +1. 解压本压缩包; +2. 全选全部 JPG 和 MOV,一起拖进「照片」App(或 照片 → 文件 → 导入); +3. 照片会把每一对识别为一张 LIVE 实况照片; +4. 通过 iCloud 照片或隔空投送到 iPhone,发图文时选择这些照片并保持「实况」开启。 + +注意:JPG 和 MOV 必须成对导入;不要用其他软件重新转码 MOV,否则会丢失配对信息。 +尺寸 1080×1440(3:4 竖屏),30fps,H.264 + AAC。 + +建议标题:{title} + +建议正文: +{body} + +图片来源: +{credits} +""" + + +def main(): + items = json.load(open(os.path.join(os.path.dirname(__file__), SET['items']))) + credits = json.load(open(os.path.join(os.path.dirname(__file__), SET['credits']))) + cmap = {c['id']: c for c in credits} + dist = f"/tmp/work/dist/{SET['folder']}" + shutil.rmtree(dist, ignore_errors=True); os.makedirs(dist); os.makedirs(PUB, exist_ok=True) + out_items = [] + for k, it in enumerate(items, 1): + d = os.path.join(OUT, it['id']) + meta = json.load(open(os.path.join(d, 'render.json'))) + live = os.path.join(d, 'live'); shutil.rmtree(live, ignore_errors=True) + m = pair(os.path.join(d, 'cover.jpg'), os.path.join(d, 'motion.mp4'), live, meta['coverTime'], meta['fps']) + assert m['metadataVerified'], m + base = f"LIVE_{it['id']}_{it['en'].replace(' ', '-')}" + shutil.copy(os.path.join(live, 'live.jpg'), os.path.join(dist, base + '.JPG')) + shutil.copy(os.path.join(live, 'live.mov'), os.path.join(dist, base + '.MOV')) + subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'cover.jpg'), '-vf', 'scale=720:-2', '-q:v', '3', os.path.join(PUB, f"cover_{it['id']}.jpg")], check=True) + subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'final.jpg'), '-vf', 'scale=720:-2', '-q:v', '3', os.path.join(PUB, f"final_{it['id']}.jpg")], check=True) + subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'motion.mp4'), '-vf', 'scale=720:-2', '-c:v', 'libx264', '-crf', '24', '-preset', 'medium', '-pix_fmt', 'yuv420p', '-c:a', 'aac', '-b:a', '128k', '-movflags', '+faststart', os.path.join(PUB, f"preview_{it['id']}.mp4")], check=True) + src = 'wikimedia' if it['id'] in cmap else 'ai' + out_items.append({'id': it['id'], 'index': k, 'zh': it['zh'], 'en': it['en'], 'ipa': it['ipa'], 'pos': it['pos'], 'cat': it['cat'], 'hook': it['hook'], + 'source': src, 'duration': round(meta['duration'], 2), 'cover': f"cover_{it['id']}.jpg", 'final': f"final_{it['id']}.jpg", + 'preview': f"preview_{it['id']}.mp4", 'identifier': m['identifier'], 'file': base}) + print('paired', base, m['identifier'], flush=True) + body = (SET['intro'] + '\n先看封面猜一猜,再长按实况看答案(记得开声音🔊)\n评论区报一下你答对了几个~\n\n' + + ' / '.join(i['zh'] for i in items) + '\n\n图片来源:4 张为 Wikimedia Commons 授权照片(作者与授权见素材包内说明),5 张为 AI 生成\n\n' + SET['tags']) + cred_txt = '\n'.join(f"- {c['zh']} / {c['en']}: 「{c['file']}」 by {c['author']} · {c['license']} · {c['page']}" for c in credits) + '\n- 其余 5 张(秋裤 / 导师 / 以旧换新 / 尾款 / 结婚登记)为 AI 生成图片' + open(os.path.join(dist, '使用说明.txt'), 'w', encoding='utf-8').write(README.format(n=len(items), example=f"LIVE_{items[0]['id']}_{items[0]['en']}", title=SET['title'], body=body, credits=cred_txt)) + zp = os.path.join(PUB, SET['zip']) + with zipfile.ZipFile(zp, 'w', zipfile.ZIP_STORED) as z: + for f in sorted(os.listdir(dist)): + z.write(os.path.join(dist, f), f"{SET['folder']}/{f}") + manifest = {'key': SET['key'], 'name': SET['name'], 'zip': SET['zip'], 'zipMB': round(os.path.getsize(zp) / 1e6, 1), 'items': out_items, + 'copy': {'title': SET['title'], 'body': body}, + 'credits': [{'id': c['id'], 'zh': c['zh'], 'en': c['en'], 'author': c['author'], 'license': c['license'], 'licenseUrl': c.get('license_url') or '', 'page': c['page'], 'file': c['file']} for c in credits]} + json.dump(manifest, open('/tmp/work/site/pack7.json', 'w'), ensure_ascii=False, indent=1) + print('zip MB', manifest['zipMB']) + + +if __name__ == '__main__': + main() diff --git a/source/studio/pair_live_photo.py b/source/studio/pair_live_photo.py new file mode 100644 index 0000000000000000000000000000000000000000..c80063508d1fd857d99c91c557bd1aa7171635d0 --- /dev/null +++ b/source/studio/pair_live_photo.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python3 +"""Pair rendered JPEG + H.264 (+ optional AAC audio) as Apple Live Photo on any desktop OS. +Modified from LiveCanvas: keeps one AAC audio track (Live Photos support sound) instead of rejecting it. +Requires Python >=3.10, Pillow >=10,<12, ffmpeg and ffprobe on PATH. +Never imports into Photos. Use verify_live_photo.swift for optional Apple validation. +""" +import argparse +from fractions import Fraction +import hashlib +import json +import math +from pathlib import Path +import shutil +import subprocess +import tempfile +import uuid + +from PIL import Image +from portable_live_photo.apple import write_live_jpeg, write_live_mov, inspect_live_jpeg, inspect_live_mov + + +def digest(path): + with Path(path).open('rb') as stream: + return hashlib.file_digest(stream, 'sha256').hexdigest() if hasattr(hashlib, 'file_digest') else hashlib.sha256(stream.read()).hexdigest() + + +def probe(path): + result = subprocess.run(['ffprobe', '-v', 'error', '-show_streams', '-show_format', '-of', 'json', str(path)], check=True, capture_output=True, text=True) + return json.loads(result.stdout) + + +def check_inputs(photo, movie, seconds, fps): + if not all(math.isfinite(n) for n in (seconds, fps)) or not 0 < fps <= 240: + raise ValueError('Invalid cover time/fps') + info = probe(movie) + streams = info['streams'] + videos = [s for s in streams if s['codec_type'] == 'video'] + if len(videos) != 1 or videos[0]['codec_name'] != 'h264': + raise ValueError('Expected one H.264 video stream') + audios = [s for s in streams if s['codec_type'] == 'audio'] + if len(audios) > 1 or any(a['codec_name'] != 'aac' for a in audios): + raise ValueError('At most one AAC audio stream supported') + video = videos[0] + duration = float(video.get('duration', info['format']['duration'])) + if not math.isfinite(duration) or not 0 <= seconds or seconds + 1/fps > duration + 0.0001: + raise ValueError('Cover time outside video') + if abs(float(Fraction(video['avg_frame_rate'])) - fps) > 0.01 or abs(seconds*fps-round(seconds*fps)) > 0.0001: + raise ValueError('FPS mismatch or cover time not aligned to frame') + if abs(float(video.get('start_time', 0))) > 0.0001: + raise ValueError('Expected zero-based render timeline') + if any(float(d.get('rotation', 0)) != 0 for d in video.get('side_data_list', [])): + raise ValueError('Render rotation into pixels before pairing') + with Image.open(photo) as cover: + if cover.format != 'JPEG' or cover.size != (video['width'], video['height']): + raise ValueError('Expected JPEG matching video dimensions') + if cover.getexif().get(274, 1) != 1: + raise ValueError('Render EXIF orientation into pixels first') + cover.load() + return duration + + +def verify_pair(directory, manifest): + directory = Path(directory).resolve() + paths = [] + for key in ('photo', 'video'): + path = (directory / manifest[key]).resolve() + if path.parent != directory or not path.is_file(): + raise ValueError('Invalid pair resource path') + if manifest.get('sha256', {}).get(key) != digest(path): + raise ValueError('Pair hash mismatch: ' + key) + paths.append(path) + photo, movie = paths + identifier = inspect_live_jpeg(photo) + metadata = inspect_live_mov(movie) + if identifier != manifest['identifier'] or metadata.asset_id != identifier or metadata.sample_value != 0: + raise ValueError('Live Photo identifier or signed metadata sample mismatch') + if abs(metadata.still_time - manifest['coverTime']) > 1/60000: + raise ValueError('Timed metadata position mismatch') + # Independent FFmpeg demuxer must find the metadata sample at the same timestamp. + packets = json.loads(subprocess.run(['ffprobe', '-v', 'error', '-select_streams', 'd', '-show_packets', '-of', 'json', str(movie)], check=True, capture_output=True, text=True).stdout)['packets'] + if len(packets) != 1 or abs(float(packets[0]['pts_time']) - manifest['coverTime']) > 1/60000: + raise ValueError('FFprobe timed sample readback failed') + # FFmpeg 7.x omits duration_time for a sample that follows an empty edit; the writer sets it to one frame. + if 'duration_time' in packets[0] and abs(float(packets[0]['duration_time']) - 1/manifest['fps']) > 2/60000: + raise ValueError('Timed sample duration mismatch') + check_inputs(photo, movie, manifest['coverTime'], manifest['fps']) + subprocess.run(['ffmpeg', '-v', 'error', '-xerror', '-i', str(movie), '-map', '0:v:0', '-f', 'null', '-'], check=True, capture_output=True) + return metadata + + +def pair(photo, movie, output, seconds, fps): + photo, movie, output = Path(photo).resolve(), Path(movie).resolve(), Path(output).absolute() + if output.exists(): + raise ValueError('Output already exists; choose a new directory') + duration = check_inputs(photo, movie, seconds, fps) + output.parent.mkdir(parents=True, exist_ok=True) + staging = Path(tempfile.mkdtemp(prefix='.livecanvas-pair-', dir=output.parent)) + try: + identifier = str(uuid.uuid4()).upper() + raw = staging / 'remux.mov' + subprocess.run(['ffmpeg', '-v', 'error', '-nostdin', '-i', str(movie), '-map', '0:v:0', '-map', '0:a:0?', '-map_metadata', '-1', '-c', 'copy', '-movie_timescale', '60000', str(raw)], check=True, capture_output=True) + write_live_jpeg(photo, staging / 'live.jpg', identifier) + write_live_mov(raw, staging / 'live.mov', identifier, seconds, duration, fps) + raw.unlink() + manifest = {'identifier': identifier, 'photo': 'live.jpg', 'video': 'live.mov', 'coverTime': seconds, 'duration': duration, 'fps': fps, + 'backend': 'portable-python', 'metadataVerified': False, 'localPHLivePhotoLoad': 'not_available', + 'localLoadReason': 'Portable backend does not invoke Apple PhotoKit', 'iPhonePlayback': 'not_tested', + 'photosImport': 'not_requested', 'wallpaper': 'not_tested', 'importedIntoPhotos': False, + 'sha256': {'photo': digest(staging/'live.jpg'), 'video': digest(staging/'live.mov')}} + actual = verify_pair(staging, manifest) + manifest.update(metadataVerified=True, readbackStillTime=actual.still_time) + (staging/'manifest.json').write_text(json.dumps(manifest, ensure_ascii=False, indent=2), encoding='utf-8') + if output.exists(): + raise ValueError('Output appeared during generation; refusing to replace it') + staging.rename(output) + return manifest + finally: + if staging.exists(): + shutil.rmtree(staging) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('photo') + parser.add_argument('movie') + parser.add_argument('output') + parser.add_argument('cover_seconds', type=float) + parser.add_argument('fps', type=float) + args = parser.parse_args() + print(json.dumps(pair(args.photo, args.movie, args.output, args.cover_seconds, args.fps), indent=2)) diff --git a/source/studio/picks.example.json b/source/studio/picks.example.json new file mode 100644 index 0000000000000000000000000000000000000000..6b47d4daa85e4f04571f014b25a7272e1b1c3d5d --- /dev/null +++ b/source/studio/picks.example.json @@ -0,0 +1,11 @@ +{ + "41": "/workspaces/976996a4-b95a-412c-9703-5fc8e4e17fa3/sessions/20261025_130903_c2e5bfc3-44d3-4056-890f-8d29faa803f2/outputs/files/live-invigilator.png", + "42": "/workspaces/976996a4-b95a-412c-9703-5fc8e4e17fa3/sessions/20261025_130903_c2e5bfc3-44d3-4056-890f-8d29faa803f2/outputs/files/live-transcript.png", + "43": "/tmp/work/real/43_pick.jpg", + "44": "/tmp/work/real/44_pick.jpg", + "45": "/tmp/work/real/45_pick.jpg", + "46": "/workspaces/976996a4-b95a-412c-9703-5fc8e4e17fa3/sessions/20261025_130903_c2e5bfc3-44d3-4056-890f-8d29faa803f2/outputs/files/live-security-deposit.png", + "47": "/workspaces/976996a4-b95a-412c-9703-5fc8e4e17fa3/sessions/20261025_130903_c2e5bfc3-44d3-4056-890f-8d29faa803f2/outputs/files/live-probation-period.png", + "48": "/tmp/work/real/48_pick.jpg", + "49": "/workspaces/976996a4-b95a-412c-9703-5fc8e4e17fa3/sessions/20261025_130903_c2e5bfc3-44d3-4056-890f-8d29faa803f2/outputs/files/live-payslip.png" +} \ No newline at end of file diff --git a/source/studio/portable_live_photo/LICENSE b/source/studio/portable_live_photo/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..8d968b6cb081a9917169ffda16e60e0f56e453f3 --- /dev/null +++ b/source/studio/portable_live_photo/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/source/studio/portable_live_photo/NOTICE b/source/studio/portable_live_photo/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..c074351a7f6aab7192b0487cc264fdfc2f11f351 --- /dev/null +++ b/source/studio/portable_live_photo/NOTICE @@ -0,0 +1,5 @@ +Video to Live Photo +Copyright 2026 杨振 + +This product includes software originally developed by 杨振. +Redistributions must retain this NOTICE where required by the Apache License 2.0. diff --git a/source/studio/portable_live_photo/__init__.py b/source/studio/portable_live_photo/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c68c4bfab2fb89d4063f284d3b4e3c2366bd8af6 --- /dev/null +++ b/source/studio/portable_live_photo/__init__.py @@ -0,0 +1 @@ +"""Portable Live Photo metadata helpers; see NOTICE and LICENSE.""" diff --git a/source/studio/portable_live_photo/apple.py b/source/studio/portable_live_photo/apple.py new file mode 100644 index 0000000000000000000000000000000000000000..7df9d8ba45f4e254a3b593015577e042de72e827 --- /dev/null +++ b/source/studio/portable_live_photo/apple.py @@ -0,0 +1,413 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2026 杨振 +# Modified by LiveCanvas: EXIF sub-IFD, signed zero sample, frame duration, +# exact identifier readback, strict single-mdat input, next track ID. +from __future__ import annotations + +import struct +import uuid +from dataclasses import dataclass +from pathlib import Path + +from PIL import Image + +from .iso_bmff import Atom, atom, child_atoms, first_child, parse_atoms, patch_chunk_offsets + + +CONTENT_KEY = b"com.apple.quicktime.content.identifier" +STILL_TIME_KEY = b"com.apple.quicktime.still-image-time" +TIMED_SAMPLE = b"\x00\x00\x00\x09\x00\x00\x00\x01\x00" + + +@dataclass(frozen=True, slots=True) +class LiveMovInfo: + asset_id: str + still_time: float + video_track_id: int + metadata_track_id: int + video_chunk_offset: int + metadata_chunk_offset: int + sample_value: int + + +def _canonical_asset_id(asset_id: str) -> str: + try: + return str(uuid.UUID(asset_id)).upper() + except (ValueError, AttributeError) as exc: + raise ValueError("Apple 资产标识必须是标准 UUID") from exc + + +def apple_maker_note(asset_id: str) -> bytes: + identifier = _canonical_asset_id(asset_id).encode("ascii") + return ( + b"Apple iOS\x00\x00\x01MM" + + b"\x00\x01" + + b"\x00\x11\x00\x02" + + struct.pack(">I", len(identifier) + 1) + + struct.pack(">I", 32) + + b"\x00\x00\x00\x00" + + identifier + + b"\x00" + ) + + +def _exif_bytes(exif): + # Pillow serializes an unknown MakerNote byte string as TIFF BYTE (1). + # ImageIO requires UNDEFINED (7); change the type without moving any data. + raw = bytearray(exif.tobytes()) + base = 6 # Exif\0\0 prefix, offsets are relative to TIFF header + order = ">" if raw[base:base+2] == b"MM" else "<" + ifd0 = struct.unpack_from(order + "I", raw, base+4)[0] + count = struct.unpack_from(order + "H", raw, base+ifd0)[0] + for index in range(count): + entry = base+ifd0+2+12*index + tag, kind, size, offset = struct.unpack_from(order + "HHII", raw, entry) + if tag != 0x8769: + continue + subcount = struct.unpack_from(order + "H", raw, base+offset)[0] + for subindex in range(subcount): + subentry = base+offset+2+12*subindex + if struct.unpack_from(order + "H", raw, subentry)[0] == 0x927C: + struct.pack_into(order + "H", raw, subentry+2, 7) + return bytes(raw) + raise ValueError("Missing ExifIFD MakerNote") + + +def write_live_jpeg(source: Path, output: Path, asset_id: str) -> None: + note = apple_maker_note(asset_id) + with Image.open(source) as original: + image = original.convert("RGB") + exif = original.getexif() + exif[0x010F] = "Apple" + exif[0x0110] = "LiveCanvas" + exif_ifd = exif.get_ifd(0x8769) + exif_ifd[0x927C] = note + exif_ifd[0x9000] = b"0232" + exif_ifd[0xA000] = b"0100" + exif_ifd[0xA001] = 1 + exif_ifd[0xA002] = image.width + exif_ifd[0xA003] = image.height + exif[0x8769] = exif_ifd + if 0x927C in exif: + del exif[0x927C] + save_args: dict[str, object] = { + "format": "JPEG", + "quality": 95, + "subsampling": 0, + "exif": _exif_bytes(exif), + } + if original.info.get("icc_profile"): + save_args["icc_profile"] = original.info["icc_profile"] + image.save(output, **save_args) + + +def inspect_live_jpeg(path: Path) -> str: + with Image.open(path) as image: + note = image.getexif().get_ifd(0x8769).get(0x927C) + if not isinstance(note, bytes) or not note.startswith(b"Apple iOS\x00\x00\x01MM"): + raise ValueError("JPEG 缺少 Apple MakerNote") + if len(note) < 69 or note[16:18] != b"\x00\x11" or note[18:20] != b"\x00\x02": + raise ValueError("Apple MakerNote 缺少内容标识 tag 17") + count = int.from_bytes(note[20:24], "big") + offset = int.from_bytes(note[24:28], "big") + raw = note[offset : offset + count].rstrip(b"\x00") + try: + return _canonical_asset_id(raw.decode("ascii")) + except (UnicodeDecodeError, ValueError) as exc: + raise ValueError("Apple MakerNote 内容标识无效") from exc + + +def _fullbox(version: int = 0, flags: int = 0) -> bytes: + return bytes((version,)) + flags.to_bytes(3, "big") + + +def _content_identifier_meta(asset_id: str) -> bytes: + identifier = _canonical_asset_id(asset_id).encode("ascii") + hdlr = atom( + b"hdlr", + _fullbox() + b"\x00" * 4 + b"mdta" + b"\x00" * 12 + b"\x00\x00", + ) + key_entry = struct.pack(">I4s", 8 + len(CONTENT_KEY), b"mdta") + CONTENT_KEY + keys = atom(b"keys", _fullbox() + struct.pack(">I", 1) + key_entry) + data = atom(b"data", struct.pack(">II", 1, 0) + identifier) + item = atom(b"\x00\x00\x00\x01", data) + return atom(b"meta", hdlr + keys + atom(b"ilst", item)) + + +def _pascal(text: bytes) -> bytes: + if len(text) > 255: + raise ValueError("Pascal 字符串过长") + return bytes((len(text),)) + text + + +def _timed_metadata_track( + track_id: int, + video_track_id: int, + timescale: int, + cover_ticks: int, + sample_offset: int, + sample_ticks: int, +) -> bytes: + track_duration = cover_ticks + sample_ticks + matrix = struct.pack( + ">9I", + 0x00010000, + 0, + 0, + 0, + 0x00010000, + 0, + 0, + 0, + 0x40000000, + ) + tkhd = atom( + b"tkhd", + _fullbox(flags=0x0F) + + struct.pack(">IIIII", 0, 0, track_id, 0, track_duration) + + b"\x00" * 8 + + struct.pack(">hhhh", 0, 0, 0, 0) + + matrix + + struct.pack(">II", 0, 0), + ) + + edits: list[bytes] = [] + if cover_ticks: + edits.append(struct.pack(">IiHH", cover_ticks, -1, 1, 0)) + edits.append(struct.pack(">IiHH", sample_ticks, 0, 1, 0)) + elst = atom(b"elst", _fullbox() + struct.pack(">I", len(edits)) + b"".join(edits)) + edts = atom(b"edts", elst) + tref = atom(b"tref", atom(b"cdsc", struct.pack(">I", video_track_id))) + + mdhd = atom( + b"mdhd", + _fullbox() + + struct.pack(">IIII", 0, 0, timescale, sample_ticks) + + struct.pack(">HH", 0x55C4, 0), + ) + metadata_name = b"Core Media Metadata" + hdlr = atom( + b"hdlr", + _fullbox() + + b"mhlrmetaappl" + + struct.pack(">II", 1, 0) + + _pascal(metadata_name), + ) + + gmin = atom( + b"gmin", + _fullbox() + struct.pack(">H3HHH", 0x0040, 0x8000, 0x8000, 0x8000, 0, 0), + ) + gmhd = atom(b"gmhd", gmin) + data_name = b"Core Media Data Handler" + data_hdlr = atom( + b"hdlr", + _fullbox() + + b"dhlralisappl" + + struct.pack(">II", 0, 0) + + _pascal(data_name), + ) + alias = atom(b"alis", _fullbox(flags=1)) + dref = atom(b"dref", _fullbox() + struct.pack(">I", 1) + alias) + dinf = atom(b"dinf", dref) + + keyd = atom(b"keyd", b"mdta" + STILL_TIME_KEY) + dtyp = atom(b"dtyp", _fullbox() + struct.pack(">I", 0x41)) + key_record = struct.pack(">II", 8 + len(keyd) + len(dtyp), 1) + keyd + dtyp + keys = atom(b"keys", key_record) + mebx = atom(b"mebx", b"\x00" * 6 + struct.pack(">H", 1) + keys) + stsd = atom(b"stsd", _fullbox() + struct.pack(">I", 1) + mebx) + stts = atom(b"stts", _fullbox() + struct.pack(">III", 1, 1, sample_ticks)) + stsc = atom(b"stsc", _fullbox() + struct.pack(">IIII", 1, 1, 1, 1)) + stsz = atom(b"stsz", _fullbox() + struct.pack(">II", 0, 1) + struct.pack(">I", len(TIMED_SAMPLE))) + if sample_offset <= 0xFFFFFFFF: + chunk_offsets = atom(b"stco", _fullbox() + struct.pack(">II", 1, sample_offset)) + else: + chunk_offsets = atom(b"co64", _fullbox() + struct.pack(">IQ", 1, sample_offset)) + stbl = atom(b"stbl", stsd + stts + stsc + stsz + chunk_offsets) + minf = atom(b"minf", gmhd + data_hdlr + dinf + stbl) + mdia = atom(b"mdia", mdhd + hdlr + minf) + return atom(b"trak", tkhd + edts + tref + mdia) + + +def _movie_timescale(data: bytes, moov: Atom) -> int: + mvhd = first_child(data, moov, b"mvhd") + if mvhd is None: + raise ValueError("MOV 缺少 mvhd") + version = data[mvhd.payload_start] + position = mvhd.start + (28 if version == 1 else 20) + if position + 4 > mvhd.end: + raise ValueError("MOV mvhd 不完整") + timescale = int.from_bytes(data[position : position + 4], "big") + if timescale <= 0: + raise ValueError("MOV 时间基无效") + return timescale + + +def _track_id(data: bytes, trak: Atom) -> int: + tkhd = first_child(data, trak, b"tkhd") + if tkhd is None: + raise ValueError("MOV 轨道缺少 tkhd") + version = data[tkhd.payload_start] + position = tkhd.start + (28 if version == 1 else 20) + return int.from_bytes(data[position : position + 4], "big") + + +def _track_handler(data: bytes, trak: Atom) -> bytes | None: + mdia = first_child(data, trak, b"mdia") + if mdia is None: + return None + hdlr = first_child(data, mdia, b"hdlr") + if hdlr is None or hdlr.start + 20 > hdlr.end: + return None + return data[hdlr.start + 16 : hdlr.start + 20] + + +def _top_required(data: bytes) -> tuple[list[Atom], Atom, Atom, Atom]: + top = parse_atoms(data) + try: + ftyp = next(item for item in top if item.type == b"ftyp") + mdat = next(item for item in top if item.type == b"mdat") + moov = next(item for item in top if item.type == b"moov") + except StopIteration as exc: + raise ValueError("MOV 必须包含 ftyp、mdat 和 moov") from exc + return top, ftyp, mdat, moov + + +def write_live_mov( + source: Path, + output: Path, + asset_id: str, + still_time: float, + duration: float, + fps: float, +) -> None: + identifier = _canonical_asset_id(asset_id) + if duration <= 0 or not 0 <= still_time <= duration: + raise ValueError("Apple 封面时刻必须位于视频片段内") + data = source.read_bytes() + top, _ftyp, mdat, moov = _top_required(data) + if sum(a.type == b"mdat" for a in top) != 1 or any(a.type == b"moof" for a in top): + raise ValueError("Expected non-fragmented, single-mdat FFmpeg output") + timescale = _movie_timescale(data, moov) + tracks = [item for item in child_atoms(data, moov) if item.type == b"trak"] + ids = [_track_id(data, item) for item in tracks] + video = next((item for item in tracks if _track_handler(data, item) == b"vide"), None) + if video is None: + raise ValueError("MOV 中没有可关联的视频轨") + video_track_id = _track_id(data, video) + metadata_track_id = max(ids, default=0) + 1 + cover_ticks = round(still_time * timescale) + max_tick = max(0, round(duration * timescale) - 1) + cover_ticks = min(max(0, cover_ticks), max_tick) + + prefix = b"".join(item.raw(data) for item in top if item.type not in {b"mdat", b"moov"}) + old_media = data[mdat.payload_start : mdat.end] + new_mdat = atom(b"mdat", old_media + TIMED_SAMPLE) + new_media_start = len(prefix) + (16 if new_mdat[:4] == b"\x00\x00\x00\x01" else 8) + delta = new_media_start - mdat.payload_start + sample_offset = new_media_start + len(old_media) + + patched_moov = patch_chunk_offsets(moov.raw(data), delta) + parsed_patched_moov = parse_atoms(patched_moov)[0] + patched = bytearray(patched_moov) + mvhd = first_child(patched, parsed_patched_moov, b"mvhd") + patched[mvhd.end - 4:mvhd.end] = struct.pack(">I", metadata_track_id + 1) + original_children = bytes(patched[parsed_patched_moov.payload_start : parsed_patched_moov.end]) + additions = _content_identifier_meta(identifier) + _timed_metadata_track( + metadata_track_id, + video_track_id, + timescale, + cover_ticks, + sample_offset, + max(1, round(timescale / fps)), + ) + new_moov = atom(b"moov", original_children + additions) + output.write_bytes(prefix + new_mdat + new_moov) + + +def _first_chunk_offset(data: bytes, trak: Atom) -> int: + mdia = first_child(data, trak, b"mdia") + minf = first_child(data, mdia, b"minf") if mdia else None + stbl = first_child(data, minf, b"stbl") if minf else None + if stbl is None: + raise ValueError("MOV 轨道缺少 sample table") + table = first_child(data, stbl, b"stco") or first_child(data, stbl, b"co64") + if table is None: + raise ValueError("MOV 轨道缺少 chunk offset") + count = int.from_bytes(data[table.payload_start + 4 : table.payload_start + 8], "big") + if count < 1: + raise ValueError("MOV chunk offset 为空") + width = 4 if table.type == b"stco" else 8 + start = table.payload_start + 8 + return int.from_bytes(data[start : start + width], "big") + + +def _cover_ticks(data: bytes, trak: Atom) -> int: + edts = first_child(data, trak, b"edts") + elst = first_child(data, edts, b"elst") if edts else None + if elst is None: + return 0 + version = data[elst.payload_start] + count = int.from_bytes(data[elst.payload_start + 4 : elst.payload_start + 8], "big") + position = elst.payload_start + 8 + if count >= 2: + if version == 0: + duration = int.from_bytes(data[position : position + 4], "big") + media_time = int.from_bytes(data[position + 4 : position + 8], "big", signed=True) + else: + duration = int.from_bytes(data[position : position + 8], "big") + media_time = int.from_bytes(data[position + 8 : position + 16], "big", signed=True) + if media_time == -1: + return duration + return 0 + + +def inspect_live_mov(path: Path) -> LiveMovInfo: + data = path.read_bytes() + _top, _ftyp, _mdat, moov = _top_required(data) + timescale = _movie_timescale(data, moov) + # Parse the generated QuickTime meta instead of matching an unrelated UUID. + metas = [a for a in child_atoms(data, moov) if a.type == b"meta"] + values = [] + for meta in metas: + keys = first_child(data, meta, b"keys") + ilst = first_child(data, meta, b"ilst") + if keys is None or ilst is None: + continue + expected = _fullbox() + struct.pack(">I", 1) + struct.pack(">I4s", 8 + len(CONTENT_KEY), b"mdta") + CONTENT_KEY + if data[keys.payload_start:keys.end] != expected: + continue + entry = first_child(data, ilst, b"\x00\x00\x00\x01") + value = first_child(data, entry, b"data") if entry else None + if value and data[value.payload_start:value.payload_start+8] == struct.pack(">II", 1, 0): + values.append(_canonical_asset_id(data[value.payload_start+8:value.end].decode("ascii"))) + if len(values) != 1: + raise ValueError("MOV must contain one exact content identifier") + identifier = values[0] + tracks = [item for item in child_atoms(data, moov) if item.type == b"trak"] + video = next((item for item in tracks if _track_handler(data, item) == b"vide"), None) + metadata = next( + ( + item + for item in tracks + if _track_handler(data, item) == b"meta" + and STILL_TIME_KEY in item.raw(data) + ), + None, + ) + if video is None or metadata is None: + raise ValueError("MOV 缺少视频轨或 still-image-time 元数据轨") + metadata_offset = _first_chunk_offset(data, metadata) + if data[metadata_offset : metadata_offset + 8] != TIMED_SAMPLE[:8]: + raise ValueError("MOV still-image-time sample 结构无效") + value = struct.unpack("b", data[metadata_offset + 8 : metadata_offset + 9])[0] + return LiveMovInfo( + asset_id=identifier, + still_time=_cover_ticks(data, metadata) / timescale, + video_track_id=_track_id(data, video), + metadata_track_id=_track_id(data, metadata), + video_chunk_offset=_first_chunk_offset(data, video), + metadata_chunk_offset=metadata_offset, + sample_value=value, + ) diff --git a/source/studio/portable_live_photo/iso_bmff.py b/source/studio/portable_live_photo/iso_bmff.py new file mode 100644 index 0000000000000000000000000000000000000000..a4634395a1191aad17d4fdd7da344d347ae29061 --- /dev/null +++ b/source/studio/portable_live_photo/iso_bmff.py @@ -0,0 +1,125 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2026 杨振 +from __future__ import annotations + +import struct +from dataclasses import dataclass + + +CONTAINER_TYPES = { + b"moov", + b"trak", + b"mdia", + b"minf", + b"dinf", + b"stbl", + b"edts", + b"tref", + b"gmhd", + b"udta", + b"ilst", +} + + +@dataclass(frozen=True, slots=True) +class Atom: + start: int + size: int + type: bytes + header_size: int = 8 + + @property + def end(self) -> int: + return self.start + self.size + + @property + def payload_start(self) -> int: + return self.start + self.header_size + + def raw(self, data: bytes | bytearray) -> bytes: + return bytes(data[self.start : self.end]) + + +def atom(kind: bytes, payload: bytes) -> bytes: + if len(kind) != 4: + raise ValueError("ISO-BMFF atom 类型必须是 4 字节") + size = len(payload) + 8 + if size <= 0xFFFFFFFF: + return struct.pack(">I4s", size, kind) + payload + return struct.pack(">I4sQ", 1, kind, len(payload) + 16) + payload + + +def parse_atoms(data: bytes | bytearray, start: int = 0, end: int | None = None) -> list[Atom]: + boundary = len(data) if end is None else end + if start < 0 or boundary > len(data) or start > boundary: + raise ValueError("ISO-BMFF 解析范围无效") + result: list[Atom] = [] + position = start + while position < boundary: + if position + 8 > boundary: + raise ValueError("ISO-BMFF atom 头部不完整") + size = int.from_bytes(data[position : position + 4], "big") + kind = bytes(data[position + 4 : position + 8]) + header = 8 + if size == 1: + if position + 16 > boundary: + raise ValueError("ISO-BMFF 64 位 atom 头部不完整") + size = int.from_bytes(data[position + 8 : position + 16], "big") + header = 16 + elif size == 0: + size = boundary - position + if size < header or position + size > boundary: + label = kind.decode("latin-1", errors="replace") + raise ValueError(f"ISO-BMFF atom {label} 超出文件边界") + result.append(Atom(position, size, kind, header)) + position += size + return result + + +def child_atoms(data: bytes | bytearray, parent: Atom) -> list[Atom]: + return parse_atoms(data, parent.payload_start, parent.end) + + +def first_child(data: bytes | bytearray, parent: Atom, kind: bytes) -> Atom | None: + return next((item for item in child_atoms(data, parent) if item.type == kind), None) + + +def walk_atoms(data: bytes | bytearray, parent: Atom) -> list[Atom]: + found: list[Atom] = [] + for item in child_atoms(data, parent): + found.append(item) + if item.type in CONTAINER_TYPES: + found.extend(walk_atoms(data, item)) + return found + + +def patch_chunk_offsets(moov: bytes, delta: int) -> bytes: + """Shift every stco/co64 entry in a complete moov atom by a constant.""" + payload = bytearray(moov) + top = parse_atoms(payload) + if len(top) != 1 or top[0].type != b"moov": + raise ValueError("需要一个完整的 moov atom") + + def visit(parent: Atom) -> None: + for item in child_atoms(payload, parent): + if item.type in {b"stco", b"co64"}: + count_at = item.payload_start + 4 + if count_at + 4 > item.end: + raise ValueError("MOV chunk offset 表不完整") + count = int.from_bytes(payload[count_at : count_at + 4], "big") + width = 4 if item.type == b"stco" else 8 + entries = count_at + 4 + if entries + count * width > item.end: + raise ValueError("MOV chunk offset 条目超出 atom") + for index in range(count): + position = entries + index * width + old = int.from_bytes(payload[position : position + width], "big") + new = old + delta + if new < 0 or new >= 1 << (width * 8): + raise ValueError("MOV chunk offset 调整后越界") + payload[position : position + width] = new.to_bytes(width, "big") + elif item.type in CONTAINER_TYPES: + visit(item) + + visit(top[0]) + return bytes(payload) diff --git a/source/studio/render.py b/source/studio/render.py new file mode 100644 index 0000000000000000000000000000000000000000..fd579dc6072993ab68cb0c759e0cd59835238e57 --- /dev/null +++ b/source/studio/render.py @@ -0,0 +1,496 @@ +"""Render one 'what's this in English?' Live Photo clip: cover.jpg + motion.mp4 (H.264 + AAC).""" +import json, math, os, subprocess, sys +import numpy as np +from PIL import Image, ImageDraw, ImageFilter, ImageFont + +sys.path.insert(0, os.path.dirname(__file__)) +import audio as A + +W, H, FPS = 1080, 1440, 30 +COVER_F = 6 +FD = '/tmp/work/fonts' +F_SC = f'{FD}/NotoSansSC.ttf' +F_SS = f'{FD}/ss/SmileySans-Oblique.ttf' +F_POP = f'{FD}/Poppins-ExtraBold.ttf' +F_POP_SB = f'{FD}/Poppins-SemiBold.ttf' +F_NS = f'{FD}/NotoSans.ttf' + +INK = (22, 22, 28) +ACCENT = (255, 59, 92) +YELLOW = (255, 214, 61) +GREEN = (34, 197, 94) +CONFETTI = [(255, 59, 92), (255, 214, 61), (61, 220, 151), (77, 150, 255), (255, 138, 61), (181, 124, 255)] + +_fc = {} + + +def font(path, size, wght=None): + size = max(6, int(round(size))) + key = (path, size, wght) + if key not in _fc: + f = ImageFont.truetype(path, size) + if wght is not None: + axes = f.get_variation_axes() + vals = [] + for ax in axes: + n = ax['name'].decode() if isinstance(ax['name'], bytes) else ax['name'] + vals.append(wght if n == 'Weight' else ax['default']) + f.set_variation_by_axes(vals) + _fc[key] = f + return _fc[key] + + +# ---------- easing ---------- +def clamp(x, a=0.0, b=1.0): + return max(a, min(b, x)) + + +def prog(t, t0, d): + return clamp((t - t0) / d) if d > 0 else float(t >= t0) + + +def ease_out_cubic(x): + return 1 - (1 - x) ** 3 + + +def ease_in_out(x): + return 4 * x ** 3 if x < .5 else 1 - (-2 * x + 2) ** 3 / 2 + + +def ease_out_back(x, s=1.9): + return 1 + (s + 1) * (x - 1) ** 3 + s * (x - 1) ** 2 + + +def lerp(a, b, x): + return a + (b - a) * x + + +# ---------- drawing helpers ---------- +def rrect_mask(w, h, r, ss=3): + m = Image.new('L', (w * ss, h * ss), 0) + ImageDraw.Draw(m).rounded_rectangle((0, 0, w * ss - 1, h * ss - 1), r * ss, fill=255) + return m.resize((w, h), Image.LANCZOS) + + +def text_w(s, f): + return f.getlength(s) + + +class Clip: + def __init__(self, item, index, total, photo_path, out_dir): + self.it = item + self.idx = index + self.out = out_dir + os.makedirs(out_dir, exist_ok=True) + self.word = item['en'] + self.CW = 920 + self.cy = item.get('card_y', 720) + self.prepare_photo(photo_path) + self.prepare_audio() + self.prepare_layout() + rng = np.random.default_rng(int(item['id']) * 7 + 1) + self.grain = [rng.normal(0, 2.6, (H, W)).astype(np.float32) for _ in range(3)] + self.particles = self.make_particles(rng) + + # ----- photo ----- + def prepare_photo(self, path): + src = Image.open(path).convert('RGB') + sw, sh = src.size + target = W / H + if sw / sh > target: # crop width + nw = int(sh * target); x0 = (sw - nw) // 2; src = src.crop((x0, 0, x0 + nw, sh)) + else: + nh = int(sw / target); y0 = (sh - nh) // 2; src = src.crop((0, y0, sw, y0 + nh)) + S = 1.12 + big = src.resize((int(W * S), int(H * S)), Image.LANCZOS) + if src.width < W * S: + big = big.filter(ImageFilter.UnsharpMask(radius=2.0, percent=60, threshold=2)) + else: + big = big.filter(ImageFilter.UnsharpMask(radius=1.2, percent=35, threshold=3)) + self.big = big + self.S = S + + def camera(self, t): + z = 1.0 + 0.05 * ease_in_out(clamp(t / max(self.dur, 0.1))) + dx = 5.0 * math.sin(2 * math.pi * 0.31 * t) + 2.2 * math.sin(2 * math.pi * 0.87 * t + 1.1) + dy = 4.0 * math.sin(2 * math.pi * 0.23 * t + 0.4) - 4.0 * math.sin(0.4) + 1.8 * math.sin(2 * math.pi * 0.71 * t) + bw, bh = self.big.size + vw, vh = bw / (1.06 * z), bh / (1.06 * z) + cx, cy = bw / 2 + dx, bh / 2 + dy + a = vw / W + e = vh / H + frame = self.big.transform((W, H), Image.AFFINE, (a, 0, cx - vw / 2, 0, e, cy - vh / 2), resample=Image.BICUBIC) + return frame + + # ----- audio & timeline ----- + def typed_indices(self): + return [i for i, c in enumerate(self.word) if c != ' '] + + def typing_dt(self, n): + return clamp(0.40 / max(n, 1), 0.035, 0.07) + + MAX_DUR = 3.0 # WeChat Moments only accepts Live Photos of about 3 s (native iPhone length) + + def prepare_audio(self): + say = self.it.get('tts', self.word) + en1 = A.tts(f"{say}.", 'en-US-AvaMultilingualNeural', rate='-5%') + self.typed = self.typed_indices() + n = len(self.typed) + T = {} + T['rev'] = 0.35 + T['grow_d'] = 0.35 + T['type0'] = 0.50 + T['dt'] = self.typing_dt(n) + T['done'] = T['type0'] + (n - 1) * T['dt'] + 0.10 + T['marker'] = T['done'] + 0.03 + T['ipa'] = T['done'] + 0.08 + T['en1'] = T['done'] + 0.10 + d1 = len(en1) / A.SR + T['mean'] = T['en1'] + d1 * 0.5 + T['sweep'] = T['done'] + 0.25 + en2 = None + for rate in ('-22%', '-10%', '+0%', '+10%'): + cand = A.tts(f"{say}.", 'en-US-AndrewMultilingualNeural', rate=rate) + if T['en1'] + d1 + 0.10 + len(cand) / A.SR + 0.10 <= self.MAX_DUR: + en2 = cand + break + if en2 is not None: + T['en2'] = T['en1'] + d1 + 0.10 + T['end'] = self.MAX_DUR + else: + T['en2'] = None + T['end'] = min(self.MAX_DUR, max(T['en1'] + d1 + 0.25, T['mean'] + 0.6)) + nf = int(math.ceil(T['end'] * FPS)) + self.nf = nf + self.dur = nf / FPS + self.T = T + mx = A.Mixer(self.dur) + mx.add(A.whoosh(), T['rev'] - 0.06, 0.9) + for k, li in enumerate(self.typed): + pan = (li / max(len(self.word) - 1, 1)) * 1.2 - 0.6 + mx.add(A.tick(k), T['type0'] + k * T['dt'], 0.9, pan) + mx.add(A.chime(), T['done'], 0.85) + mx.add(A.shimmer(), T['done'] + 0.1, 1.0) + mx.add(A.pop(), T['ipa'], 0.7) + mx.add(en1, T['en1'], 1.0) + mx.add(A.pop(), T['mean'], 0.5) + if en2 is not None: + mx.add(en2, T['en2'], 1.0) + self.wav = os.path.join(self.out, 'audio.wav') + mx.render(self.dur, self.wav) + env = np.zeros(nf + 2) + for clip, st in ((en1, T['en1']), (en2, T['en2'])): + if clip is None: + continue + e = A.envelope(clip, FPS) + s = int(round(st * FPS)) + n2 = min(len(e), len(env) - s) + env[s:s + n2] = np.maximum(env[s:s + n2], e[:n2]) + self.env = np.convolve(env, [0.25, 0.5, 0.25], mode='same') + + # ----- layout ----- + CHQ, CHA = 252, 452 + + def prepare_layout(self): + CW = self.CW + word = self.word + size = 124 + while text_w(word, font(F_POP, size)) > CW - 120: + size -= 2 + self.wsize = size + fw = font(F_POP, size) + tw = text_w(word, fw) + x0 = (CW - tw) / 2 + self.word_x0, self.word_w = x0, tw + self.final_cx = [x0 + text_w(word[:i], fw) + text_w(c, fw) / 2 for i, c in enumerate(word)] + hs = 84 + while text_w(f"「{self.it['zh']}」用英语怎么说?", font(F_SS, hs)) > CW - 110 and hs > 40: + hs -= 2 + self.hsize = hs + self._masks, self._shadows = {}, {} + self.shadow_pad = 90 + bd = np.zeros((self.CHA * 2, 260), np.float32) + bd[:] = np.exp(-(np.linspace(-1, 1, 260) ** 2) * 4.5) * 120 + self.band = Image.fromarray(bd.astype(np.uint8)).rotate(-18, resample=Image.BICUBIC, expand=True) + + def mask_for(self, w, h, r): + k = (w, h, r) + if k not in self._masks: + self._masks[k] = rrect_mask(w, h, r) + return self._masks[k] + + def shadow_for(self, w, h, r): + k = (w, h, r) + if k not in self._shadows: + pad = self.shadow_pad + sh = Image.new('L', (w + pad * 2, h + pad * 2), 0) + ImageDraw.Draw(sh).rounded_rectangle((pad, pad, pad + w, pad + h), r, fill=110) + self._shadows[k] = sh.filter(ImageFilter.GaussianBlur(34)) + return self._shadows[k] + + def card_h(self, t): + T = self.T + return lerp(self.CHQ, self.CHA, ease_in_out(prog(t, T['rev'], T['grow_d']))) + + def make_particles(self, rng): + ps = [] + for k in range(46): + ang = rng.uniform(-math.pi * 0.95, -math.pi * 0.05) + sp = rng.uniform(650, 1500) + ps.append(dict(x=rng.uniform(-260, 260), y=rng.uniform(-30, 30), vx=math.cos(ang) * sp * 0.9, + vy=math.sin(ang) * sp, rot=rng.uniform(0, 360), vr=rng.uniform(-720, 720), + kind=rng.integers(0, 3), col=CONFETTI[k % len(CONFETTI)], sz=rng.uniform(9, 17), + delay=rng.uniform(0, 0.08))) + return ps + + # ----- card content ----- + def draw_pill(self, layer, t): + T = self.T + p = ease_in_out(prog(t, T['rev'] + 0.05, 0.25)) + f = font(F_SC, 28, 700) + y, h = 38, 54 + CW = self.CW + if p < 1: + txt = getattr(self, "pill_q", "在线求助") + w = 48 + text_w(txt, f) + 26 + x = (CW - w) / 2 + pl = Image.new('RGBA', layer.size, (0, 0, 0, 0)) + pd = ImageDraw.Draw(pl) + pd.rounded_rectangle((x, y, x + w, y + h), h / 2, fill=YELLOW + (255,)) + pd.ellipse((x + 20, y + h / 2 - 7, x + 34, y + h / 2 + 7), fill=ACCENT + (255,)) + if int(t * 2.2) % 2 == 0 or t >= T['rev']: + pd.ellipse((x + 16, y + h / 2 - 11, x + 38, y + h / 2 + 11), outline=ACCENT + (90,), width=3) + pd.text((x + 48, y + h / 2), txt, font=f, fill=INK + (255,), anchor='lm') + if p > 0: + pl.putalpha(pl.getchannel('A').point(lambda v: int(v * (1 - p)))) + layer.alpha_composite(pl) + if p > 0: + txt = getattr(self, "pill_a", "答案揭晓") + w = 54 + text_w(txt, f) + 26 + sc = 0.85 + 0.15 * ease_out_back(p) + pw, ph = int(w + 2), h + 2 + pl = Image.new('RGBA', (pw, ph), (0, 0, 0, 0)) + pd = ImageDraw.Draw(pl) + pd.rounded_rectangle((0, 0, w, h), h / 2, fill=GREEN + (255,)) + cx, cy = 30, h / 2 + pd.line([(cx - 9, cy + 1), (cx - 3, cy + 8), (cx + 10, cy - 8)], fill=(255, 255, 255, 255), width=5, joint='curve') + pd.text((54, h / 2), txt, font=f, fill=(255, 255, 255, 255), anchor='lm') + if sc != 1: + pl = pl.resize((max(1, int(pw * sc)), max(1, int(ph * sc))), Image.BICUBIC) + pl.putalpha(pl.getchannel('A').point(lambda v: int(v * p))) + layer.alpha_composite(pl, (int((CW - pl.width) / 2), int(y + (h - pl.height) / 2))) + + def content(self, t, fidx, ch): + T = self.T + CW = self.CW + layer = Image.new('RGBA', (CW, ch), (0, 0, 0, 0)) + d = ImageDraw.Draw(layer) + self.draw_pill(layer, t) + + # question headline + hp = ease_in_out(prog(t, T['rev'], 0.22)) + if hp < 1: + f = font(F_SS, self.hsize) + kw = f"「{self.it['zh']}」" + rest = "用英语怎么说?" + tw = text_w(kw + rest, f) + x = (CW - tw) / 2 + y = 167 - 34 * hp + al = int(255 * (1 - hp)) + d.text((x, y), kw, font=f, fill=ACCENT + (al,), anchor='lm') + d.text((x + text_w(kw, f), y), rest, font=f, fill=INK + (al,), anchor='lm') + + # word: letters type in at their final positions + row_y = 186 + mk = ease_out_cubic(prog(t, T['marker'], 0.32)) + if mk > 0: + mx0 = self.word_x0 - 14 + mw = (self.word_w + 28) * mk + yb = row_y + self.wsize * 0.22 + d.rounded_rectangle((mx0, yb - self.wsize * 0.26, mx0 + mw, yb + self.wsize * 0.06), 12, fill=YELLOW + (215,)) + for k, i in enumerate(self.typed): + c = self.word[i] + t_on = T['type0'] + k * T['dt'] + appear = prog(t, t_on, 0.16) + if appear <= 0: + continue + pop = ease_out_back(appear, 2.6) + size = self.wsize * (0.45 + 0.55 * pop) + wave = math.sin(clamp((t - T['done'] - k * 0.03) / 0.4) * math.pi) * 14 + base = row_y + self.wsize * 0.30 - wave - 26 * (1 - ease_out_cubic(appear)) + d.text((self.final_cx[i], base), c, font=font(F_POP, size), fill=INK + (int(255 * min(1, appear * 1.8)),), anchor='ms') + + # IPA row + ip = ease_out_cubic(prog(t, T['ipa'], 0.32)) + if ip > 0: + fi = font(F_NS, 46, 500) + ipa = self.it['ipa'] + iw = text_w(ipa, fi) + icon = 62 + x0 = (CW - (icon + 20 + iw)) / 2 + y = 306 + 26 * (1 - ip) + al = int(255 * ip) + env = float(self.env[min(fidx, len(self.env) - 1)]) + r = icon / 2 * (1 + 0.10 * env) + icx = x0 + icon / 2 + if env > 0.05: + rr = icon / 2 + 6 + 16 * env + d.ellipse((icx - rr, y - rr, icx + rr, y + rr), outline=ACCENT + (int(110 * env * ip),), width=3) + d.ellipse((icx - r, y - r, icx + r, y + r), fill=ACCENT + (al,)) + bx = icx - 13 + d.polygon([(bx, y - 6), (bx + 7, y - 6), (bx + 16, y - 14), (bx + 16, y + 14), (bx + 7, y + 6), (bx, y + 6)], + fill=(255, 255, 255, al)) + for k2, rad in enumerate((9, 16)): + aa = int(al * (0.55 + 0.45 * clamp(env * 2.2 - k2 * 0.5))) + cxa = bx + 15 + d.arc((cxa - rad, y - rad, cxa + rad, y + rad), -48, 48, fill=(255, 255, 255, aa), width=3) + d.text((x0 + icon + 20, y), ipa, font=fi, fill=(40, 40, 52, al), anchor='lm') + + # meaning row + mpn = ease_out_cubic(prog(t, T['mean'], 0.3)) + if mpn > 0: + al = int(255 * mpn) + fp_ = font(F_POP_SB, 28) + fz = font(F_SC, 38, 700) + pos, zh = self.it['pos'], self.it['zh'] + tagw = text_w(pos, fp_) + 26 + x0 = (CW - (tagw + 16 + text_w(zh, fz))) / 2 + y = 394 + 20 * (1 - mpn) + d.rounded_rectangle((x0, y - 21, x0 + tagw, y + 21), 10, fill=(22, 22, 28, int(al * 0.9))) + d.text((x0 + tagw / 2, y), pos, font=fp_, fill=(255, 255, 255, al), anchor='mm') + d.text((x0 + tagw + 16, y), zh, font=fz, fill=(30, 30, 40, al), anchor='lm') + + # glossy light sweep + swp = prog(t, T['sweep'], 0.55) + if 0 < swp < 1: + bx = int(lerp(-self.band.width, CW + 40, ease_in_out(swp))) + gl = Image.new('L', (CW, ch), 0) + gl.paste(self.band, (bx, -self.CHA // 2)) + m = self.mask_for(CW, ch, 46) + gl = Image.fromarray((np.asarray(gl, np.float32) * np.asarray(m, np.float32) / 255).astype(np.uint8)) + white = Image.new('RGBA', (CW, ch), (255, 255, 255, 0)) + white.putalpha(gl) + layer = Image.alpha_composite(layer, white) + return layer + + # ----- full frame ----- + def frame(self, fidx): + t = fidx / FPS + T = self.T + img = self.camera(t).convert('RGBA') + bump = math.sin(math.pi * prog(t, T['rev'], 0.32)) * 0.02 + math.sin(math.pi * prog(t, T['done'], 0.3)) * 0.024 + sc = self.it.get('card_scale', 1.0) * (1 + bump) + CW = self.CW + CH = int(round(self.card_h(t))) + cw, ch = int(round(CW * sc)), int(round(CH * sc)) + x0 = int(round(W / 2 - cw / 2)) + y0 = int(round(self.cy - ch / 2)) + rad = int(46 * sc) + shd = self.shadow_for(cw, ch, rad) + pad = self.shadow_pad + dark = Image.new('RGBA', shd.size, (10, 10, 20, 0)) + dark.putalpha(shd) + img.alpha_composite(dark, (x0 - pad, y0 - pad + 22)) + m = 50 + box = (max(0, x0 - m), max(0, y0 - m), min(W, x0 + cw + m), min(H, y0 + ch + m)) + reg = img.crop(box).convert('RGB') + small = reg.resize((max(1, reg.width // 6), max(1, reg.height // 6)), Image.BILINEAR).filter(ImageFilter.GaussianBlur(getattr(self, 'BLUR', 4))) + glass = small.resize(reg.size, Image.BICUBIC) + g = getattr(self, 'GLASS', 0.70) + ga = np.asarray(glass, np.float32) * (1 - g) + 255 * g + glass = Image.fromarray(ga.clip(0, 255).astype(np.uint8)).crop((x0 - box[0], y0 - box[1], x0 - box[0] + cw, y0 - box[1] + ch)) + glass = glass.convert('RGBA') + glass.putalpha(self.mask_for(cw, ch, rad)) + img.alpha_composite(glass, (x0, y0)) + rim = Image.new('RGBA', (cw, ch), (0, 0, 0, 0)) + ImageDraw.Draw(rim).rounded_rectangle((1, 1, cw - 2, ch - 2), rad, outline=(255, 255, 255, 200), width=2) + img.alpha_composite(rim, (x0, y0)) + layer = self.content(t, fidx, CH) + if sc != 1: + layer = layer.resize((cw, ch), Image.BICUBIC) + img.alpha_composite(layer, (x0, y0)) + # confetti + ct = t - (T['done'] + 0.03) + if 0 < ct < 1.6: + ov = Image.new('RGBA', (W, H), (0, 0, 0, 0)) + od = ImageDraw.Draw(ov) + ox, oy = W / 2, y0 + 186 * sc + for p in self.particles: + tt = ct - p['delay'] + if tt <= 0: + continue + drag = (1 - math.exp(-2.6 * tt)) / 2.6 + px = ox + p['x'] + p['vx'] * drag + py = oy + p['y'] + p['vy'] * drag + 0.5 * 1500 * tt * tt * 0.55 + life = clamp(1 - (tt - 0.75) / 0.6) + if life <= 0: + continue + al = int(255 * life) + s = p['sz'] + rot = math.radians(p['rot'] + p['vr'] * tt) + if p['kind'] == 0: # ribbon rect + pts = [(-s * 0.4, -s), (s * 0.4, -s), (s * 0.4, s), (-s * 0.4, s)] + flip = abs(math.cos(rot * 1.7)) * 0.8 + 0.2 + pts = [(px + (x * flip) * math.cos(rot) - y * math.sin(rot), py + (x * flip) * math.sin(rot) + y * math.cos(rot)) for x, y in pts] + od.polygon(pts, fill=p['col'] + (al,)) + elif p['kind'] == 1: # dot + od.ellipse((px - s * 0.5, py - s * 0.5, px + s * 0.5, py + s * 0.5), fill=p['col'] + (al,)) + else: # 4-point sparkle + r1, r2 = s * 0.95, s * 0.28 + pts = [] + for k in range(8): + rr = r1 if k % 2 == 0 else r2 + a = rot + k * math.pi / 4 + pts.append((px + rr * math.cos(a), py + rr * math.sin(a))) + od.polygon(pts, fill=(255, 255, 255, al) if p['col'] == CONFETTI[1] else p['col'] + (al,)) + img.alpha_composite(ov) + arr = np.asarray(img.convert('RGB'), np.float32) + arr += self.grain[fidx % 3][..., None] + return np.clip(arr, 0, 255).astype(np.uint8) + + def render(self): + mp4 = os.path.join(self.out, 'motion.mp4') + cmd = ['ffmpeg', '-v', 'error', '-y', '-f', 'rawvideo', '-pix_fmt', 'rgb24', '-s', f'{W}x{H}', '-r', str(FPS), '-i', '-', + '-i', self.wav, '-map', '0:v', '-map', '1:a', + '-c:v', 'libx264', '-preset', 'medium', '-crf', '18', '-profile:v', 'high', '-pix_fmt', 'yuv420p', + '-color_primaries', 'bt709', '-color_trc', 'bt709', '-colorspace', 'bt709', '-tag:v', 'avc1', + '-c:a', 'aac', '-b:a', '128k', '-ar', '44100', '-ac', '1', '-shortest', '-movflags', '+faststart', mp4] + proc = subprocess.Popen(cmd, stdin=subprocess.PIPE) + for i in range(self.nf): + fr = self.frame(i) + if i == COVER_F: + Image.fromarray(fr).save(os.path.join(self.out, 'cover.jpg'), quality=95, subsampling=0) + if i == self.nf - 1: + Image.fromarray(fr).save(os.path.join(self.out, 'final.jpg'), quality=90) + if i in getattr(self, 'snap', []): + Image.fromarray(fr).save(os.path.join(self.out, f'snap_{i:03d}.jpg'), quality=85) + proc.stdin.write(fr.tobytes()) + proc.stdin.close() + if proc.wait() != 0: + raise RuntimeError('ffmpeg failed') + json.dump({'frames': self.nf, 'fps': FPS, 'duration': self.dur, 'coverFrame': COVER_F, 'coverTime': COVER_F / FPS, + 'timeline': self.T}, open(os.path.join(self.out, 'render.json'), 'w'), indent=1) + return mp4 + + +if __name__ == '__main__': + items_file = os.environ.get('ITEMS', 'items.json') + items = json.load(open(os.path.join(os.path.dirname(__file__), items_file))) + want = sys.argv[1].split(',') if len(sys.argv) > 1 else [i['id'] for i in items] + picks = json.load(open('/tmp/work/picks.json')) if os.path.exists('/tmp/work/picks.json') else {} + for k, it in enumerate(items, 1): + if it['id'] not in want: + continue + photo = picks.get(it['id']) + if not photo and os.path.exists(f"/tmp/work/real/{it['id']}_pick.jpg"): + photo = f"/tmp/work/real/{it['id']}_pick.jpg" + if not photo: + for d in ('/tmp/work/zi', '/tmp/work/hf', '/tmp/work/raw'): + c_ = sorted(f for f in os.listdir(d) if f.startswith(it['id'] + '_')) if os.path.isdir(d) else [] + if c_: + photo = os.path.join(d, c_[0]); break + print('photo', photo) + c = Clip(it, k, len(items), photo, f"/tmp/work/out/{it['id']}") + c.snap = [int(x) for x in os.environ.get('SNAP', '').split(',') if x] + print(it['id'], it['en'], 'frames', c.nf, 'dur', round(c.dur, 2), flush=True) + c.render()