From a29918f31f9f5b13627936914b5f428ccac569a9 Mon Sep 17 00:00:00 2001 From: zhanglinghao Date: Mon, 23 Nov 2026 15:58:42 +0800 Subject: [PATCH 1/4] =?UTF-8?q?Studio=20=E5=AE=A1=E7=89=87=E9=A1=BA?= =?UTF-8?q?=E6=89=8B=E4=BA=86=EF=BC=9A=E6=84=8F=E8=A7=81=E9=92=89=E5=9C=A8?= =?UTF-8?q?=E4=BD=A0=E5=81=9C=E4=B8=8B=E7=9A=84=E5=9C=B0=E6=96=B9=EF=BC=8C?= =?UTF-8?q?=E6=94=BE=E5=A4=A7=E6=97=B6=E6=97=B6=E9=97=B4=E8=BD=B4=E8=B7=9F?= =?UTF-8?q?=E7=9D=80=E6=92=AD=E6=94=BE=E5=A4=B4=E8=B5=B0=EF=BC=8C"?= =?UTF-8?q?=E8=AE=B0=E4=B8=8B"=E7=82=B9=E4=B8=80=E6=AC=A1=E5=B0=B1?= =?UTF-8?q?=E6=88=90=EF=BC=8C=E5=88=86=E9=95=9C=E6=8C=89=E9=95=9C=E5=A4=B4?= =?UTF-8?q?=E7=BF=BB=EF=BC=8C=E9=95=BF=E6=AE=B5=E8=90=BD=E9=87=8C=E7=82=B9?= =?UTF-8?q?=E5=BE=97=E5=88=B0=E5=85=B7=E4=BD=93=E4=B8=80=E9=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changes/studio-review-feel.md | 9 ++ tools/ci.sh | 37 +++++++++ tools/desk/README.md | 6 +- tools/desk/static/core.js | 2 + tools/desk/static/modules.css | 10 ++- tools/desk/static/modules.js | 66 +++++++++++++-- tools/desk/static/studio.css | 20 ++++- tools/desk/static/studio.js | 136 +++++++++++++++++++++--------- tools/desk/test_cut_page.mjs | 137 ++++++++++++++++++++++++++++++ tools/desk/test_cut_page.py | 151 ++++++++++++++++++++++++++++++++++ tools/resolved.py | 28 ++++++- 11 files changed, 541 insertions(+), 61 deletions(-) create mode 100644 changes/studio-review-feel.md create mode 100644 tools/desk/test_cut_page.mjs create mode 100644 tools/desk/test_cut_page.py diff --git a/changes/studio-review-feel.md b/changes/studio-review-feel.md new file mode 100644 index 00000000..968cc8fe --- /dev/null +++ b/changes/studio-review-feel.md @@ -0,0 +1,9 @@ +**Studio 审片顺手了:意见钉在你停下的地方,放大时时间轴跟着播放头走,"记下"点一次就成,分镜按镜头翻,长段落里点得到具体一镜** +- Why: 用一支 12 分钟的片子在 Studio 里审初版时,时间轴的时间跟不上播放,放大以后播放头跑出画面,"记下"要点两次,分镜按"第 n 页"翻,成片里一点就是 80 多秒的一整段。 +- 成片的时间轴:点过某一秒再播放、暂停,意见框跟着落到停下的那一秒(以前还钉在点过的那一秒);时间轴上只留一根播放头的线。放大后播放时,播放头走到边上,时间轴就往后翻一页,自己横着滚过就不再跟,直到再按播放;最大能放到一秒约 100 像素,12 分钟的片子也看得清一镜、一句;横着滚时左边的轨名不动。标记分行放:没把握、请你听、检查发现的、我的意见各占一行,挨得太近的再错开一行,67 个点不再叠成一串。窗口在后台时,播放的时间照样往前走。 +- 片子只在人自己点播放、按空格时才放:打开一站、点窗口把它提到前面的那一下、页面自己的代码,都不会让它出声。 +- 意见框:按下"记下"时框不再缩回去,按钮不会从鼠标底下跑开,点一次就记下。框里 ↩ 换行,⌘↩(别处 Ctrl+↩)或按钮记下,这条规矩用字写在框下面(对话那一栏照旧是 ↩ 发送)。多行的意见在列表里照原样分行。 +- 不对着片子的话:意见框"对着"那一行多了"不对着片子",写下的话进整体意见,交出去时标着〔不对着片子〕,列表里没有时间、排在前面。对整片说的话也各占一行,标着〔整片〕。 +- 分镜:agent 按 6 镜一页切开的同一段("开场(1/2)""开场(2/2)")合回一页;页签写镜号和段名("S1–S13 开场"),不再是"第 n 页";← → 一镜一镜走,选中的那一镜亮起来,意见框对着它,小播放器跳到它,走到头进下一段。 +- 成片里点得到长段落里的一镜:用剪辑表做的片子,成片的渲染记录里本来记着每一段页面里的镜头;`bin/vh timeline --resolved` 给剪辑表的每一条加上 `inner`(里面的镜头,片子里的秒,切到这一条里面;渲染时用的不是这份剪辑表就不给,并说一声)。成片模块多一行"段落"放这些条目,镜头那一行画里面的镜头,点一下意见框写"镜头 S1_3(PROLOGUE 里)"。 +- 新检查 `tools/desk/test_cut_page.py`:在真的无头 Chrome 里,用一支 12 分 20 秒、67 个标记点的编造片子,真鼠标、真按键把上面这些走一遍(`tools/ci.sh` 的 console 组);`timeline --resolved` 的那组加了剪辑表条目里镜头的用例。 diff --git a/tools/ci.sh b/tools/ci.sh index 2683bb4c..e79967fd 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -4470,6 +4470,18 @@ PY kill "$desk_pid"; wait "$desk_pid" 2>/dev/null fi rm -rf "$t" + # the cut page and the note box on a 12-minute made-up film with 67 marked places, in a real headless Chrome that may play + # unasked as Studio's window may (tools/desk/test_cut_page.py builds the films and their desk; real mouse presses and keys) + local cb rc + if ! cb=$(chrome_path); then no_chrome "the cut page in a browser" + else + a=$(python3 tools/desk/test_cut_page.py "$cb" 2>&1); rc=$? + case $rc in + 0) ok "the cut page in a browser, on a 12-minute film: opening a stop or a click from code plays nothing; a second picked and played on, the note goes where the picture stopped, one line; zoomed in, about 100 px a second, the playhead in sight while it plays and the lanes' names kept; 67 marked places, no pin on another; ↩ a new line, one press of 记下 keeps the note (the button stays put), Ctrl+↩ too, the keys in words; a note not about the film goes marked; the storyboard a tab a part (its sheets joined) named by its shots, ← → shot by shot; an edit list's part shows the shots inside it to point at" ;; + 3) skip "the cut page in a browser" "no ffmpeg" ;; + *) bad "the cut page in a browser: $(printf '%s' "$a" | tr '\n' ';' | head -c 1500)" ;; + esac + fi } studio_checks() { # bin/vh studio (tools/desk/studio.py, window.py) and its launcher icon, as a person meets them: in a temp # HOME and TMPDIR (no console or window of this machine's is found or touched), the stand-in window, no screen needed. @@ -9167,6 +9179,31 @@ sys.exit(0 if ok else 1) PY then ok "timeline --resolved on an edit list: shots, narration, captions and beats in seconds and frames, with each source's sha256; it takes bin/vh edit build's record while that is of this edit.json, the same code in memory with none; it writes nothing" else bad "timeline --resolved on an edit list (exit $rc, $c): $(printf '%s' "$a" | tail -c 500)"; fi + # the shots inside an edit list's entries, as the film's render kept them (., film seconds): each entry carries its own, + # cut to it; a render of another edit.json gives none, and says so + mkdir -p "$p/out"; printf 'x' > "$p/out/final.mp4" + python3 - "$p" <<'PY' +import hashlib, json, sys +p = sys.argv[1]; sha = hashlib.sha256(open(f"{p}/edit.json", "rb").read()).hexdigest() +shots = [{"id": "S01", "start": 0, "end": 1.0333, "kind": "color"}, {"id": "S01.A", "start": 0, "end": 0.4, "kind": "shot"}, {"id": "S01.B", "start": 0.4, "end": 1.5, "kind": "shot"}, + {"id": "S02", "start": 1.0333, "end": 2.5333, "kind": "color"}] +json.dump({"fps": 30, "frames": 91, "edit": {"path": "edit.json", "sha256": sha}, "shots": shots}, open(f"{p}/out/final.mp4.render.json", "w")) +PY + a=$(vh timeline "$p" --resolved --json 2>&1); rc=$? + python3 -c 'import json, sys; f = sys.argv[1]; d = json.load(open(f)); d["edit"]["sha256"] = "0" * 64; json.dump(d, open(f, "w"))' "$p/out/final.mp4.render.json" + b=$(vh timeline "$p" --resolved --json 2>&1); c=$? + rm -f "$p/out/final.mp4" "$p/out/final.mp4.render.json" + if [ "$rc:$c" = 0:0 ] && python3 - "$a" "$b" <<'PY' +import json, sys +a, b = json.loads(sys.argv[1]), json.loads(sys.argv[2]) +s = a["shots"] +ok = [x["id"] for x in s] == ["S01", "S02", "S03"] and "inner" not in s[1] and "inner" not in s[2] +ok = ok and [(x["id"], x["start"], x["start_frame"], x["end_frame"]) for x in s[0]["inner"]] == [("S01.A", 0, 0, 12), ("S01.B", 0.4, 12, 31)] and s[0]["inner"][1]["end"] == s[0]["end"] +ok = ok and not any("inner" in x for x in b["shots"]) and any("another edit.json" in m["why"] for m in b["missing"]) and not a["missing"] +sys.exit(0 if ok else 1) +PY + then ok "timeline --resolved on an edit list: each entry carries the shots inside it as its film's render kept them, cut to the entry; a render of another edit.json gives none, said" + else bad "timeline --resolved, the shots inside an edit list's entries (exit $rc, $c): $(printf '%s' "$a" | tail -c 600)"; fi # a record of another edit.json is not taken; one that does not resolve is said, and the rest is there python3 -c 'import json, sys; f = sys.argv[1]; d = json.load(open(f)); d["fps"] = 30; d["tracks"][0]["entries"][1]["dur"] = 2; json.dump(d, open(f, "w"))' "$p/edit.json" a=$(vh timeline "$p" --resolved --json 2>&1 | python3 -c 'import json, sys; d = json.load(sys.stdin); print(d["shots"][1]["end_frame"], d["shots"][0].get("label"))' 2>&1) diff --git a/tools/desk/README.md b/tools/desk/README.md index b9d6d0af..a7a3a8ad 100644 --- a/tools/desk/README.md +++ b/tools/desk/README.md @@ -74,17 +74,17 @@ bin/vh desk agents install # 装那一家的 ACP 适配器 - **模板里没填的不算写了**:BRIEF、NOTES 里原样留着的模板占位(整格只是一个 `{…}`,比如 `{the story in one sentence: …}`)当成还没写:立意、故事线、素材清单的那一行、大纲那一段都不显示,立意页写"立意卡还没出来,立意也还没写",底下一条写"立意还没定",大纲页写"大纲还没写";不会把刚 `bin/vh new` 出来的片子说成已经定了什么。 - **立意**:左边是 NOTES.md 素材清单里只属于这个题目的东西,按数字、物件、原话、矛盾、意外分组,和「点子」里那条同题的视频常见的样子;右边是最新一页关卡 ① 的立意卡(带画面的那件决定),各配一帧。关卡 ① 开着时,"选这张"就是这一轮的决定,和右栏同步;"再想一张像它的"要 agent,这一版把这半句话放进写点评的框。还没有关卡 ① 的页时,显示 BRIEF 写下的立意。 - **大纲**:BRIEF 大纲表按时长比例的段落条和段落卡(要看懂什么、画面、几处没把握),旁边是 BRIEF 的立意、主线、在哪看、规格这些行,和引擎、配音、已花、预算、停在哪。页签:大纲 · 字幕 / 旁白 · 事实(后两个是原来审阅台的视图)。 - - **分镜**:有关卡 ② 的页时,照那一页排:一个段落一页,段落的编号、时间和备注,每镜看到什么、旁白、没把握的(关卡页的 `least_sure`,`S04` 和 `S4` 算同一镜)、默认改什么,段落的配图;人审的是 agent 送来的那一页,所以那一页有的这里都有,`shots.json` 只补那一页没给的画面和时间。没有关卡 ② 的页时,`shots.json` 的镜头按大纲的段落分页,每镜写着 reads 和转场,没把握的是 `unsure`。有灰盒 animatic(`shots.json` 的 `video`,`out/animatic.mp4`、`out/draft.mp4`)就播这一页那一段,点一镜播那一镜;不在的文件写明不在,不去请求。其余默认通过。 + - **分镜**:有关卡 ② 的页时,照那一页排:一个段落一页,段落的编号、时间和备注,每镜看到什么、旁白、没把握的(关卡页的 `least_sure`,`S04` 和 `S4` 算同一镜)、默认改什么,段落的配图;人审的是 agent 送来的那一页,所以那一页有的这里都有,`shots.json` 只补那一页没给的画面和时间。没有关卡 ② 的页时,`shots.json` 的镜头按大纲的段落分页,每镜写着 reads 和转场,没把握的是 `unsure`。有灰盒 animatic(`shots.json` 的 `video`,`out/animatic.mp4`、`out/draft.mp4`)就播这一页那一段,点一镜播那一镜;不在的文件写明不在,不去请求。其余默认通过。人按段落和镜头想,不按页:agent 按 `bin/vh storyboard` 的 6 镜一张把一段切成"开场(1/2)""开场(2/2)"时,这里合回一段;页签写镜号和段名("S1–S13 开场"),`←` `→` 一镜一镜走(选中那一镜,写意见的框对着它,小播放器跳到它),走到头进下一段。 - **声音**:四个读数:响度、真峰值(最近一次 `bin/vh check` 的 `check.loudness`),语速(`bin/vh pace` 写进旁白时间轴的 `pace`,只算有声的部分;没跑过 pace 时按句首到句尾算,写明含句中停顿),数字静音(`check.silence` 的条数)。试听音色(最新的 `audition.json`,`bin/vh voices audition` 写的;旁白用的那个标"在用"),旁白逐句的语速和句后停顿(比中位数快或慢得多的标出来),然后是两条时间,不混着画:成片的时间上是成片的响度(`bin/vh peaks`)、这一轮请你听的地方和检查里关于声音的问题,点一下从成片那一秒播(听的是混好的声音);配乐的时间上是它的段落、候选落点(`bin/vh beats` 的 lifts)和计划的音效,点一下从配乐那一秒播。缺哪样就说缺,写上做它的命令,不画空图。换音色、重念要 agent,这一版写成点评。 - **交付**:竖横封面(PACKAGING.md 封面表的原图,`out/covers/`、`out/final/covers/`);各平台的标题、简介、标签(PACKAGING.md 的「发布文案」,和 `bin/vh check` 量长度时读的是同一份,`tools/packcheck.py`),章节,标题候选和里面的事实核过没有;会出什么(母版、上传用的副本、字幕、封面、各平台文案,各自出了没有);出片前检查按类归组(安全框和字号、字被光烧白、响度、静音闪白黑场冻帧、许可、文案)。页签:交付 · 检查 · 版本。 - **素材**:素材台账(`assets/ledger.json`)的每一件:许可(`Assets: strict` 收下的是绿,生成的是紫,其余琥珀,标"许可没清")、来源、用在哪一镜、文件在不在;`research/refs.json` 的参考,和 `bin/vh ref digest` 读成的文稿(`research/digest//transcript.md`),点开就是那个文件。按类筛(什么都没有时不摆筛选)。没有 `assets/ledger.json` 的老项目,读 NOTES.md 里旧模板的「素材台账」表(文件、来源、许可三列,2026-10-26 以前的模板带着它),只读列出,写明来自 NOTES.md;登记进台账才查许可、出署名。登记要 `bin/vh assets add`、`bin/vh ref add`,这一版不接 agent。 - **账本**:DECISIONS.md 的决定表和 agent 定的事:谁定的、什么时候、为什么(人定的那几件附 REVIEW.md 那一关的原话);agent 定的每一条有"翻案",这一版写成点评。你的原话(REVIEW.md 逐字记的),`bin/vh versions` 的每一版改了什么。页签:决定 · 历史 · 文档。 - **新建**:模块栏里的"新建"回到空间,右边一列给一个空的写一句话的框(见下面"agent 那一列"的"从空间开一支新片子")。 - **点评对着什么**:有 target 的(`card:`、`seg:`、`shot:`、`fact:`、`asset:`、`led:`、`doc:`、`range:`、`atime:`、`time:`、`concept:line`)照 target 记;没有 target 的(一个读数、一个音色、BRIEF 的一行、一条检查)记进这一轮的整体意见,前面带上它的名字,比如 `〔声音 · LOUDNESS〕`。页面只做 `feedback.py` 收得下的 target 和标签:控制字符去掉,太长的名字截短,项目外的路径和倒着的时段不当 target(它们记进整体意见);提交前再查一遍,收不下的那几条列在提交单上、不发,不会让整轮被拒。反馈文件的格式不变。 -- **成片模块**(提案第 4 节):左边是列表(镜头、旁白稿、点评、检查),中间是画面:四周中性灰,上面一行等宽字的读数(哪一镜、要看懂什么、尺寸、帧率、第几版;这一版没有声音时,读数里写着“这一版没有声音”);播放键旁边有静音和音量,浏览器记住;左边和中间的下面是时间线,三组轨道:画面(章节、带缩略图的镜头)、声音(旁白、音乐的段落和节拍、卡点、波形)、审阅(你的点评,agent 没把握和请你听的记号,检查查出的问题,这一版改了哪里)。点一下选这一秒,拖一下选一段,点镜头或章节选中它;`I` `O` 设入点出点,拖的时候吸附到镜头边界、节拍、旁白和记号,`N` 跳到下一处要看的,空格播放(选了一段就只播这一段),`←` `→` 逐镜(选中那一镜,和点它一样:写点评的框跟着换),`,` `.` 逐帧、`Shift` `←` `→` 一秒一秒走(选着的是一秒时,那一秒跟着走),`C` 在这一秒写一条。三种布局:审片(画面最大,只留主轨道;关卡 ③ 打开就是它)、精修、听声音(旁白稿和声音轨道放大,波形最高,按全片最响的地方画满)。窄屏(手机)上先是画面,接着是右边一列(要你定的、提交),再是时间线,列表在最后。有留着的上一版时,可以和它擦着对比(只看)。数据都来自已有的命令:`bin/vh timeline --resolved`(镜头、章节、旁白、节拍)、`bin/vh thumbs`(拖动时每一秒的画面、镜头图)、`bin/vh peaks`(波形)、`bin/vh check`(问题和它们的时间)、`bin/vh versions`(第几版、改了哪里、上一版);缺哪样,那条轨道就照实说空,写上做它的命令。没有成片时,画面是分镜的关键帧,没有关键帧就是联系表;要的那支片子不在了(移走、改名、在别的硬盘上),画面下写明是哪个文件。页面从不请求不在的文件:关卡页里引用的文件不在了,那里写"文件不在了",不给链接;镜头的关键帧不在,就当没有。 +- **成片模块**(提案第 4 节):左边是列表(镜头、旁白稿、点评、检查),中间是画面:四周中性灰,上面一行等宽字的读数(哪一镜、要看懂什么、尺寸、帧率、第几版;这一版没有声音时,读数里写着“这一版没有声音”);播放键旁边有静音和音量,浏览器记住;左边和中间的下面是时间线,三组轨道:画面(章节、带缩略图的镜头)、声音(旁白、音乐的段落和节拍、卡点、波形)、审阅(你的点评,agent 没把握和请你听的记号,检查查出的问题,这一版改了哪里)。点一下选这一秒,拖一下选一段,点镜头或章节选中它;`I` `O` 设入点出点,拖的时候吸附到镜头边界、节拍、旁白和记号,`N` 跳到下一处要看的,空格播放(选了一段就只播这一段),`←` `→` 逐镜(选中那一镜,和点它一样:写点评的框跟着换),`,` `.` 逐帧、`Shift` `←` `→` 一秒一秒走(选着的是一秒时,那一秒跟着走),`C` 在这一秒写一条。剪辑软件的规矩:点哪,播放头就到哪;拖是拖着看;`Shift` + 拖选一段。选着的是一秒时,播放、暂停以后它跟到停下的那一秒(写意见的框也跟着),时间线上只有播放头一根线;选着一段、一镜时不动。放大最多到一秒约 100 像素(长片也看得清一镜、一句),放大后播放,播放头走到边上,时间线往后翻一页;自己横着滚过就不再跟,直到再按播放。横着滚时轨道名不动。审阅那组的记号一种一行(没把握、请你听、检查查出的、你的点评),挨得太近的再错开一行,几十个也不叠在一起。用剪辑表做的片子,成片的渲染记录里有每段页面里的镜头(`bin/vh timeline --resolved` 的 `inner`):多一行"段落"放剪辑表的条目,镜头那一行画里面的镜头,点得到"S1_3(PROLOGUE 里)"。片子只在人自己点播放、按空格时才放:打开一站、点窗口把它提到前面的那一下、页面的代码都不会让它出声。三种布局:审片(画面最大,只留主轨道;关卡 ③ 打开就是它)、精修、听声音(旁白稿和声音轨道放大,波形最高,按全片最响的地方画满)。窄屏(手机)上先是画面,接着是右边一列(要你定的、提交),再是时间线,列表在最后。有留着的上一版时,可以和它擦着对比(只看)。数据都来自已有的命令:`bin/vh timeline --resolved`(镜头、章节、旁白、节拍)、`bin/vh thumbs`(拖动时每一秒的画面、镜头图)、`bin/vh peaks`(波形)、`bin/vh check`(问题和它们的时间)、`bin/vh versions`(第几版、改了哪里、上一版);缺哪样,那条轨道就照实说空,写上做它的命令。没有成片时,画面是分镜的关键帧,没有关键帧就是联系表;要的那支片子不在了(移走、改名、在别的硬盘上),画面下写明是哪个文件。页面从不请求不在的文件:关卡页里引用的文件不在了,那里写"文件不在了",不给链接;镜头的关键帧不在,就当没有。 - **右边一列**:这一轮要你定的事(关卡页的选项卡,能点,推荐的预先选上,`1`–`9` 给当前这件选第几个),它最没把握的和请你听的(点一下到那一秒),你的意见(点一下回到那一处,× 删掉),下一步、正在跑的命令和花费(`bin/vh status` 写给 agent 的英文,中文界面里认得的说成中文,不认得的照原话、标明是它的话;项目文件夹写成 `<项目>`),一个"交给 agent",和一个写意见的框:对着什么,就是模块里选中的那一处(一秒、一段、一个镜头、一章、一个记号、一张卡),没选就是整个模块(记进这一轮的整体意见)。右栏顶上两页:"对话"是和 agent 说话(下面一节),"这一站"是上面这些;这一轮有要你定的事时先打开"这一站",agent 等你批准时"对话"上亮一个琥珀色的数。 - **提交**:先列出每件决定选了什么(没动的标"按推荐")和每条点评,可以再写一句整体意见;走的还是 `POST …/feedback` 这一条通道,`bin/vh desk wait` 照样被唤醒。服务没起来时,回复复制到剪贴板。每次提交是一份反馈文件、REVIEW.md 里一节,所以一样东西只交一次:交上去的点评从草稿里拿掉(右栏写"已交 N 条"),决定交过以后只有改了选项才再交;写了一半没记下的字照留。交完重新读项目时,原来的画面留在屏幕上,新数据到了才换。 -- **输入框**:`Esc` 离开输入框(写的字留着),`⌘↩` 记下一条后也离开,接着按 `N`、`←` `→`、空格都是给片子的。 +- **输入框**:写意见的框里 `↩` 换行,`⌘↩`(别处 `Ctrl+↩`)或"记下"按钮记下一条,这条规矩用字写在框下面;"对话"那一页的框是 `↩` 发送、`⇧↩` 换行,也写在它旁边。框里有字时保持展开,按"记下"时它不缩,按钮不会从鼠标底下跑开。`Esc` 离开输入框(写的字留着),`⌘↩` 记下一条后也离开,接着按 `N`、`←` `→`、空格都是给片子的。"对着"那一行的"不对着片子":写下的话进整体意见,交出去时标着〔不对着片子〕(比如对 Studio 本身的意见);对整片说的标着〔整片〕。整体意见在"我的意见"里一条一行,没有时间,排在前面。 - **主题**:暗场(默认)、棱镜、舰桥三套,顶上切换,浏览器记住;三套是 `ui.css` 里同一组语义变量的三块取值,默认用哪一套是 `ui.js` 里的一个值(`DEFAULT_THEME`)。四条规矩不随主题变:画面四周是中性灰;读数用等宽字;颜色只说谁、在发生什么(青是你选的和标的,紫是 agent,红是播放头、出错和正在发生,琥珀是等你,绿是过了),其余是灰;只有深色。 - **关卡页的标尺**(静态页和模块下面的关卡页):有镜头表(关卡页自己的分段和镜头,或项目的 `shots.json`、剪辑表)时标镜头和分段;都没有时用 BRIEF 大纲表的段落和时间;大纲也没写时间时,只是一把带秒刻度的尺子,加上没把握和请你听的记号。 - **键盘**:`/` 搜片子(↑↓ 选,回车打开,Esc 关);成片模块的见上面;关卡页里空格播放,`←` `→` 跳镜头,`1`–`9` 选选项。 diff --git a/tools/desk/static/core.js b/tools/desk/static/core.js index f24fdd93..812ebc35 100644 --- a/tools/desk/static/core.js +++ b/tools/desk/static/core.js @@ -75,6 +75,7 @@ const STR = { e_diff: "这一版没记下改了哪里(只有局部重新渲染的版本会记)", e_marks: "还没有标记", whole_render: "整支重渲", diff_label: "{v} 改了这里", next_q: "下一处 · {x}", no_next: "后面没有要看的了", k_least: "agent 没把握", k_listen: "请你听", k_check: "检查发现的", k_mine: "我的意见", sev_fail: "没过", sev_warn: "注意", no_thumbs: "还没做缩略图:拖动时看不到每一秒的画面", + note_keys_w: "{m}↩ 记下 · ↩ 换行", not_film: "不对着片子", not_film_tip: "写一句不对着片子哪一处的话,比如对 Studio 的意见;交出去时会标明", shot_in: "{s}({p} 里)", ln_parts: "段落", l_part: "段落 {x}", ph_not_film: "不对着片子哪一处的话写在这里(比如对 Studio 的意见),点“交给 agent”时一起交出去", // the other modules (the desk's views, moved in) sub_outline: "大纲", sub_script: "字幕 / 旁白", sub_facts: "事实", sub_check: "检查", sub_versions: "版本", sub_decisions: "决定", sub_history: "历史", sub_docs: "文档", concept: "立意", spine: "故事线", motif: "贯穿全片的", end: "看完能记住", spec: "规格", outline_tip: "点色块跳到那一段", @@ -231,6 +232,7 @@ const STR = { e_diff: "This version doesn't record what changed (only a partial re-render records it)", e_marks: "No marks yet", whole_render: "re-rendered whole", diff_label: "{v} changed this", next_q: "Next · {x}", no_next: "Nothing more after here", k_least: "agent unsure", k_listen: "listen", k_check: "found by the check", k_mine: "my note", sev_fail: "failed", sev_warn: "warning", no_thumbs: "No thumbnails yet: dragging won't show each second", + note_keys_w: "{m}↩ adds the note · ↩ new line", not_film: "Not about the film", not_film_tip: "A note about no moment of the film, such as one about Studio itself; it goes marked as such", shot_in: "{s} (in {p})", ln_parts: "Parts", l_part: "Part {x}", ph_not_film: "A note about no moment of the film (Studio itself, say): it goes when you press “Send to agent”", sub_outline: "Outline", sub_script: "Captions / narration", sub_facts: "Facts", sub_check: "Check", sub_versions: "Versions", sub_decisions: "Decisions", sub_history: "History", sub_docs: "Documents", concept: "Concept", spine: "Spine", motif: "Recurring motif", end: "Remembered after", spec: "Spec", outline_tip: "click a block to jump to it", seg_n: "Part {i}", know: "The viewer knows / feels", visual: "Key visual", seg_caps: "{n} {n|line|lines} in this part", to_script: "go through them →", bars: "bars {b}", diff --git a/tools/desk/static/modules.css b/tools/desk/static/modules.css index 93827b66..6533d4d5 100644 --- a/tools/desk/static/modules.css +++ b/tools/desk/static/modules.css @@ -91,10 +91,12 @@ details.more>summary::before{content:"▸ "}details.more[open]>summary::before{c .sg-b .k{color:var(--ink-3);margin-right:8px} /* ---------- 分镜 ---------- */ -.pgtabs{display:inline-flex;border:1px solid var(--rule);border-radius:var(--r-ctl);overflow:hidden} -.pgtabs a,.pgtabs button{padding:5px 12px;font-size:var(--fs-small);color:var(--ink-2);text-decoration:none;border:0;background:none;cursor:pointer} -.pgtabs>*+*{border-left:1px solid var(--rule)} -.pgtabs [aria-current=true]{color:var(--you);background:var(--you-soft)} +.pgtabs{display:flex;flex-wrap:wrap;gap:4px} /* a tab a part, named by its shots: each on one line, the row wraps */ +.pgtabs a,.pgtabs button{padding:4px 10px;font-size:var(--fs-small);color:var(--ink-2);text-decoration:none;border:1px solid var(--rule);border-radius:var(--r-ctl);background:none;cursor:pointer;white-space:nowrap} +.pgtabs [aria-current=true]{color:var(--you);background:var(--you-soft);border-color:var(--you-line)} +.pgnav{flex:1 1 100%;min-width:0} +.pgkeys{display:block;margin-top:6px;font-size:var(--fs-label)} +.shotc.cur{border-color:var(--you);box-shadow:inset 0 0 0 1px var(--you)} .mgrid.board{grid-template-columns:minmax(0,2fr) minmax(220px,1fr)} .bplay .well{aspect-ratio:16/9;border-radius:var(--r-card)} .bplay .well video,.bplay .well img{position:relative;width:100%;height:100%;object-fit:contain;max-height:none} diff --git a/tools/desk/static/modules.js b/tools/desk/static/modules.js index a4dc6b53..a58276e1 100644 --- a/tools/desk/static/modules.js +++ b/tools/desk/static/modules.js @@ -37,6 +37,10 @@ const dattr = (o) => { // data-* attributes, escaped; a mark feedback.py would const rich = (s) => esc(s).replace(/\*\*(.+?)\*\*/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/\n/g, "
"); // a gate page's own marks const panel = (title, sub, body, cls) => `
${title ? `

${esc(title)}${sub ? `${esc(sub)}` : ""}

` : ""}${body}
`; const voidLine = (s) => `

${esc(s)}

`; +function packPins(xs, gap, max) { // xs in order (px): each its row, the first where it keeps gap from the one before; past max rows the one with the most room + const last = []; + return xs.map((x) => { let r = last.findIndex((l) => x - l >= gap); if (r < 0) r = last.length < max ? last.length : last.indexOf(Math.min(...last)); last[r] = x; return r; }); +} const budgetLen = (s) => { // tools/review.py's budget_len: a CJK character 1, any other visible one ½; text without CJK its characters const x = String(s || "").replace(/[`*]/g, "").replace(/\s+/g, " ").trim(), cjk = (x.match(/[ -鿿豈-﫿＀-￯]/g) || []).length; return cjk ? { n: cjk + 0.5 * x.replace(/[\s -鿿豈-﫿＀-￯]/g, "").length, lim: 40 } : { n: x.length, lim: 100 }; @@ -281,7 +285,7 @@ MODVIEW.outline = { main: mOutline2, wire: wireOutline2 }; /* ---------- 分镜: a page a part, the grey box, each shot with what it should get across ---------- */ moduleWords({ - board_title: "第 {i} 页 · {x}", board_sub2: "标黄的是 agent 没把握的镜头。其余的没写意见就算通过。", + board_title: "第 {i} 页 · {x}", board_title2: "{x} · {r}", board_keys: "← → 一镜一镜看", this_part: "这一段", part_seconds: "这一段的 {a}–{b}", board_sub2: "标黄的是 agent 没把握的镜头。其余的没写意见就算通过。", page_n: "第 {i} 页", this_page: "这一页", shots_k: "镜头", shots_n: "{n} 镜", unsure_k: "没把握", none: "没有", span_k: "时长", grey_k: "粗样", grey_note: "先看节奏和构图,颜色后面再上", no_anim: "还没有粗样视频。", anim_gone: "粗样视频找不到了,可能被挪走了。", default_pass: "没写意见就通过", you_said: "你说了", trans_k: "转场", board_none: "还没有镜头表。", avg_s: "平均一镜 {s} 秒", plan_k: "打算改", bar_board: "分镜 · {s}", bar_said: "分镜 · {s}。你当时说:「{q}」", to_sound: "去声音", @@ -289,7 +293,7 @@ moduleWords({ page_seconds: "这一页的 {a}–{b}", skip_sub: "这一站没停下来给你看(你说了不用停)。只能看;要改就写一条意见。", }, { - board_title: "Page {i} · {x}", board_sub2: "Amber shots are the ones the agent is unsure about. The rest pass if you write no note.", + board_title: "Page {i} · {x}", board_title2: "{x} · {r}", board_keys: "← → shot by shot", this_part: "This part", part_seconds: "this part, {a}–{b}", board_sub2: "Amber shots are the ones the agent is unsure about. The rest pass if you write no note.", page_n: "Page {i}", this_page: "This page", shots_k: "Shots", shots_n: "{n} {n|shot|shots}", unsure_k: "Unsure", none: "none", span_k: "Span", grey_k: "Rough cut", grey_note: "Rhythm and framing first; colour comes later", no_anim: "No rough cut video yet.", anim_gone: "The rough cut video can't be found; it may have been moved.", default_pass: "passes without a note", you_said: "you said", trans_k: "Transition", board_none: "No shot list yet.", avg_s: "{s} s a shot", plan_k: "will change", bar_board: "Storyboard · {s}", bar_said: "Storyboard · {s}. You said: “{q}”", to_sound: "To the sound", @@ -311,11 +315,11 @@ function boardPages() { // { round, pages }: the gate ② page's parts and sho const least = (Array.isArray(gr.data.least_sure) ? gr.data.least_sure : []).filter((x) => x && x.id); const flag = (id) => { const m = least.find((x) => sameId(x.id, id)); return m ? m.note || true : null; }; const extra = (Array.isArray(gr.data.assets) ? gr.data.assets : []).filter((a) => a && a.path && a.for); - return { round: gr.id, pages: segs.map((g, i) => ({ key: String(g.id || i + 1), title: String(g.title || g.id || ""), note: String(g.note || ""), n: i + 1, of: segs.length, + return { round: gr.id, pages: joinSheets(segs.map((g, i) => ({ key: String(g.id || i + 1), title: String(g.title || g.id || ""), note: String(g.note || ""), n: i + 1, of: segs.length, t0: sec(g.t0), t1: sec(g.t1), assets: extra.filter((a) => a.for === g.id), shots: g.shots.filter((x) => x && x.id).map((x) => { const j = S.find((s) => sameId(s.id, x.id)) || {}; return { id: String(x.id), label: String(x.see || ""), see: String(x.see || ""), vo: String(x.vo || ""), plan: String(x.note || ""), start: sec(x.t0, j.start), end: sec(x.t1, j.end), - frame: x.frame || j.frame || "", frame_missing: x.frame || j.frame ? "" : x.frame_missing || "", reads: [], transition: "", unsure: flag(x.id) }; }) })) }; + frame: x.frame || j.frame || "", frame_missing: x.frame || j.frame ? "" : x.frame_missing || "", reads: [], transition: "", unsure: flag(x.id) }; }) }))) }; } const pages = []; S.forEach((s) => { @@ -325,6 +329,23 @@ function boardPages() { // { round, pages }: the gate ② page's parts and sho }); return { round: null, pages }; } +const sheetOf = (x) => String(x || "").match(/^(.*?)\s*[((]\s*(\d+)\s*\/\s*(\d+)\s*[))]\s*$/); // "开场(2/2)" → 开场, 2, 2 +function joinSheets(pages) { // one part's sheets in a row, one page again, with all its shots + const out = []; + pages.forEach((p) => { + const m = sheetOf(p.title), last = out[out.length - 1], stem = m ? m[1].trim() : p.title; + if (m && last && last.sheets && last.title === stem && +m[2] === last.sheets + 1) { + last.shots = last.shots.concat(p.shots); last.sheets += 1; last.t1 = p.t1 != null ? p.t1 : last.t1; + last.note = [last.note, p.note].filter(Boolean).join(" "); last.assets = (last.assets || []).concat(p.assets || []); return; + } + out.push(Object.assign({}, p, { title: stem || p.title, sheets: m ? +m[2] : 0 })); + }); + return out.map((p, i) => Object.assign(p, { n: i + 1, of: out.length })); +} +function shotRange(S) { // "S1–S9", or the one shot + const a = S[0], b = S[S.length - 1]; + return !a ? "" : a === b ? shotName(a.id) : `${shotName(a.id)}–${shotName(b.id)}`; +} function unsureShot(s) { return !!s.unsure || gateMarks().some((m) => m.kind === "least" && sameId(m.id, s.id)); } function mBoard2() { const { pages } = boardPages(); @@ -333,16 +354,18 @@ function mBoard2() { const T0 = S.map((s) => s.start).filter((x) => x != null), T1 = S.map((s) => s.end).filter((x) => x != null); const t0 = pg.t0 != null ? pg.t0 : T0.length ? Math.min(...T0) : null, t1 = pg.t1 != null ? pg.t1 : T1.length ? Math.max(...T1) : null, unsure = S.filter(unsureShot), vid = D.shots.video; const durs = S.filter((s) => s.start != null && s.end != null).map((s) => s.end - s.start); - const tabs = pages.length > 1 ? `` : ""; + // a tab a part, named by its shots and its name ("S1–S9 开场"); ← → go shot by shot, on into the next part + const tabName = (p) => [shotRange(p.shots), p.title].filter(Boolean).join(" "); + const tabs = pages.length > 1 ? `
${esc(t("board_keys"))}
` : ""; const first = S.find((s) => s.frame), rough = vid && !/draft|final|film/i.test(vid); // the film itself is no rough cut: no rough-cut note for it - const gone = D.shots.video_missing, pageT = t0 != null && t1 != null ? t("page_seconds", { a: fmt(t0), b: fmt(t1) }) : ""; + const gone = D.shots.video_missing, pageT = t0 != null && t1 != null ? t("part_seconds", { a: fmt(t0), b: fmt(t1) }) : ""; // this page's seconds only, with the console's own small transport (a browser's controls would offer the whole film) const player = vid ? `
${esc(pageT)}
` : first ? `

${esc(t(gone ? "anim_gone" : "no_anim"))}${gone && !readOnly() ? ` ` : ""}

` : `

${esc(t(gone ? "anim_gone" : "no_anim"))}${gone && !readOnly() ? ` ` : ""}

`; - const info = panel(t("this_page"), "", `
${esc(t("shots_k"))}
${esc(t("shots_n", { n: S.length }))}
+ const info = panel(t("this_part"), "", `
${esc(t("shots_k"))}
${esc(t("shots_n", { n: S.length }))}
${esc(t("unsure_k"))}
${unsure.length ? unsure.map((s) => `${esc(shotName(s.id))}`).join(" ") : esc(t("none"))}
${t0 != null && t1 != null ? `
${esc(t("span_k"))}
${esc(fmt(t0) + "–" + fmt(t1))}${durs.length ? `
${esc(t("avg_s", { s: (durs.reduce((a, b) => a + b, 0) / durs.length).toFixed(1) }))}` : ""}
` : ""}${rough ? `
${esc(t("grey_k"))}
${esc(t("grey_note"))}
` : ""}
`); const extra = (pg.assets || []).map((a) => /\.(png|jpe?g|gif|webp|svg|avif)$/i.test(a.path) ? `
${a.caption ? `
${esc(a.caption)}
` : ""}
` @@ -364,7 +387,7 @@ function mBoard2() { const st = stationState("2"), q = D.history.filter((h) => gateKey(h.title) === "2").flatMap((h) => h.quotes || []).map((x) => x.text).pop(); const of = ""; // the page tabs say which page const settled = ["done", "skipped"].includes(stationState("2")) || filmDelivered(), day = shortDate(stopDate(stations().filter((x) => x.id === "2"))); - return headM("board", t("board_title", { i: i + 1, x: pg.title || t("m_board") }), stationState("2") === "skipped" ? tRO("skip_sub") : settled ? (day ? tRO("idea_done_d", { d: day }) : tRO("idea_done_d0")) : t("board_sub2"), tabs) // decided: said as such, nothing asked + return headM("board", t("board_title2", { x: pg.title || t("m_board"), r: shotRange(S) }), stationState("2") === "skipped" ? tRO("skip_sub") : settled ? (day ? tRO("idea_done_d", { d: day }) : tRO("idea_done_d0")) : t("board_sub2"), tabs) // decided: said as such, nothing asked + (pg.note || of ? `

${of}${pg.note ? `${esc(pg.note)}` : ""}

` : "") + `
${player}${info}
${cards}
${extra ? `
${extra}
` : ""}` + barM((() => { const s = flowWord(flowState(FLOW.find((f) => f.mod === "board"))) || t("st_" + (st || "not_started")); // the stop in the top bar's words @@ -377,8 +400,33 @@ function tellWhere(path) { // a file that moved: the person says where it went const say = $("#say"); if (!say) return; say.value = t("tell_where_say"); say.focus(); say.setSelectionRange(say.value.length, say.value.length); } +let BOARD_NEXT = ""; // "first" or "last": the shot to land on when ← → went on into another part +function boardStep(dir) { + const cards = $$(".shotc"), cur = cards.findIndex((c) => c.classList.contains("cur")); + const k = cur < 0 ? (dir > 0 ? 0 : cards.length - 1) : cur + dir; + if (k >= 0 && k < cards.length) return boardPick(cards[k]); + const { pages } = boardPages(), i = Math.max(0, Math.min(pages.length - 1, (parseInt(SUB, 10) || 1) - 1)), j = i + dir; + if (j < 0 || j >= pages.length) return; + BOARD_NEXT = dir > 0 ? "first" : "last"; + if (readOnly()) { SUB = String(j + 1); redraw(); } else go(projHash(PKEY, "board/" + (j + 1))); +} +function boardPick(card) { // the card lit, in view, the note box on it, the small player at its start + $$(".shotc.cur").forEach((c) => c.classList.remove("cur")); + card.classList.add("cur"); card.scrollIntoView({ block: "nearest", behavior: reduced() ? "auto" : "smooth" }); + const v = $("#bv2"), d = card.dataset; + if (v && d.t != null) { v.pause(); try { v.currentTime = +d.t + 0.01; } catch (e) { /* not loaded */ } } + if (!readOnly() && typeof setScope === "function") setScope({ target: d.mark, label: fitLabel(d.label || d.mark), el: card, t: d.t != null ? +d.t : null, t1: d.t1 != null ? +d.t1 : null }); +} +if (typeof document !== "undefined") document.addEventListener("keydown", (e) => { // the storyboard's own keys (the cut has its own): before the page's other listeners, so a page view under it does not jump too + if (MOD !== "board" || e.metaKey || e.ctrlKey || e.altKey || e.defaultPrevented || !(e.key === "ArrowLeft" || e.key === "ArrowRight")) return; + const a = document.activeElement; if (a && (/^(INPUT|TEXTAREA|SELECT)$/.test(a.tagName) || a.isContentEditable)) return; + if (!$(".shotc")) return; + e.preventDefault(); e.stopImmediatePropagation(); boardStep(e.key === "ArrowRight" ? 1 : -1); +}, true); function wireBoard2() { $$(".pgtabs button[data-page]").forEach((b) => b.addEventListener("click", () => { SUB = b.dataset.page; redraw(); })); // a static page has no routes + if (BOARD_NEXT) { const cards = $$(".shotc"), c = BOARD_NEXT === "first" ? cards[0] : cards[cards.length - 1]; BOARD_NEXT = ""; if (c) boardPick(c); } + $$(".shotc[data-mark]").forEach((c) => c.addEventListener("click", () => { $$(".shotc.cur").forEach((x) => x.classList.remove("cur")); c.classList.add("cur"); })); // a click on a card: ← → go on from it $$("[data-tell]").forEach((b) => b.addEventListener("click", (e) => { e.stopPropagation(); tellWhere(b.dataset.tell); })); const v = $("#bv2"); if (!v) return; const t0 = v.dataset.t0 != null ? +v.dataset.t0 : 0, t1 = v.dataset.t1 != null ? +v.dataset.t1 : null, btn = $("#bvPlay"), bar = $("#bvBar"), tt = $("#bvT"); diff --git a/tools/desk/static/studio.css b/tools/desk/static/studio.css index 4b0d1260..68e93cd9 100644 --- a/tools/desk/static/studio.css +++ b/tools/desk/static/studio.css @@ -230,6 +230,7 @@ html.shell-other .topbar{padding-right:calc(14px + 100vw - env(titlebar-area-x, .composer textarea{width:100%;min-height:36px;resize:vertical;transition:min-height .16s var(--ease);border:1px solid var(--rule-2);background:var(--panel-2);padding:8px 10px;font:var(--fs-small)/1.5 var(--prose);border-radius:var(--r-card)} :root[data-theme=darkfield] .composer textarea{border:0;border-bottom:1px solid var(--rule-2);background:none;padding:6px 0;font-size:var(--fs-text);border-radius:0} .composer textarea:focus{outline:none;border-color:var(--you);min-height:96px} +.composer textarea:not(:placeholder-shown){min-height:96px} /* a box with words in it stays open: pressing 记下 does not shrink it and move the button away from the click */ .composer .send{display:flex;align-items:center;gap:10px} .composer .send .btn-primary{margin-left:auto} .col-closed .col-body,.col-closed .col-round,.col-closed .composer,.col-closed .col-head>*:not(.col-fold){display:none} @@ -252,7 +253,7 @@ html.shell-other .topbar{padding-right:calc(14px + 100vw - env(titlebar-area-x, .cut.layout-review:not(.revision-list){grid-template-columns:0 minmax(0,1fr)} .cut.layout-review:not(.revision-list) .lists{display:none} .lists{grid-row:1;display:flex;flex-direction:column;min-height:0;border-right:1px solid var(--rule)} -.ltabs{display:flex;gap:2px 14px;padding:10px 12px 0;border-bottom:1px solid var(--rule);overflow-x:auto;scrollbar-width:none} +.ltabs{display:flex;flex-wrap:wrap;gap:6px 14px;padding:10px 12px 0;border-bottom:1px solid var(--rule)} /* every tab in sight: a narrow list takes a second row, none is cut off */ .ltabs button{border:0;background:none;cursor:pointer;padding:0 0 8px;font-size:var(--fs-small);color:var(--ink-3);white-space:nowrap;border-bottom:1px solid transparent;margin-bottom:-1px} .ltabs button b{font:400 11px var(--mono);margin-left:4px} .ltabs button[aria-selected=true]{color:var(--ink-hi);border-bottom-color:var(--ink)} @@ -326,7 +327,7 @@ html.shell-other .topbar{padding-right:calc(14px + 100vw - env(titlebar-area-x, .col-body .note-list li.just{background:var(--panel-3);transition:background .6s var(--ease)} /* the note just added, lit for a moment */ .tl{--lab-w:80px} .lane{display:grid;grid-template-columns:var(--lab-w) minmax(0,1fr);align-items:center;min-height:24px} -.lane .lab{font-size:11px;color:var(--ink-3);text-align:right;padding-right:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} +.lane .lab{font-size:11px;color:var(--ink-3);text-align:right;padding-right:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:sticky;left:0;z-index:5;align-self:stretch;display:flex;align-items:center;justify-content:flex-end;background:var(--bg)} /* zoomed in and scrolled, the lanes keep their names */ .lane .trk{position:relative;height:24px} .lane.shots .trk{height:46px} :root[data-theme=darkfield] .lane.shots .trk{height:56px;background:repeating-linear-gradient(90deg,var(--sprocket) 0 5px,transparent 5px 11px) 0 3px/100% 4px no-repeat,repeating-linear-gradient(90deg,var(--sprocket) 0 5px,transparent 5px 11px) 0 calc(100% - 3px)/100% 4px no-repeat,var(--strip)} @@ -366,7 +367,7 @@ html.shell-other .topbar{padding-right:calc(14px + 100vw - env(titlebar-area-x, :root[data-theme=bridge] .pin{border-radius:0} .span-mark{position:absolute;top:50%;height:2px;margin-top:-1px;background:currentColor;opacity:.5} .diff{position:absolute;top:2px;bottom:2px;border-bottom:2px solid var(--agent);font-size:10.5px;color:var(--agent);padding:0 4px;overflow:hidden;white-space:nowrap} -.tl>.over{position:absolute;top:0;bottom:0;left:var(--lab-w);right:12px;pointer-events:none} +.tl>.over{position:absolute;top:0;bottom:0;left:var(--lab-w);right:12px;pointer-events:none;z-index:4} .selr{position:absolute;top:0;bottom:0;background:var(--you-soft);border-left:1px solid var(--you);border-right:1px solid var(--you)} .selr .cap{position:absolute;top:24px;left:4px;margin:0;font:10.5px/1.5 var(--mono);color:var(--you);background:var(--bg);padding:0 5px;white-space:nowrap;max-width:none} .tl-ph{position:absolute;top:0;bottom:0;width:1px;background:var(--live)} @@ -632,3 +633,16 @@ blockquote{margin:8px 0;padding:4px 14px;border-left:2px solid var(--rule-2);col .col-body .cfold>summary{cursor:pointer;list-style:none;margin:0}.col-body .cfold>summary::-webkit-details-marker{display:none} .col-body .cfold>summary::before{content:"▸";flex:none;width:10px;font-size:10px;color:var(--ink-3)}.col-body .cfold[open]>summary::before{content:"▾"} .col-body .cfold[open]>summary{margin-bottom:8px}.col-body .cfold+.cfold{margin-top:10px}.col-body .cfold>summary:hover b{color:var(--ink)} /* the unsure places and the places to listen, folded to a heading */ + +/* the review feel (2026-11): the grouped lanes' names stay put too; the entries that hold shots of their own, as a band above them; + the marks a row a kind; a note keeps its own lines */ +.tl .grp-t{position:sticky;left:10px;z-index:5;background:var(--bg)} +:root[data-theme=prism] .lane .lab,:root[data-theme=prism] .tl .grp-t{background:linear-gradient(var(--panel),var(--panel)),var(--bg)} /* prism's lanes sit on a panel: the names' column the same colour */ +.lane.parts .trk{height:20px} +.blk.chap.entry{top:2px;bottom:2px;font-size:10.5px;color:var(--ink-3)} +.lane.marks .trk{min-height:24px} +.lane.marks .pin{margin-top:-6px} +.lane.marks .span-mark{margin-top:-1px} +.note-list.mine .nt,.lists .lrow .tx{white-space:pre-line} +.composer #sayAdd{margin-left:auto} /* on a row of its own when the place's name is long: still at the right, where it was */ +.composer .say-keys{margin:-4px 0 0;font-size:var(--fs-label);color:var(--ink-3);text-align:right} /* the keys in words, under the box they are for */ diff --git a/tools/desk/static/studio.js b/tools/desk/static/studio.js index a4acfe8a..c03253de 100644 --- a/tools/desk/static/studio.js +++ b/tools/desk/static/studio.js @@ -483,14 +483,17 @@ function renderMarks() { // the round's places in the film: on the round's own } const COLOPEN = { least: false, listen: false }; function myItems() { return Object.entries(FB.items).filter(([, v]) => v && v.status); } +function generalParts() { // the overall words as written, a note each: "〔不对着片子〕…" its label and its words (a note keeps its own lines) + return String(FB.general || "").split(/\n(?=〔)/).filter((x) => x.trim()).map((x) => { const m = x.match(/^〔([^〕]*)〕([\s\S]*)$/); return m ? { label: m[1], text: m[2] } : { label: "", text: x }; }); +} function renderMine() { const items = myItems().sort((a, b) => (a[1].t != null ? a[1].t : 1e9) - (b[1].t != null ? b[1].t : 1e9)); const st = { ok: t("st_ok"), change: t("st_change"), ask: t("st_ask") }; - const row = ([k, v]) => `
  • ${v.t != null ? esc(fmt(v.t) + (v.t1 != null ? "–" + fmt(v.t1) : "")) : ""}${esc(cut(v.label || k, 40))} ${esc(v.text || st[v.status] || "")}
  • `; - const gen = FB.general ? `
  • ·${esc(t("c_whole_note"))} ${esc(FB.general)}
  • ` : ""; + const row = ([k, v]) => `
  • ${v.t != null ? esc(fmt(v.t) + (v.t1 != null ? "–" + fmt(v.t1) : "")) : ""}${esc(cut(v.label || k, 40))} ${esc(v.text || st[v.status] || "")}
  • `; + const gen = generalParts().map((g, i) => `
  • ·${esc(g.label || t("c_whole_note"))} ${esc(g.text)}
  • `).join(""); const none = !items.length && !gen; // none yet: the heading and how to start, on one line - $("#cMine").innerHTML = `

    ${esc(t("c_mine"))}${items.length + (FB.general ? 1 : 0)}${none ? `${esc(t(MOD === "cut" ? "c_mine_how" : "c_mine_how_m"))}` : ""}

    ` - + (none ? "" : `
      ${items.map(row).join("")}${gen}
    `); + $("#cMine").innerHTML = `

    ${esc(t("c_mine"))}${items.length + generalParts().length}${none ? `${esc(t(MOD === "cut" ? "c_mine_how" : "c_mine_how_m"))}` : ""}

    ` + + (none ? "" : `
      ${gen}${items.map(row).join("")}
    `); } function renderNext() { // what happens next, in a line: who, and what (status's words in this page's language; its commands only in a tooltip) const st = (D && D.status) || {}, ns = st.next_step || {}, run = ((st.activity || {}).running || []); @@ -552,7 +555,8 @@ function fadeMore() { const b = $("#colBody"); if (b) b.classList.toggle("more", $("#colBody").addEventListener("scroll", fadeMore); window.addEventListener("resize", fadeMore); $("#colBody").addEventListener("click", (e) => { const x = e.target.closest("[data-del]"); - if (x) { e.stopPropagation(); if (x.dataset.del === "#general") FB.general = ""; else delete FB.items[x.dataset.del]; save(); return; } + if (x) { e.stopPropagation(); const g = x.dataset.del.match(/^#general(?::(\d+))?$/); + if (g) FB.general = g[1] == null ? "" : String(FB.general || "").split(/\n(?=〔)/).filter((y) => y.trim()).filter((y, i) => i !== +g[1]).join("\n"); else delete FB.items[x.dataset.del]; save(); return; } const li = e.target.closest("[data-goto]"); if (li && !e.target.closest("button:not([data-goto]),a,input,textarea")) { const tg = li.dataset.goto, k = tg.split(":")[0], words = cut(((li.querySelector("span:last-of-type") || li).textContent || "").trim(), 28); @@ -587,21 +591,26 @@ function buildComposer() { const c = $("#composer"), draft = $("#say") ? $("#say").value : ""; // rebuilt in another language: the words written so far stay c.dataset.ready = LANG; // the language it was built in: a film in the other one builds it again // one row: what the note is on, and the button that notes it; the box under it (saying it to the agent is the column's other tab, agent.js) - c.innerHTML = `
    ${esc(t("at"))}
    + // the keys said in words beside the box: Enter is a new line here, ⌘↩ (Ctrl+↩) or the button keeps the note (the conversation's box sends on ↩ and says so) + c.innerHTML = `
    ${esc(t("at"))}
    - `; +

    ${esc(t("note_keys_w", { m: MAC ? "⌘" : "Ctrl+" }))}

    `; $("#say").value = draft; - $("#toWhole").addEventListener("click", () => setScope(null)); + $("#toWhole").addEventListener("click", () => { if (CUT) CUT.clear(); setScope(null); }); + $("#toNone").addEventListener("click", () => { if (CUT) CUT.clear(); setScope({ label: t("not_film"), none: true }); $("#say").focus(); }); // a note about no moment of the film: the overall words, named + $("#sayAdd").addEventListener("mousedown", (e) => e.preventDefault()); // the box keeps its focus and its size while the button is pressed: the button does not move away from the click $("#sayAdd").addEventListener("click", addNote); - $("#say").addEventListener("keydown", (e) => { if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) { e.preventDefault(); addNote(); } }); + $("#say").addEventListener("keydown", (e) => { if (e.key === "Enter" && (e.metaKey || e.ctrlKey) && !e.isComposing) { e.preventDefault(); addNote(); } }); } +const MAC = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent || ""); function scopeLabel() { return SCOPE ? SCOPE.label : MOD === "cut" ? t("whole_film") : t("whole", { m: t("m_" + (MOD || "cut")) }); } function updateComposer() { if (!$("#composer").dataset.ready) return; const x = scopeLabel(); $("#scope").textContent = x; $("#scope").className = "chip" + (SCOPE ? "" : " quiet"); $("#toWhole").hidden = !SCOPE; - $("#say").placeholder = t("c_ph", { x: /[\x21-\x7e]$/.test(x) && LANG === "zh" ? x + " " : x }); + $("#toNone").hidden = !!(SCOPE && SCOPE.none); + $("#say").placeholder = SCOPE && SCOPE.none ? t("ph_not_film") : t("c_ph", { x: /[\x21-\x7e]$/.test(x) && LANG === "zh" ? x + " " : x }); AGENT.scope(); // the conversation's box writes against the same selection } function setScope(s) { @@ -613,7 +622,7 @@ function addNote() { const ta = $("#say"), text = ta.value.trim(); if (!text) { ta.focus(); return; } if (!SCOPE || !SCOPE.target) { // the whole module, or a place with no target of its own: the round's overall words, named - const pre = SCOPE ? `〔${SCOPE.label}〕` : MOD && MOD !== "cut" ? `〔${t("m_" + MOD)}〕` : ""; + const pre = SCOPE ? `〔${SCOPE.label}〕` : MOD && MOD !== "cut" ? `〔${t("m_" + MOD)}〕` : `〔${t("whole_film")}〕`; // named, so each note stays a note of its own in the list FB.general = (FB.general ? FB.general + "\n" : "") + pre + text; } else { const cur = FB.items[SCOPE.target]; @@ -621,7 +630,7 @@ function addNote() { SCOPE.t != null ? { t: SCOPE.t } : {}, SCOPE.t1 != null ? { t1: SCOPE.t1 } : {}); } ta.value = ""; save(); toast(t("noted", { x: scopeLabel() })); - const li = $(`#cMine li[data-goto="${CSS.escape(SCOPE && SCOPE.target ? SCOPE.target : "")}"]`) || $("#cMine li.general"); // the note in the column, in view and lit for a moment + const li = $(`#cMine li[data-goto="${CSS.escape(SCOPE && SCOPE.target ? SCOPE.target : "")}"]`) || $$("#cMine li.general").pop(); // the note in the column, in view and lit for a moment if (li) { li.scrollIntoView({ block: "nearest", behavior: "smooth" }); li.classList.add("just"); setTimeout(() => li.classList.remove("just"), 1600); } ta.blur(); // noted: the next key (N, ← →, Space) goes to the film, not into the box } @@ -1025,11 +1034,25 @@ function vDocs() { function filmPath() { // the server's pick, only a file that is there: this round's film at the cut's stop, else bin/vh status's, else its proxy return (D && D.studio && D.studio.film) || ""; } -function cutShots() { +function cutRows() { // the shot table's rows (an edit list's entries, else shots.json's shots) const T = TL(), raw = T.shots && T.shots.length ? T.shots : (D.shots.items || []); - return raw.filter((s) => s && s.start != null && s.end != null && +s.end > +s.start).map((s) => ({ id: String(s.id), t0: +s.start, t1: +s.end, label: s.label || "", seg: s.segment || "", - frame: s.frame || "", unsure: s.unsure || null, reads: s.reads || [], caption: s.caption || "" })).sort((a, b) => a.t0 - b.t0); + return raw.filter((s) => s && s.start != null && s.end != null && +s.end > +s.start); +} +function cutShots() { // what the shots lane shows: an edit list's entry by the shots inside it when the film's render kept them (tools/resolved.py) + const out = []; + cutRows().forEach((s) => { + const inner = (Array.isArray(s.inner) ? s.inner : []).filter((x) => x && x.id != null && +x.end > +x.start); + if (!inner.length) { out.push({ id: String(s.id), t0: +s.start, t1: +s.end, label: s.label || "", seg: s.segment || "", frame: s.frame || "", unsure: s.unsure || null, reads: s.reads || [], caption: s.caption || "" }); return; } + const part = String(s.id); + inner.forEach((x) => { const id = String(x.id), short = id.startsWith(part + ".") ? id.slice(part.length + 1) : id; + out.push({ id, short, part, t0: +x.start, t1: +x.end, label: "", seg: s.segment || "", frame: "", unsure: null, reads: [], caption: "" }); }); + }); + return out.sort((a, b) => a.t0 - b.t0); +} +function cutParts() { // the entries that hold shots of their own: a band above the shots, a note on one is on the whole entry + return cutRows().filter((s) => Array.isArray(s.inner) && s.inner.length).map((s) => ({ id: String(s.id), t0: +s.start, t1: +s.end, title: s.label || s.segment || String(s.id) })); } +const shotWord = (s) => (s.part ? t("shot_in", { s: shotName(s.short), p: s.part }) : shotName(s.id)); // S1_3(PROLOGUE 里) function cutChapters(shots) { const T = TL(); const ch = (T.chapters || []).map((c) => ({ id: String(c.id != null ? c.id : c.title), title: c.title || c.name || String(c.id), t0: +(c.start != null ? c.start : c.t0), t1: +(c.end != null ? c.end : c.t1), kind: "chapter" })) @@ -1163,7 +1186,7 @@ function openRevision(r) { function CutModule(area) { const T = TL(), ST = D.studio || {}, fps = +T.fps || 30; - const film = filmPath(), shots = cutShots(), chapters = cutChapters(shots); + const film = filmPath(), shots = cutShots(), chapters = cutChapters(shots), parts = cutParts(); const lines = (T.narration && T.narration.length ? T.narration : T.captions || []).filter((x) => x.start != null && x.end != null).map((x, i) => ({ id: String(x.id || i + 1), t0: +x.start, t1: +x.end, text: x.text || "" })); const linesAreCaptions = !(T.narration && T.narration.length) && lines.length > 0; const M = D.music || {}, sections = (M.sections || []).filter((s) => s.end > s.start), hitsL = M.hits || [], beats = T.beats || []; @@ -1187,6 +1210,7 @@ function CutModule(area) { let zoom = 1, snapOn = store.get("desk:cut-snap") !== false, safe = false, cmp = false, wipe = 0.5; let closeRevision = null; let SEL = null, inPt = null, stopAt = null, clockT = 0, raf = 0, simPlaying = false, simLast = 0; + let follow = true, autoAt = -1, focusAt = 0, freshClick = false; // the timeline pages along with the playhead until the person scrolls it; a click that brings the window up plays nothing const notesOf = () => myItems().filter(([, v]) => v.t != null).map(([k, v]) => ({ kind: "mine", t: +v.t, t1: v.t1 != null ? +v.t1 : null, target: k, label: v.label || k, note: v.text || "" })); const agentMarks = () => gateMarks().filter((m) => m.t != null).map((m) => ({ kind: m.kind, t: +m.t, t1: m.t1 != null ? +m.t1 : null, target: m.target, label: m.id || "", note: m.note })); const checkMarks = () => findings.map((f, i) => ({ kind: "check", t: +f.t, t1: f.t1 != null ? +f.t1 : null, target: "time:" + (+f.t).toFixed(1), label: f.kind || "", note: shotText(f.message || ""), sev: f.severity, i })); @@ -1266,13 +1290,21 @@ function CutModule(area) { tick(); if (play) start(); } - function start() { + function start() { // only ever from the person's own click or key: never from opening a stop, a time in the address, or code + if (video && navigator.userActivation && !navigator.userActivation.isActive) return; if (stopAt != null && now() >= stopAt - 0.04) stopAt = null; + follow = true; if (video) { video.play().catch(() => {}); if (vb && cmp) vb.play().catch(() => {}); } else if (dur) { if (clockT >= dur - 0.01) clockT = 0; simPlaying = true; simLast = performance.now(); } loop(); } - function stop() { if (video) { video.pause(); if (vb) vb.pause(); } simPlaying = false; tick(); } + function stop() { const was = simPlaying; if (video) { video.pause(); if (vb) vb.pause(); } simPlaying = false; tick(); if (!video && was) settle(); } + function settle() { // stopped: a selected second (what the note box is on) moves to where the picture stopped, as an editor's marker goes where you pause + const x = now(); + if (drag) return; // a scrub ends by its own rule + if (SEL && SEL.kind === "time" && Math.abs(SEL.t - x) > 0.05 && SCOPE && String(SCOPE.target || "").startsWith("time:")) select({ kind: "time", t: x, label: fmt(x) }); + else paintSel(); + } function toggle() { if (playing()) return stop(); if (SEL && SEL.t1 != null && (now() < SEL.t - 0.01 || now() >= SEL.t1 - 0.04)) { seek(SEL.t); stopAt = SEL.t1; } // a span selected: play it @@ -1281,7 +1313,7 @@ function CutModule(area) { function loop() { cancelAnimationFrame(raf); const step = (ts) => { - if (!video && simPlaying) { clockT += (ts - simLast) / 1000; simLast = ts; if (clockT >= dur) { clockT = dur; simPlaying = false; } } + if (!video && simPlaying) { clockT += (ts - simLast) / 1000; simLast = ts; if (clockT >= dur) { clockT = dur; simPlaying = false; settle(); } } if (stopAt != null && now() >= stopAt) { stop(); seek(stopAt); stopAt = null; } tick(); if (playing()) raf = requestAnimationFrame(step); @@ -1291,8 +1323,9 @@ function CutModule(area) { if (video) { video.addEventListener("loadedmetadata", () => { if (isFinite(video.duration) && video.duration > 0) dur = video.duration; lastShot = undefined; fit(); draw(); tick(); }); video.addEventListener("play", loop); - video.addEventListener("pause", () => { if (vb) vb.pause(); tick(); }); + video.addEventListener("pause", () => { if (vb) vb.pause(); tick(); settle(); }); video.addEventListener("seeked", tick); + video.addEventListener("timeupdate", () => { if (!video.paused) tick(); }); // a window in the background gets no animation frames: the time still moves video.addEventListener("error", () => { frame.insertAdjacentHTML("beforeend", `

    ${esc(film)}

    `); }); } @@ -1326,7 +1359,7 @@ function CutModule(area) { /* the lists on the left */ function renderTabs() { const nl = allMarks().filter((m) => m.kind === "listen").length; - const n = { shots: shots.length, notes: allMarks().filter((m) => m.kind !== "check" && m.kind !== "listen").length + (FB.general ? 1 : 0), checks: findings.length }; + const n = { shots: shots.length, notes: allMarks().filter((m) => m.kind !== "check" && m.kind !== "listen").length + generalParts().length, checks: findings.length }; const T2 = [["shots", t("l_shots"), n.shots], ["script", linesAreCaptions ? t("l_captions") : t("l_script"), lines.length || ""]].concat(nl ? [["listen", t("c_listen"), nl]] : [], [["notes", t("l_notes"), n.notes], ["checks", t("l_checks"), n.checks]]); const revisions = revisionRows(); const pending = revisions.filter((r) => r.state === "pending" && r.available).length; @@ -1355,7 +1388,7 @@ function CutModule(area) { const c = chapterAt(s.t0 + 0.01); if (c && c !== last) { h += `
    ${esc(c.title)}
    `; last = c; } const pic = shotPic(s), on = SEL && SEL.kind === "shot" && SEL.id === s.id; - h += ``; + h += ``; }); } } else if (tab === "script") { @@ -1366,7 +1399,7 @@ function CutModule(area) { const R = allMarks().filter((m) => m.kind !== "check" && m.kind !== "listen"); const who = (m) => (m.kind === "mine" ? `${esc(t("k_mine"))}` : m.kind === "least" ? `${esc(t("k_least"))}` : `${esc(t("k_listen"))}`); h = R.map((m) => ``).join("") - + (FB.general ? `
    ·${esc(t("c_whole_note"))} ${esc(FB.general)}
    ` : ""); + + generalParts().map((g) => `
    ·${esc(g.label || t("c_whole_note"))} ${esc(g.text)}
    `).join(""); if (!h) h = `

    ${esc(t("c_none_mine"))}

    `; } else if (tab === "revisions") { h = revisionCards(revisionRows()); @@ -1398,6 +1431,7 @@ function CutModule(area) { return `
    ${esc(label)}
    ${inner || (empty ? `${esc(empty)}` : "")}
    `; } const trackW = () => Math.max(200, (scroll.clientWidth || 800) * zoom - 92); // less the lanes' label column and the right padding + const zMax = () => Math.max(16, ((dur || 1) * 100) / Math.max(200, (scroll.clientWidth || 800) - 92)); // zoomed all the way in: about 100 px a second, however long the film function rulerTicks() { const w = trackW(), steps = [0.5, 1, 2, 5, 10, 15, 30, 60, 120, 300, 600]; const step = steps.find((s) => (w / (dur || 1)) * s >= 64) || 600; @@ -1425,20 +1459,25 @@ function CutModule(area) { const AM = allMarks(), pxPerS = trackW() / dur; const shotH = shots.map((s) => { const pic = shotPic(s), st = s.unsure || AM.some((m) => m.kind === "least" && m.t >= s.t0 && m.t < s.t1) ? "flag" : AM.some((m) => m.kind === "mine" && m.t >= s.t0 && m.t < s.t1) ? "note" : ""; const w = (s.t1 - s.t0) * pxPerS, showPic = pic && w >= 20, showId = w >= 28, showName = w >= 150; // narrow: its picture and number; narrower: the picture alone, the number in its tooltip - return blk("shot" + (showId ? "" : " thin") + (SEL && SEL.kind === "shot" && SEL.id === s.id ? " sel" : ""), s.t0, s.t1, `${showPic ? `` : ""}${showId ? `${esc(shotName(s.id))}` : ""}${showName && s.label ? `${esc(s.label)}` : ""}`, "shot:" + s.id, `${shotName(s.id)} ${s.label} · ${fmt(s.t0)}–${fmt(s.t1)}`); }).join(""); + return blk("shot" + (showId ? "" : " thin") + (SEL && SEL.kind === "shot" && SEL.id === s.id ? " sel" : ""), s.t0, s.t1, `${showPic ? `` : ""}${showId ? `${esc(shotName(s.part ? s.short : s.id))}` : ""}${showName && s.label ? `${esc(s.label)}` : ""}`, "shot:" + s.id, `${shotWord(s)} ${s.label} · ${fmt(s.t0)}–${fmt(s.t1)}`); }).join(""); + const partH = parts.map((c) => blk("chap entry" + (SEL && SEL.kind === "shot" && SEL.id === c.id ? " sel" : ""), c.t0, c.t1, esc(c.title), "entry:" + c.id, `${c.title} · ${fmt(c.t0)}–${fmt(c.t1)}`)).join(""); // a line of the narration: ▶ plays just that line const lineH = lines.map((l, i) => blk("line" + (SEL && SEL.kind === "line" && SEL.i === i ? " sel" : ""), l.t0, l.t1, `▶${esc(l.text)}`, "line:" + i, `${l.id} · ${l.text}`)).join(""); const beatH = beats.filter((b) => b.downbeat || pxPerS * (60 / (+T.bpm || 120)) > 10).map((b) => ``).join(""); const secH = sections.map((s) => `${esc(s.label || s.name)}`).join(""); const hitH = hitsL.map((h) => ``).join(""); - const markH = AM.map((m) => `${m.t1 != null ? `` : ""}`).join(""); + // the marks a row a kind (agent unsure, listen, check, yours), each kind on two rows at most where its pins would touch: 67 of them stay apart + let markRows = 0; const placed = []; + ["least", "listen", "check", "mine"].forEach((k) => { const L = AM.filter((m) => m.kind === k); if (!L.length) return; const R = packPins(L.map((m) => m.t * pxPerS), 14, 2); + L.forEach((m, i) => placed.push([m, markRows + R[i]])); markRows += Math.max(...R) + 1; }); + const markH = placed.map(([m, r]) => { const y = `top:${3 + r * 14 + 7}px`; return `${m.t1 != null ? `` : ""}`; }).join(""); const diffH = changed.map((s) => `${esc(t("diff_label", { v: vnum(curV.id) }))}`).join("") || (curV && curV.changed && curV.changed.whole ? `${esc(vnum(curV.id))} · ${esc(t("whole_render"))}` : ""); // a group folds from its name only (a button): the row around it is inert, so a click a little off a lane never folds one const grp = (k, name) => { const shut = layout !== "review" && closed.has(k); return `
    ${shut ? `${esc(t("g_folded"))}` : ""}
    `; }; tl.style.width = zoom * 100 + "%"; tl.innerHTML = `
    ${rulerTicks()}
    ` - + grp("pic", t("g_pic")) + lane("chap", t("ln_chap"), chapH, "pic", t("e_chap")) + lane("shots", t("ln_shots"), shotH, "pic", t("e_shots")) + + grp("pic", t("g_pic")) + lane("chap", t("ln_chap"), chapH, "pic", t("e_chap")) + (parts.length ? lane("parts", t("ln_parts"), partH, "pic") : "") + lane("shots", t("ln_shots"), shotH, "pic", t("e_shots")) + grp("sound", t("g_sound")) + lane("voice extra", t("ln_voice"), lineH, "sound", t("e_voice")) + lane("music extra", t("ln_music"), beatH + secH, "sound", t("e_music")) + (hitsL.length ? lane("thin extra", t("ln_hits"), hitH, "sound") : "") + lane("wave extra", t("ln_wave"), wave(), "sound", t("e_wave")) + grp("review", t("g_review")) + lane("marks", t("ln_marks"), markH, "review", t("e_marks")) + (diffH ? lane("thin extra", t("ln_diff"), diffH, "review") : "") // what changed: a lane only when it is on record @@ -1447,6 +1486,7 @@ function CutModule(area) { const kinds = [["mine", "note", "k_mine"], ["least", "least", "k_least"], ["listen", "listen", "k_listen"], ["check", "check", "k_check"]].filter(([k]) => k === "mine" || AM.some((m) => m.kind === k) || (k === "least" && shots.some((s) => s.unsure))); // a shot flagged unsure carries the ○ too $("#tlLegend", area).innerHTML = kinds.map(([, cls, w]) => `${esc(t(w))}`).join(""); if (layout !== "review") closed.forEach((g) => { $$(`.lane[data-g="${g}"]`, tl).forEach((x) => { x.hidden = true; }); }); + const mk = $(".lane.marks .trk", tl); if (mk && markRows) mk.style.height = Math.max(24, markRows * 14 + 6) + "px"; paintSel(); tick(); } const closed = new Set(store.get("desk:cut-folded") || []); // a new key: what the old full-width row folded by a stray click opens again @@ -1464,8 +1504,13 @@ function CutModule(area) { let lastShot = null, lastPlaying = null; function tick() { const x = now(), ph = $(".tl-ph", tl); - if (playing() !== lastPlaying) { lastPlaying = playing(); $("#cPlay", area).innerHTML = svg(lastPlaying ? "pause" : "play"); } + if (playing() !== lastPlaying) { lastPlaying = playing(); $("#cPlay", area).innerHTML = svg(lastPlaying ? "pause" : "play"); paintSel(); } if (ph) ph.style.left = pct(x) + "%"; + if (ph && playing() && follow && zoom > 1.01 && !drag) { // an editor's page-turn: past the right edge (or before the left), the next page starts just before the playhead + const lab = labW(), at = lab + (pct(x) / 100) * (tl.clientWidth - lab - 12) - scroll.scrollLeft; + if (at > scroll.clientWidth - 16 || at < lab) setScroll(at + scroll.scrollLeft - lab - 24); + } + if (SEL && SEL.kind === "time" && !playing()) paintSel(); $("#cTc", area).innerHTML = `${esc(fmt(x))} / ${esc(fmt(dur))}`; placeLabel(); const s = shotAt(x); @@ -1474,7 +1519,7 @@ function CutModule(area) { const size = video && video.videoWidth ? `${video.videoWidth}×${video.videoHeight}` : (String(specGet("output")).match(/\d{3,5}\s*[x×]\s*\d{3,5}/) || [""])[0].replace(/\s/g, "").replace("x", "×"); const ver = ST.film_instead ? "" : curV ? vnum(curV.id) : (D.status && D.status.media && D.status.media.version) ? vnum(D.status.media.version) : ""; // (another cut plays: its version is not status's) const isProxy = film && D.status && D.status.media && film === D.status.media.proxy && film !== D.status.media.film; - $("#readout", area).innerHTML = (s ? `${esc(shotName(s.id))} ${esc(s.label)}${s.reads && s.reads.length ? `${esc(t("reads"))}${COLON()}${esc(s.reads.join(" → "))}` : s.caption ? `${esc(cut(s.caption, 60))}` : ""}` : "·") + $("#readout", area).innerHTML = (s ? `${esc(shotWord(s))} ${esc(s.label)}${s.reads && s.reads.length ? `${esc(t("reads"))}${COLON()}${esc(s.reads.join(" → "))}` : s.caption ? `${esc(cut(s.caption, 60))}` : ""}` : "·") + `${video && ST.film_instead ? `${esc(t("playing_instead", { f: film.split("/").pop(), g: String(ST.film_instead).split("/").pop() }))} · ` : ""}${video && ST.film_sound === false ? `${esc(t("no_sound"))} · ` : ""}${esc([size, t("fps_n", { n: fps }), ver, isProxy ? t("proxy") : ""].filter(Boolean).join(" · "))}`; if (!video) { const img = $("#cimg", frame); const pic = s ? shotPic(s) : ""; if (img && shots.some(shotPic)) { if (pic) { if (img.getAttribute("src") !== pic) img.src = pic; img.hidden = false; } else img.hidden = true; } } if (tab === "shots") $$("#lbody .lrow", area).forEach((r) => r.classList.toggle("now", !!s && r.dataset.pick === "shot:" + s.id)); @@ -1485,7 +1530,8 @@ function CutModule(area) { function paintSel() { const r = $(".selr", tl); if (!r) return; if (!SEL || SEL.t1 == null) { - if (SEL && SEL.kind === "time") { r.hidden = false; r.style.left = pct(SEL.t) + "%"; r.style.width = "1px"; $(".cap", r).textContent = ""; } // the second is in the note box's line already + // one cursor: a selected second gets its own line only while the picture is stopped somewhere else (the note is still on that second) + if (SEL && SEL.kind === "time" && !playing() && Math.abs(SEL.t - now()) > 0.05) { r.hidden = false; r.style.left = pct(SEL.t) + "%"; r.style.width = "1px"; $(".cap", r).textContent = ""; } else r.hidden = true; return; } @@ -1500,7 +1546,7 @@ function CutModule(area) { seek(at != null && !play && at >= s.t && (s.t1 == null || at <= s.t1) ? at : s.t); const kind = s.kind, a = +(+s.t).toFixed(1), b = s.t1 != null ? +(+s.t1).toFixed(1) : null; let scope; - if (kind === "shot") scope = { target: "shot:" + s.id, label: t("l_shot", { x: s.id + (s.name ? " " + s.name : "") }), t: a, t1: b }; + if (kind === "shot") scope = { target: "shot:" + s.id, label: t(s.part ? "l_part" : "l_shot", { x: (s.word || s.id) + (s.name ? " " + s.name : "") }), t: a, t1: b }; else if (kind === "seg") scope = { target: "seg:" + s.id, label: t("l_seg", { i: s.id, x: s.name }), t: a, t1: b }; else if (kind === "chapter") scope = { target: "chapter:" + s.id, label: t("chapter_label", { x: s.name }), t: a, t1: b }; else if (kind === "mark") scope = { target: s.target, label: s.name, t: a, t1: b }; @@ -1515,7 +1561,8 @@ function CutModule(area) { } function pickThing(p, el, at) { // at: the second a click on it was at; a mark always takes its own second const [kind, ...rest] = p.split(":"), id = rest.join(":"); - if (kind === "shot") { const s = shots.find((x) => x.id === id); if (s) select({ kind: "shot", id: s.id, name: s.label, t: s.t0, t1: s.t1, label: `${s.id} ${s.label}` }, false, at); } + if (kind === "shot") { const s = shots.find((x) => x.id === id); if (s) select({ kind: "shot", id: s.id, word: shotWord(s), name: s.label, t: s.t0, t1: s.t1, label: `${shotWord(s)} ${s.label}` }, false, at); else if (parts.some((c) => c.id === id)) pickThing("entry:" + id, el, at); } + else if (kind === "entry") { const c = parts.find((x) => x.id === id); if (c) select({ kind: "shot", part: true, id: c.id, word: c.id, name: c.title !== c.id ? c.title : "", t: c.t0, t1: c.t1, label: c.title }, false, at); } else if (kind === "chapter" || kind === "seg" || kind === "part") { const c = chapters.find((x) => x.id === id); if (c) select({ kind: c.kind === "part" ? "range" : c.kind, id: c.id, name: c.title, t: c.t0, t1: c.t1, label: c.title }, false, at); } else if (kind === "line" || kind === "play") { const i = +id, l = lines[i]; if (l) select({ kind: "line", i, id: l.id, name: t("l_line", { x: l.id }), t: l.t0, t1: l.t1, label: t("l_line", { x: l.id }) }, kind === "play", kind === "play" ? null : at); } else if (kind === "check") { const f = findings[+id]; if (f) select({ kind: f.t1 != null ? "range" : "time", t: +f.t, t1: f.t1 != null ? +f.t1 : null, name: `${t("k_check")} ${f.kind || ""}`.trim(), label: fmt(f.t) }); } @@ -1561,7 +1608,7 @@ function CutModule(area) { if (d.span) { const a = Math.min(now(), x), b = Math.max(now(), x); if (b - a >= 0.1) return select({ kind: "range", t: a, t1: b, label: `${fmt(a)}–${fmt(b)}` }); } const twice = !!p && !!lastClick && lastClick.p === p && e.timeStamp - lastClick.at < 400; lastClick = p ? { p, at: e.timeStamp } : null; - if (twice && /^(shot|line|chapter|seg|part):/.test(p)) { lastClick = null; const [k, ...r] = p.split(":"); return playPiece(k, r.join(":")); } + if (twice && /^(shot|line|chapter|seg|part|entry):/.test(p)) { lastClick = null; const [k, ...r] = p.split(":"); return playPiece(k, r.join(":")); } if (p) return pickThing(p, d.pick, x); select({ kind: "time", t: x, label: fmt(x) }); }; @@ -1569,7 +1616,7 @@ function CutModule(area) { tl.addEventListener("dragstart", (e) => e.preventDefault()); // a shot's picture is an image: pressed and moved, the browser would drag it away and end the scrub function playPiece(kind, id) { // a double click: that shot, line or chapter, once, from its start to its end if (kind === "line") return pickThing("play:" + id); - const it = kind === "shot" ? shots.find((x) => x.id === id) : chapters.find((x) => x.id === id); + const it = kind === "shot" ? shots.find((x) => x.id === id) : kind === "entry" ? parts.find((x) => x.id === id) : chapters.find((x) => x.id === id); if (!it) return; pickThing(kind + ":" + id); stopAt = it.t1; start(); @@ -1585,7 +1632,7 @@ function CutModule(area) { if (sh) Object.assign(fr.style, { backgroundImage: `url(${JSON.stringify(src(sh.file))})`, backgroundSize: `${sh.size[0] * sc}px ${sh.size[1] * sc}px`, backgroundPosition: `-${best.x * sc}px -${best.y * sc}px`, height: `${Math.round(thumbs.tile[1] * sc)}px` }); } else if (s && shotPic(s)) Object.assign(fr.style, { backgroundImage: `url(${JSON.stringify(shotPic(s))})`, backgroundSize: "cover", backgroundPosition: "center" }); - tip.replaceChildren(...(fr.style.backgroundImage ? [fr] : []), document.createTextNode(fmt(x) + (s ? " · " + s.id : ""))); + tip.replaceChildren(...(fr.style.backgroundImage ? [fr] : []), document.createTextNode(fmt(x) + (s ? " · " + shotWord(s) : ""))); tip.hidden = false; tip.style.left = Math.min(Math.max(e.clientX, 100), window.innerWidth - 100) + "px"; tip.style.top = (ru.getBoundingClientRect().top - 4) + "px"; } @@ -1628,18 +1675,21 @@ function CutModule(area) { $("#tlHelp", area).addEventListener("click", (e) => { const box = $("#tlHelpBox", area), open = box.hidden; box.hidden = !open; e.currentTarget.setAttribute("aria-expanded", String(open)); }); $("#cSnap", area).addEventListener("click", (e) => { snapOn = !snapOn; store.set("desk:cut-snap", snapOn); e.currentTarget.setAttribute("aria-pressed", String(snapOn)); }); $("#cSafe", area).addEventListener("click", (e) => { safe = !safe; e.currentTarget.setAttribute("aria-pressed", String(safe)); $(".safe", frame).hidden = !safe; }); - $("#zIn", area).addEventListener("click", () => { zoom = Math.min(16, zoom * 1.6); draw(); centerOn(now()); }); + $("#zIn", area).addEventListener("click", () => { zoom = Math.min(zMax(), zoom * 1.6); draw(); centerOn(now()); }); $("#zOut", area).addEventListener("click", () => { zoom = Math.max(1, zoom / 1.6); draw(); centerOn(now()); }); + scroll.addEventListener("scroll", () => { if (Math.abs(scroll.scrollLeft - autoAt) > 2) follow = false; }, { passive: true }); // the person scrolled: the view stays where they put it until Play $$("[data-lay]", area).forEach((b) => b.addEventListener("click", () => setLayout(b.dataset.lay))); scroll.addEventListener("wheel", (e) => { // ⌘ or Ctrl + wheel, and a trackpad's pinch: zoom, the second under the pointer staying under it if (!(e.ctrlKey || e.metaKey) || !dur) return; e.preventDefault(); - const at = tAt(e.clientX, false), z = Math.max(1, Math.min(16, zoom * Math.exp(-e.deltaY * 0.003))); + const at = tAt(e.clientX, false), z = Math.max(1, Math.min(zMax(), zoom * Math.exp(-e.deltaY * 0.003))); if (Math.abs(z - zoom) < 1e-3) return; zoom = z; draw(); - const o = overRect(); scroll.scrollLeft += o.left + (at / dur) * o.width - e.clientX; + const o = overRect(); setScroll(scroll.scrollLeft + o.left + (at / dur) * o.width - e.clientX); }, { passive: false }); - function centerOn(x) { const w = tl.scrollWidth; scroll.scrollLeft = Math.max(0, (x / (dur || 1)) * w - scroll.clientWidth / 2); } + function labW() { return overRect().left - tl.getBoundingClientRect().left; } // the lane names' column, which stays put when the lanes scroll + function setScroll(v) { scroll.scrollLeft = Math.max(0, v); autoAt = scroll.scrollLeft; } // a scroll of the page's own (the person's own stops the paging) + function centerOn(x) { const lab = labW(); setScroll((x / (dur || 1)) * (tl.clientWidth - lab - 12) - (scroll.clientWidth - lab) / 2); } // the playhead in the middle of the lanes you can see if (prevV && vb) { // a read-only wipe between this version and the one kept before it const wl = $("#wl", frame), labs = $$(".wipe-l,.wipe-r", frame); const place = () => { vb.style.clipPath = `inset(0 0 0 ${wipe * 100}%)`; wl.style.left = wipe * 100 + "%"; }; @@ -1653,7 +1703,12 @@ function CutModule(area) { wl.addEventListener("pointermove", (e) => { if (!wd) return; const r = frame.getBoundingClientRect(); wipe = Math.max(0.02, Math.min(0.98, (e.clientX - r.left) / r.width)); place(); }); wl.addEventListener("pointerup", () => { wd = false; }); } - screen.addEventListener("click", (e) => { if (!e.target.closest(".wipe-line")) toggle(); }); + const onFocus = () => { focusAt = performance.now(); }; + window.addEventListener("focus", onFocus); + screen.addEventListener("pointerdown", () => { freshClick = !document.hasFocus() || performance.now() - focusAt < 400; }); + screen.addEventListener("click", (e) => { if (freshClick) { freshClick = false; return; } if (!e.target.closest(".wipe-line")) toggle(); }); + const onNote = (e) => { if (e.target && e.target.id === "say" && playing()) stop(); }; // writing a note: the picture stops where it is, and a selected second goes there + document.addEventListener("focusin", onNote); const keys = (e) => { if (e.defaultPrevented || MOD !== "cut" || typing() || e.metaKey || e.ctrlKey || e.altKey || !$("#search").hidden || !$("#confirm").hidden || $(".revision-compare[open]")) return; @@ -1681,6 +1736,7 @@ function CutModule(area) { refresh() { renderTabs(); renderList(); draw(); }, time: () => now(), seekTo(x) { seek(x); }, + clear() { if (SEL) select(null); }, // the note box chose the whole film, or no place in it: nothing stays selected on the timeline goto(target, tt, t1) { const m = allMarks().find((x) => x.target === target); if (m) return pickThing("mark:" + target, { dataset: { t: String(m.t) } }); @@ -1688,7 +1744,7 @@ function CutModule(area) { if (target.startsWith("chapter:") || target.startsWith("seg:")) return pickThing(target); if (tt != null) select(t1 != null ? { kind: "range", t: tt, t1, label: `${fmt(tt)}–${fmt(t1)}` } : { kind: "time", t: tt, label: fmt(tt) }); }, - destroy() { if (closeRevision) closeRevision(); document.removeEventListener("keydown", keys); document.removeEventListener("keyup", spaceUp); area.removeEventListener("click", eatClick, true); cancelAnimationFrame(raf); if (video) video.pause(); if (vb) vb.pause(); if (ro) ro.disconnect(); else window.removeEventListener("resize", fit); }, + destroy() { if (closeRevision) closeRevision(); window.removeEventListener("focus", onFocus); document.removeEventListener("focusin", onNote); document.removeEventListener("keydown", keys); document.removeEventListener("keyup", spaceUp); area.removeEventListener("click", eatClick, true); cancelAnimationFrame(raf); if (video) video.pause(); if (vb) vb.pause(); if (ro) ro.disconnect(); else window.removeEventListener("resize", fit); }, }; } diff --git a/tools/desk/test_cut_page.mjs b/tools/desk/test_cut_page.mjs new file mode 100644 index 00000000..88e18f34 --- /dev/null +++ b/tools/desk/test_cut_page.mjs @@ -0,0 +1,137 @@ +// The cut page and the note box, driven as a person drives them: real mouse presses and keys through the DevTools protocol +// (tools/textcheck/browser.mjs's headless Chrome, no npm package). Run by test_cut_page.py, which builds the long made-up +// films and starts their desk; {chrome, url, sheets, parts} on stdin. Prints one line a failure, nothing when all hold. +import fs from "node:fs"; +import { launchTab } from "../textcheck/browser.mjs"; + +const opt = JSON.parse(fs.readFileSync(0, "utf8")); +const base = opt.url.replace(/\?c=.*$/, ""); +const bad = []; +const want = (ok, msg) => { if (!ok) bad.push(msg); }; +const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); +const watchdog = setTimeout(() => { console.log("cut page: no end within 300 s"); process.exit(1); }, 300000); + +// autoplay allowed, as in Studio's own window (Electron's default): only the page's own rule keeps the film still +const { browser, sessionId: S } = await launchTab(opt.chrome, ["--window-size=1440,900", "--autoplay-policy=no-user-gesture-required"], ["Page", "Runtime"]); +const send = (m, p = {}) => browser.send(m, p, S); +try { + await send("Emulation.setDeviceMetricsOverride", { width: 1440, height: 900, deviceScaleFactor: 1, mobile: false }); + const ev = async (expression) => { + const r = await send("Runtime.evaluate", { expression, awaitPromise: true, returnByValue: true }); + if (r.exceptionDetails) throw new Error(`${expression.slice(0, 80)}: ${(r.exceptionDetails.exception || {}).description || r.exceptionDetails.text}`); + return r.result.value; + }; + const until = async (expr, ms = 10000) => { for (const t0 = Date.now(); Date.now() - t0 < ms; await sleep(100)) { if (await ev(`!!(${expr})`)) return true; } return false; }; + const go = async (u) => { await send("Page.navigate", { url: u }); await sleep(600); }; + const rect = (sel) => ev(`(() => { const e = document.querySelector(${JSON.stringify(sel)}); if (!e) return null; const r = e.getBoundingClientRect(); return { x: r.left, y: r.top, w: r.width, h: r.height }; })()`); + const mouse = (type, x, y, extra = {}) => send("Input.dispatchMouseEvent", { type, x, y, button: "left", clickCount: type === "mouseMoved" ? 0 : 1, ...extra }); + const click = async (x, y) => { await mouse("mouseMoved", x, y); await mouse("mousePressed", x, y); await mouse("mouseReleased", x, y); await sleep(150); }; + const clickOn = async (sel) => { const r = await rect(sel); if (!r) { bad.push(`no ${sel} on the page`); return false; } await click(r.x + r.w / 2, r.y + r.h / 2); return true; }; + const key = async (k, code, keyCode, text, modifiers = 0) => { + await send("Input.dispatchKeyEvent", { type: text ? "keyDown" : "rawKeyDown", key: k, code, windowsVirtualKeyCode: keyCode, text, modifiers }); + await send("Input.dispatchKeyEvent", { type: "keyUp", key: k, code, windowsVirtualKeyCode: keyCode, modifiers }); + await sleep(80); + }; + const type = (s) => send("Input.insertText", { text: s }); + + await go(opt.url); await sleep(1200); // the one-time address: this page gets the token + await go(base + "#/"); await until(`document.querySelector('a[href*="long-tide"]')`); + const hrefs = await ev(`Array.from(document.querySelectorAll('a[href^="#/p/"]')).map((a) => a.getAttribute("href"))`); + const keyOf = (re) => (hrefs.find((h) => re.test(h)) || "").replace(/^#\/p\//, "").split("/")[0]; + const LONG = keyOf(/long-tide~/), EDIT = keyOf(/long-tide-edit~/); + want(LONG && EDIT, `the space lists the two films: ${hrefs.join(" ")}`); + + // 1. the stop opens with the film still and its sound as it was; a click from code plays nothing + await go(`${base}#/p/${LONG}`); + want(await until(`document.querySelector('#cv') && document.querySelector('#cv').readyState >= 1`), "the cut opens on gate ③ with its film"); + await sleep(2000); + const v0 = await ev(`(() => { const v = document.querySelector('#cv'); return { paused: v.paused, t: v.currentTime, muted: v.muted }; })()`); + want(v0.paused && v0.t === 0 && v0.muted === false, `opening the stop played the film or changed its sound: ${JSON.stringify(v0)}`); + await ev(`document.querySelector('#cPlay').click()`); await sleep(800); + want(await ev(`document.querySelector('#cv').paused`), "a click from code (no person's gesture) started the film"); + + // 2. a second picked, played on and paused: the note is on where the picture stopped, and one line marks it + const ru = await rect(".ruler-l .trk"); + await click(ru.x + ru.w * (80 / 740), ru.y + ru.h / 2); + want((await ev(`document.querySelector('#scope').textContent`)).includes("1:20"), "a click on the ruler at 1:20 does not put the note there"); + await clickOn("#cPlay"); await sleep(2500); await clickOn("#cPlay"); await sleep(400); + const st = await ev(`({ scope: document.querySelector('#scope').textContent, tc: document.querySelector('#cTc').textContent.split(" /")[0].trim(), sel: !document.querySelector('.selr').hidden })`); + want(st.scope.includes(st.tc) && st.tc !== "1:20.0", `played on and paused at ${st.tc}, the note box still says ${st.scope}`); + want(!st.sel, "two lines on the timeline: the picked second's apart from the playhead it should follow"); + + // 3. zoomed all the way in: about 100 px a second on a 12-minute film; playing, the playhead stays in sight and the lanes keep their names + for (let i = 0; i < 12; i++) await clickOn("#zIn"); + const px = await ev(`(document.querySelector('#tl').clientWidth - 92) / 740`); + want(px >= 80, `zoomed all the way in, a second is ${px.toFixed(1)} px (a 12-minute film needs about 100)`); + await ev(`document.querySelector('#cv').playbackRate = 8`); + await clickOn("#cPlay"); + let lost = 0, labs = 0; + for (let i = 0; i < 8; i++) { + await sleep(600); + const g = await ev(`(() => { const s = document.querySelector('#tlScroll').getBoundingClientRect(), p = document.querySelector('.tl-ph').getBoundingClientRect(), l = document.querySelector('.lane.shots .lab').getBoundingClientRect(); + return { inView: p.left >= s.left + 60 && p.left <= s.right, lab: Math.abs(l.left - s.left) < 2 }; })()`); + if (!g.inView) lost++; + if (!g.lab) labs++; + } + await clickOn("#cPlay"); await ev(`document.querySelector('#cv').playbackRate = 1`); + want(!lost, `zoomed in and playing, the playhead was out of sight ${lost} of 8 times`); + want(!labs, "zoomed in and scrolled, the lanes' names scrolled away"); + for (let i = 0; i < 14; i++) await clickOn("#zOut"); + + // 4. the 67 marked places: no pin on top of another + const pins = await ev(`Array.from(document.querySelectorAll('.lane.marks .pin')).map((e) => { const r = e.getBoundingClientRect(); return [r.left, r.top, r.width, r.height]; })`); + let over = 0; + for (let i = 0; i < pins.length; i++) for (let j = i + 1; j < pins.length; j++) { + const [a, b] = [pins[i], pins[j]], w = Math.min(a[0] + a[2], b[0] + b[2]) - Math.max(a[0], b[0]), h = Math.min(a[1] + a[3], b[1] + b[3]) - Math.max(a[1], b[1]); + if (w > 1 && h > 1) over++; + } + want(pins.length === 67, `${pins.length} pins for the 67 marked places`); + want(!over, `${over} pairs of the marked places' pins lie on each other`); + + // 5. the note box: ↩ is a new line; one press of 记下 keeps the note (the button stays under the pointer); ⌘/Ctrl+↩ keeps too; the keys in words beside it + if (await ev(`!document.querySelector('#toWhole').hidden`)) await clickOn("#toWhole"); + await ev(`document.querySelector('#say').focus()`); await type("第一行"); await key("Enter", "Enter", 13, "\r"); await type("第二行"); + want((await ev(`document.querySelector('#say').value`)) === "第一行\n第二行", "↩ in the note box is not a new line"); + await sleep(400); // the box has opened (its height eases in) + const b0 = await rect("#sayAdd"); + await mouse("mouseMoved", b0.x + b0.w / 2, b0.y + b0.h / 2); await mouse("mousePressed", b0.x + b0.w / 2, b0.y + b0.h / 2); await sleep(200); + const b1 = await rect("#sayAdd"); + await mouse("mouseReleased", b0.x + b0.w / 2, b0.y + b0.h / 2); await sleep(400); + want(Math.abs(b1.y - b0.y) < 1 && Math.abs(b1.x - b0.x) < 1, `记下 moved ${Math.round(b1.y - b0.y)} px while it was pressed`); + want((await ev(`document.querySelector('#say').value`)) === "" && (await ev(`document.querySelector('#cMine').textContent`)).includes("第二行"), "one press of 记下 did not keep the note"); + await ev(`document.querySelector('#say').focus()`); await type("第三行"); await key("Enter", "Enter", 13, "\r", 2); + want((await ev(`document.querySelector('#say').value`)) === "", "Ctrl+↩ does not keep the note"); + want(/↩.*记下.*↩.*换行/.test(await ev(`(document.querySelector('#sayKeys') || {}).textContent || ""`)), "the note box's keys are not said in words beside it"); + + // 6. a note about no moment of the film: its own place, marked as such when it goes + if (await clickOn("#toNone")) { + await type("给 Studio 的话"); await clickOn("#sayAdd"); + want((await ev(`payload().general`)).includes("〔不对着片子〕给 Studio 的话"), `a note not about the film goes unmarked: ${await ev("payload().general")}`); + } + + // 7. the storyboard by shot: a tab a part with its shots, the sheets of one part together; ← → shot by shot + await go(`${base}#/p/${LONG}/board/1`); await until(`document.querySelector('.pgtabs')`); + const tabs = await ev(`Array.from(document.querySelectorAll('.pgtabs a')).map((a) => a.textContent.trim())`); + want(tabs.length === opt.parts && opt.sheets > opt.parts, `${opt.sheets} sheets of ${opt.parts} parts made ${tabs.length} tabs`); + want(tabs.every((x) => !/页|Page/.test(x)) && /^S1–S\d+ /.test(tabs[0] || ""), `the tabs say pages, not shots: ${tabs.slice(0, 3).join(" | ")}`); + await ev(`document.activeElement && document.activeElement.blur()`); + await key("ArrowRight", "ArrowRight", 39); await key("ArrowRight", "ArrowRight", 39); await sleep(300); + const cur = await ev(`({ id: (document.querySelector('.shotc.cur') || {}).id || "", scope: document.querySelector('#scope').textContent })`); + want(cur.id === "shot-S2" && /S2\b/.test(cur.scope), `→ → on the storyboard: ${JSON.stringify(cur)}`); + + // 8. an edit list's long part: a shot inside it is there to point at + await go(`${base}#/p/${EDIT}/cut`); + want(await until(`document.querySelector('.lane.shots [data-pick="shot:PROLOGUE.S1_3"]')`), "the shots inside an edit list's part are not on the timeline"); + if (await ev(`!!document.querySelector('.lane.shots [data-pick="shot:PROLOGUE.S1_3"]')`)) { + await clickOn('.lane.shots [data-pick="shot:PROLOGUE.S1_3"]'); + const sc = await ev(`document.querySelector('#scope').textContent`); + want(sc.includes("S1_3") && sc.includes("PROLOGUE"), `a click on S1_3 inside PROLOGUE names ${sc}`); + } +} catch (e) { + bad.push(`cut page: ${e.message}`); +} finally { + await browser.close(); + clearTimeout(watchdog); +} +for (const b of bad) console.log(b); +process.exit(bad.length ? 1 : 0); diff --git a/tools/desk/test_cut_page.py b/tools/desk/test_cut_page.py new file mode 100644 index 00000000..5544ab92 --- /dev/null +++ b/tools/desk/test_cut_page.py @@ -0,0 +1,151 @@ +"""The cut page and the note box on a long film, in a real headless Chrome (tools/ci.sh's console group; not a bin/vh command). + +usage: python3 tools/desk/test_cut_page.py + +A made-up 12:20 film is built in a temp folder from tools/desk/fixtures/demo: 60 shots in nine parts, about 180 lines, gate ③ +with 67 marked places (30 the agent is unsure of, 30 to listen to, 7 the check found), gate ② cut into sheets of six as an +agent writes it ("开场(1/2)"), and the same film again cut from an edit list whose render kept the shots inside each part. +The picture is ffmpeg's test pattern, 64×36 at 5 frames a second (a few hundred KB). A desk of its own serves them (a temp +HOME and every Studio folder in the temp folder, no window, no browser, no keychain), and test_cut_page.mjs drives the +pages through the DevTools protocol with real mouse and key events. Prints nothing and exits 0 when every check holds; +else one line a failure, exit 1. Exit 3: no ffmpeg (the caller skips). +""" +import json, os, random, re, shutil, subprocess, sys, tempfile, time +from pathlib import Path + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parent.parent +D = 740.0 +PARTS = ["开场", "两个鼓包", "转一圈", "大潮小潮", "海湾放大", "潮汐表", "历史", "今天的港口", "结尾"] +NAMES = ["PROLOGUE", "BULGES", "TURN", "SPRING", "BAY", "TABLE", "HISTORY", "PORT", "END"] + + +def film(path): + r = subprocess.run(["ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-f", "lavfi", "-i", f"testsrc=s=64x36:r=5:d={D:g}", "-f", "lavfi", + "-i", f"sine=f=330:sample_rate=8000:d={D:g}", "-c:v", "libx264", "-preset", "ultrafast", "-crf", "40", "-g", "5", + "-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "16k", "-shortest", str(path)], capture_output=True, text=True) + if r.returncode: + raise SystemExit(f"ffmpeg: {r.stderr.strip()[:300]}") + + +def long_film(root, mp4): + p = root / "2026-11-20-long-tide" + shutil.copytree(HERE / "fixtures/demo", p) + R = random.Random(7) + cuts = sorted(R.uniform(3, D - 3) for _ in range(59)) + bounds = [0.0] + [round(c, 2) for c in cuts] + [D] + shots = [{"id": f"S{i + 1}", "segment": PARTS[min(8, i * 9 // 60)], "start": bounds[i], "end": bounds[i + 1], "label": f"第 {i + 1} 镜", + "frame": f"out/frames/S{i % 6 + 1}.svg", "reads": [f"读点 {i + 1}"]} for i in range(60)] + rows = [] + for k, seg in enumerate(PARTS): + ss = [x for x in shots if x["segment"] == seg] + rows.append(f"| {k + 1} | {seg} | {ss[0]['start']:.0f}–{ss[-1]['end']:.0f} s | 看懂{seg} | {seg}的画面 |") + b = (p / "BRIEF.md").read_text(encoding="utf-8").replace("- Output: 1920x1080, 30 fps, about 32 s", "- Output: 320x180, 30 fps, 12:20") + b = re.sub(r"(\|---\|---\|---\|---\|---\|\n)(?:\|.*\n)+", lambda m: m.group(1) + "\n".join(rows) + "\n", b) + (p / "BRIEF.md").write_text(b, encoding="utf-8") + (p / "shots.json").write_text(json.dumps({"shots": shots}, ensure_ascii=False), encoding="utf-8") + segs, t, n = [], 0.4, 0 + while t < D - 4: + n += 1 + d = R.uniform(2.0, 5.0) + segs.append({"id": f"L{n}", "start": round(t, 2), "end": round(t + d, 2), "text": f"第 {n} 句旁白。"}) + t += d + R.uniform(0.3, 0.9) + (p / "audio/timeline.zh.json").write_text(json.dumps({"version": 1, "lang": "zh", "provider": "fixture", "segments": segs}, ensure_ascii=False), encoding="utf-8") + g = json.loads((p / "out/review/gate-3.json").read_text(encoding="utf-8")) + g.update(film="out/draft.mp4", least_sure=[{"id": shots[k]["id"], "t": round(shots[k]["start"] + 0.5, 1), "note": f"没把握 {k}"} for k in range(0, 60, 2)], + listen=[{"t": round(10 + j * 24.1, 1), "note": f"请听 {j}"} for j in range(30)]) + (p / "out/review/gate-3.json").write_text(json.dumps(g, ensure_ascii=False), encoding="utf-8") + c = json.loads((p / "out/check/draft.check.json").read_text(encoding="utf-8")) + c["findings"] = [{"kind": "textcheck", "severity": "warn", "message": f"字压在亮处 {j}", "t": round(30 + j * 97.3, 1), "t1": round(32 + j * 97.3, 1)} for j in range(7)] + (p / "out/check/draft.check.json").write_text(json.dumps(c, ensure_ascii=False), encoding="utf-8") + g2 = json.loads((p / "out/review/gate-2.json").read_text(encoding="utf-8")) + sheets = [] + for k, seg in enumerate(PARTS): + ss = [x for x in shots if x["segment"] == seg] + ch = [ss[i:i + 6] for i in range(0, len(ss), 6)] + sheets += [{"id": f"P{k + 1}-{j + 1}", "title": seg + (f"({j + 1}/{len(ch)})" if len(ch) > 1 else ""), "t0": c0[0]["start"], "t1": c0[-1]["end"], + "shots": [{"id": x["id"], "t0": x["start"], "t1": x["end"], "frame": x["frame"], "see": x["label"]} for x in c0]} for j, c0 in enumerate(ch)] + g2["segments"] = sheets + (p / "out/review/gate-2.json").write_text(json.dumps(g2, ensure_ascii=False), encoding="utf-8") + shutil.copy(mp4, p / "out/draft.mp4") + return p, shots, len(sheets) + + +def edit_film(root, src, shots): + """The same film from an edit list of nine parts; its render record keeps each part's shots (.), as render.mjs writes them.""" + import hashlib + p = root / "2026-11-21-long-tide-edit" + shutil.copytree(src, p) + (p / "shots.json").unlink() + parts = [[x for x in shots if x["segment"] == seg] for seg in PARTS] + entries = [{"id": NAMES[k], "src": "black", "end": ss[-1]["end"], "segment": PARTS[k], "label": PARTS[k]} for k, ss in enumerate(parts)] + entries[-1].pop("end") + entries[-1]["dur"] = round(D - parts[-1][0]["start"], 3) + (p / "edit.json").write_text(json.dumps({"v": 1, "fps": 30, "size": [320, 180], "sources": {"black": {"color": "#000000"}}, + "tracks": [{"id": "V1", "entries": entries}]}, ensure_ascii=False), encoding="utf-8") + sha = hashlib.sha256((p / "edit.json").read_bytes()).hexdigest() + rec = [{"id": NAMES[k], "start": ss[0]["start"], "end": ss[-1]["end"], "kind": "color"} for k, ss in enumerate(parts)] + rec += [{"id": f"{NAMES[k]}.S{k + 1}_{j + 1}", "start": x["start"], "end": x["end"], "kind": "shot"} for k, ss in enumerate(parts) for j, x in enumerate(ss)] + (p / "out/draft.mp4.render.json").write_text(json.dumps({"fps": 30, "frames": int(D * 30), "first_frame": 0, "edit": {"path": "edit.json", "sha256": sha}, "shots": rec}), encoding="utf-8") + return p + + +def main(argv): + if len(argv) != 1: + print(__doc__.strip(), file=sys.stderr) + return 2 + chrome = argv[0] + if not shutil.which("ffmpeg"): + return 3 + t = Path(tempfile.mkdtemp(prefix="vh-cut-page.")) + desk = None + try: + env = dict(os.environ) + for k in ("HOME", "TMPDIR", "XDG_CACHE_HOME", "XDG_DATA_HOME", "XDG_CONFIG_HOME", "OVH_STUDIO_PROFILES", "OVH_STUDIO_SHELL_PROFILE", "OVH_STUDIO_SHELL_CACHE", "OVH_AGENTS_DIR"): + (t / k.lower()).mkdir() + env[k] = str(t / k.lower()) + root = t / "root" + root.mkdir() + env.update(OVH_PROJECTS=str(root), OVH_LOCAL_MD="/dev/null/LOCAL.md", OVH_STUDIO_SHELL="none", OVH_STUDIO_BROWSER="none", OVH_GATE_STUDIO="0", + OVH_KEYSTORE="none", BROWSER="/usr/bin/true") + film(t / "film.mp4") + p, shots, sheets = long_film(root, t / "film.mp4") + for g in ("1", "2", "3"): + r = subprocess.run([str(ROOT / "bin/vh"), "gate", str(p), g], env=env, capture_output=True, text=True) + if r.returncode: + print(f"bin/vh gate {g}: {r.stderr.strip()[:300]}") + return 1 + edit_film(root, p, shots) + log = t / "desk.log" + desk = subprocess.Popen([sys.executable, str(HERE / "fixtures/with_tty.py"), str(ROOT / "bin/vh"), "desk", "--root", str(root), "--port", "0", "--idle", "0", + "--no-open", "--print-address"], env=env, stdout=open(log, "w"), stderr=subprocess.STDOUT) + url = None + for _ in range(150): + m = re.search(r"(http://127\.0\.0\.1:\d+/)\?c=([A-Za-z0-9_-]+)", log.read_text(errors="replace")) + if m: + url = m.group(0) + break + if desk.poll() is not None: + break + time.sleep(0.2) + if not url: + print("the desk gave no address: " + log.read_text(errors="replace")[:400].replace("\n", " ")) + return 1 + r = subprocess.run(["node", str(HERE / "test_cut_page.mjs")], input=json.dumps({"chrome": chrome, "url": url, "sheets": sheets, "parts": len(PARTS)}), + capture_output=True, text=True, timeout=600) + out = (r.stdout + r.stderr).strip() + if out: + print(out) + return 0 if r.returncode == 0 and not r.stdout.strip() else 1 + finally: + if desk and desk.poll() is None: + desk.terminate() + try: + desk.wait(10) + except subprocess.TimeoutExpired: + desk.kill() + shutil.rmtree(t, ignore_errors=True) + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/tools/resolved.py b/tools/resolved.py index b14bd20c..a68cdf39 100644 --- a/tools/resolved.py +++ b/tools/resolved.py @@ -11,7 +11,9 @@ with neither, the shots its current film's .render.json kept (window.film.shots when it was rendered: no browser is started here). Each row with the table's other fields, as written. A film rendered as a part (first_frame): its shots from its own first frame, what lies outside it left out and what crosses its ends cut there; with a table of the whole film, its frames and length are - not the film's, and the table's are taken + not the film's, and the table's are taken. An edit list's row also carries "inner": the shots inside it, as the current film's + .render.json kept them (window.film.shots of each page, named ., in the film's seconds, cut to the row), when that + film was rendered from this edit.json; a row with none has no "inner" chapters edit.json's, else the current film's .render.json (the same way for a part); a page with neither is a row of missing narration an edit list's merged timeline (out/edit.timeline..json) when there is one, else audio/timeline..json, else audio/timeline.json; the template's example is no take. zh or en picks the language @@ -22,7 +24,7 @@ a row of missing; a value that is NaN elsewhere is null. Frames are bin/vh's own (tools/timegrid.py): start_frame is the first frame of a span (a chapter's too), end_frame the first after it; a beat's frame is the one on screen then. --json: {"version": 1, "tool", "project", "fps", "fps_from", "duration", "duration_from", "frames", "size", "shots_from", "shots": [{"id", "start", "end", -"start_frame", "end_frame", the table's other fields}], "chapters": [{"t", "frame", "title"}], "narration": [{"id", "start", "end", "start_frame", "end_frame", +"start_frame", "end_frame", the table's other fields, "inner" with an edit list: [{"id", "start", "end", "start_frame", "end_frame"}]}], "chapters": [{"t", "frame", "title"}], "narration": [{"id", "start", "end", "start_frame", "end_frame", "text", "word_count", "words" with --words: [{"w", "start", "end"}], "speaker", "from"}], "captions": [{"id", "start", "end", "start_frame", "end_frame", "zh", "en", "part"}], "beats": [{"t", "frame", "downbeat"}], "bpm", "sources": {"shots" | "narration" | "captions" | "beats": {"path", "sha256"}}, "missing": [{"part", "why"}]}. Exit: 0, with parts missing too · 2 usage, or no project. @@ -114,6 +116,26 @@ def film_side(self): return None, None return film, side if isinstance(side, dict) else None + def inner(self, rows, side, fps): + """An edit list's rows, each with the shots its current film's render kept inside it (render.mjs: edit.mjs shotsOf, kind "shot", + ., in the film's seconds), cut to the row. Only a film rendered from this very edit.json: another one's are left out, said.""" + shots = [s for s in side.get("shots") or [] if isinstance(s, dict) and s.get("kind") == "shot" and isinstance(s.get("id"), str) + and num(s.get("start")) is not None and num(s.get("end")) is not None] + if not shots or not rows: + return rows + made_of = (side.get("edit") or {}).get("sha256") if isinstance(side.get("edit"), dict) else None + now = (self.sources.get("shots") or {}).get("sha256") + if not made_of or made_of != now: + self.lack("shots", "the film's render was made from another edit.json: the shots inside its parts are left out until it is rendered again") + return rows + out = [] + for r in rows: + pre, a, b = f"{r['id']}.", r["start"], r["end"] + mine = [(s["id"], max(a, float(s["start"])), min(b, float(s["end"]))) for s in shots if s["id"].startswith(pre)] + mine = [{"id": i, "start": round(x, 6), "end": round(y, 6), "start_frame": frame_from(x, fps), "end_frame": frame_from(y, fps)} for i, x, y in mine if y > x + 1e-6] + out.append(dict(r, inner=sorted(mine, key=lambda s: s["start"])) if mine else r) + return out + def side_part(self, side): """(the film's own first frame in seconds, its length in seconds or None) of a .render.json.""" fps = num(side.get("fps")) or 1 @@ -324,6 +346,8 @@ def document(project, lang=None, words=False): fps, fps_from = 30, "the default" if shots_from and shots_from != "edit.json": rows = [spanned(r, fps) for r in rows] + elif shots_from == "edit.json" and side: + rows = D.part("shots", rows, D.inner, rows, side, fps) if doc is None: chapters = D.part("chapters", [], D.side_chapters, film, side, fps) narration = D.part("narration", [], D.narration, lang, doc, fps, words) From c5a498a9b4f1747e8e935809e01a74bb1f9a6ff9 Mon Sep 17 00:00:00 2001 From: zhanglinghao Date: Mon, 23 Nov 2026 16:21:54 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=AE=A1=E7=89=87=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E6=89=BE=20Chrome=EF=BC=88=E5=92=8C=20bin/vh?= =?UTF-8?q?=20=E6=89=BE=E7=9A=84=E4=B8=80=E6=A0=B7=EF=BC=89=EF=BC=8C?= =?UTF-8?q?=E5=88=86=E9=95=9C=E7=9A=84=E6=97=A7=E6=96=AD=E8=A8=80=E6=94=B9?= =?UTF-8?q?=E6=88=90=E6=8C=89=E6=AE=B5=E3=80=81=E6=8C=89=E9=95=9C=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/ci.sh | 12 +++++------- tools/desk/test_cut_page.py | 26 ++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/tools/ci.sh b/tools/ci.sh index e79967fd..92ec4ad8 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -4186,9 +4186,9 @@ const run = host(JSON.parse(fs.readFileSync(dataFile, "utf8")), false), h = {}; for (const m of ["idea", "outline", "board", "sound", "ship", "assets", "ledger"]) h[m] = draw(run, m); want((h.idea.match(/class="ccard/g) || []).length === 2 && h.idea.includes("card-A.svg") && h.idea.includes(run("esc(D.ideas.same_topic)")) && /chip you-pick">/.test(h.idea), "idea: two cards with frames, the same-topic line, A picked (REVIEW.md)"); want(h.outline.includes("segbar") && (h.outline.match(/class="segc"/g) || []).length === 3 && h.outline.includes("HyperFrames"), "outline: the bar, three parts, the engine"); -want(h.board.includes("第 1 页 · 开场") && (h.board.match(/class="shotc/g) || []).length === 2, "board: page 1, two shots"); +want(h.board.includes("开场 · S1–S2") && h.board.includes(">S3–S4 两个鼓包<") && !/第 \d+ 页/.test(h.board) && (h.board.match(/class="shotc/g) || []).length === 2, "board: the first part, two shots, its tabs named by their shots, no pages"); run("SUB = '2'"); const b2 = draw(run, "board"); run("SUB = ''"); -want(b2.includes("第 2 页 · 两个鼓包") && b2.includes("shotc unsure") && b2.includes("背面的鼓包会不会看不懂") && b2.includes("鼓包加大一点") && b2.includes("原理段,宁慢勿快") && b2.includes('id="shot-S04"'), +want(b2.includes("两个鼓包 · S3–S4") && b2.includes("shotc unsure") && b2.includes("背面的鼓包会不会看不懂") && b2.includes("鼓包加大一点") && b2.includes("原理段,宁慢勿快") && b2.includes('id="shot-S04"'), "board: page 2 is the gate ② page's part (S04 unsure, its plan line, the part's note), not shots.json's"); want(h.sound.includes("-14.2") && /
    ]*>\s*

    Charon<\/b>/.test(h.sound) && (h.sound.match(//g) || []).filter((r) => r.includes("chip wait")).length === 1 && ["0:09.0", "0:21.3"].every((x) => h.sound.includes(x)), "sound: loudness, the voice in use, one fast line flagged, the lifts at their seconds"); @@ -4472,16 +4472,14 @@ PY rm -rf "$t" # the cut page and the note box on a 12-minute made-up film with 67 marked places, in a real headless Chrome that may play # unasked as Studio's window may (tools/desk/test_cut_page.py builds the films and their desk; real mouse presses and keys) - local cb rc - if ! cb=$(chrome_path); then no_chrome "the cut page in a browser" - else - a=$(python3 tools/desk/test_cut_page.py "$cb" 2>&1); rc=$? + local rc + a=$(python3 tools/desk/test_cut_page.py 2>&1); rc=$? case $rc in 0) ok "the cut page in a browser, on a 12-minute film: opening a stop or a click from code plays nothing; a second picked and played on, the note goes where the picture stopped, one line; zoomed in, about 100 px a second, the playhead in sight while it plays and the lanes' names kept; 67 marked places, no pin on another; ↩ a new line, one press of 记下 keeps the note (the button stays put), Ctrl+↩ too, the keys in words; a note not about the film goes marked; the storyboard a tab a part (its sheets joined) named by its shots, ← → shot by shot; an edit list's part shows the shots inside it to point at" ;; 3) skip "the cut page in a browser" "no ffmpeg" ;; + 4) no_chrome "the cut page in a browser" ;; *) bad "the cut page in a browser: $(printf '%s' "$a" | tr '\n' ';' | head -c 1500)" ;; esac - fi } studio_checks() { # bin/vh studio (tools/desk/studio.py, window.py) and its launcher icon, as a person meets them: in a temp # HOME and TMPDIR (no console or window of this machine's is found or touched), the stand-in window, no screen needed. diff --git a/tools/desk/test_cut_page.py b/tools/desk/test_cut_page.py index 5544ab92..ce01fc0c 100644 --- a/tools/desk/test_cut_page.py +++ b/tools/desk/test_cut_page.py @@ -1,6 +1,6 @@ """The cut page and the note box on a long film, in a real headless Chrome (tools/ci.sh's console group; not a bin/vh command). -usage: python3 tools/desk/test_cut_page.py +usage: python3 tools/desk/test_cut_page.py [] A made-up 12:20 film is built in a temp folder from tools/desk/fixtures/demo: 60 shots in nine parts, about 180 lines, gate ③ with 67 marked places (30 the agent is unsure of, 30 to listen to, 7 the check found), gate ② cut into sheets of six as an @@ -8,7 +8,8 @@ The picture is ffmpeg's test pattern, 64×36 at 5 frames a second (a few hundred KB). A desk of its own serves them (a temp HOME and every Studio folder in the temp folder, no window, no browser, no keychain), and test_cut_page.mjs drives the pages through the DevTools protocol with real mouse and key events. Prints nothing and exits 0 when every check holds; -else one line a failure, exit 1. Exit 3: no ffmpeg (the caller skips). +else one line a failure, exit 1. Exit 3: no ffmpeg; 4: no Chrome (CHROME_PATH, the usual installs, Playwright's Chromium, as bin/vh's +chrome_path looks; the caller skips, or on CI fails). """ import json, os, random, re, shutil, subprocess, sys, tempfile, time from pathlib import Path @@ -90,11 +91,28 @@ def edit_film(root, src, shots): return p +def find_chrome(): + """The Chrome bin/vh's chrome_path would take: CHROME_PATH, the system installs, then Playwright's Chromium builds, newest first.""" + for p in (os.environ.get("CHROME_PATH", ""), "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", "/usr/bin/google-chrome", + "/usr/bin/google-chrome-stable", "/usr/bin/chromium", "/usr/bin/chromium-browser"): + if p and os.path.isfile(p) and os.access(p, os.X_OK): + return p + for d in (os.environ.get("PLAYWRIGHT_BROWSERS_PATH", ""), str(Path.home() / ".cache/ms-playwright")): + if d and os.path.isdir(d): + for n in sorted((int(m.group(1)) for m in (re.fullmatch(r"chromium-(\d+)", x) for x in os.listdir(d)) if m), reverse=True): + for p in (f"{d}/chromium-{n}/chrome-linux64/chrome", f"{d}/chromium-{n}/chrome-linux/chrome"): + if os.access(p, os.X_OK): + return p + return None + + def main(argv): - if len(argv) != 1: + if len(argv) > 1: print(__doc__.strip(), file=sys.stderr) return 2 - chrome = argv[0] + chrome = argv[0] if argv else find_chrome() + if not chrome: + return 4 if not shutil.which("ffmpeg"): return 3 t = Path(tempfile.mkdtemp(prefix="vh-cut-page.")) From 3ff1b9691b2674f31a26d06a307b35f76f9c5ad8 Mon Sep 17 00:00:00 2001 From: zhanglinghao Date: Mon, 23 Nov 2026 17:12:24 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AE=A1=E7=89=87=E7=9A=84=E8=AF=84?= =?UTF-8?q?=E5=AE=A1=E6=84=8F=E8=A7=81=EF=BC=9A=E5=8F=AA=E5=9C=A8=E4=BA=BA?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E7=9A=84=E7=82=B9=E5=87=BB=E3=80=81=E6=8C=89?= =?UTF-8?q?=E9=94=AE=E9=87=8C=E5=BC=80=E5=A7=8B=E6=92=AD=E6=94=BE=EF=BC=9B?= =?UTF-8?q?=E7=A6=BB=E5=BC=80=E6=88=90=E7=89=87=E9=A1=B5=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E6=8A=A5=E9=94=99=EF=BC=9B=E6=95=B4=E4=BD=93=E6=84=8F=E8=A7=81?= =?UTF-8?q?=E6=8C=89=E6=9D=A1=E5=AD=98=EF=BC=9B=E7=82=B9=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E9=95=9C=E5=A4=B4=E6=97=B6=E8=AF=B4=E4=B8=BA=E4=BB=80=E4=B9=88?= =?UTF-8?q?=EF=BC=9B=E6=AF=8F=E4=B8=AA=E6=84=8F=E8=A7=81=E6=A1=86=E9=83=BD?= =?UTF-8?q?=E7=94=A8=E5=AD=97=E5=86=99=E6=8C=89=E9=94=AE=EF=BC=9B=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E6=92=AD=E6=94=BE=E4=B8=80=E6=AE=B5=E4=B9=9F=E5=81=9C?= =?UTF-8?q?=E5=9C=A8=E7=BB=93=E5=B0=BE=EF=BC=9B=E6=A3=80=E6=9F=A5=E6=94=B9?= =?UTF-8?q?=E7=94=A8=20WebM=E3=80=81=E6=8C=89=E4=BA=8B=E4=BB=B6=E6=8E=A8?= =?UTF-8?q?=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changes/studio-review-feel.md | 12 ++-- tools/desk/README.md | 4 +- tools/desk/static/core.js | 8 +-- tools/desk/static/modules.js | 10 ++- tools/desk/static/studio.css | 2 + tools/desk/static/studio.js | 66 ++++++++++------- tools/desk/test_cut_page.mjs | 86 +++++++++++++++-------- tools/desk/test_cut_page.py | 34 +++++---- tools/schemas/output/timeline.schema.json | 4 +- 9 files changed, 139 insertions(+), 87 deletions(-) diff --git a/changes/studio-review-feel.md b/changes/studio-review-feel.md index 968cc8fe..9aa2164a 100644 --- a/changes/studio-review-feel.md +++ b/changes/studio-review-feel.md @@ -1,9 +1,9 @@ **Studio 审片顺手了:意见钉在你停下的地方,放大时时间轴跟着播放头走,"记下"点一次就成,分镜按镜头翻,长段落里点得到具体一镜** - Why: 用一支 12 分钟的片子在 Studio 里审初版时,时间轴的时间跟不上播放,放大以后播放头跑出画面,"记下"要点两次,分镜按"第 n 页"翻,成片里一点就是 80 多秒的一整段。 - 成片的时间轴:点过某一秒再播放、暂停,意见框跟着落到停下的那一秒(以前还钉在点过的那一秒);时间轴上只留一根播放头的线。放大后播放时,播放头走到边上,时间轴就往后翻一页,自己横着滚过就不再跟,直到再按播放;最大能放到一秒约 100 像素,12 分钟的片子也看得清一镜、一句;横着滚时左边的轨名不动。标记分行放:没把握、请你听、检查发现的、我的意见各占一行,挨得太近的再错开一行,67 个点不再叠成一串。窗口在后台时,播放的时间照样往前走。 -- 片子只在人自己点播放、按空格时才放:打开一站、点窗口把它提到前面的那一下、页面自己的代码,都不会让它出声。 -- 意见框:按下"记下"时框不再缩回去,按钮不会从鼠标底下跑开,点一次就记下。框里 ↩ 换行,⌘↩(别处 Ctrl+↩)或按钮记下,这条规矩用字写在框下面(对话那一栏照旧是 ↩ 发送)。多行的意见在列表里照原样分行。 -- 不对着片子的话:意见框"对着"那一行多了"不对着片子",写下的话进整体意见,交出去时标着〔不对着片子〕,列表里没有时间、排在前面。对整片说的话也各占一行,标着〔整片〕。 -- 分镜:agent 按 6 镜一页切开的同一段("开场(1/2)""开场(2/2)")合回一页;页签写镜号和段名("S1–S13 开场"),不再是"第 n 页";← → 一镜一镜走,选中的那一镜亮起来,意见框对着它,小播放器跳到它,走到头进下一段。 -- 成片里点得到长段落里的一镜:用剪辑表做的片子,成片的渲染记录里本来记着每一段页面里的镜头;`bin/vh timeline --resolved` 给剪辑表的每一条加上 `inner`(里面的镜头,片子里的秒,切到这一条里面;渲染时用的不是这份剪辑表就不给,并说一声)。成片模块多一行"段落"放这些条目,镜头那一行画里面的镜头,点一下意见框写"镜头 S1_3(PROLOGUE 里)"。 -- 新检查 `tools/desk/test_cut_page.py`:在真的无头 Chrome 里,用一支 12 分 20 秒、67 个标记点的编造片子,真鼠标、真按键把上面这些走一遍(`tools/ci.sh` 的 console 组);`timeline --resolved` 的那组加了剪辑表条目里镜头的用例。 +- 片子只在人自己点播放、按空格、点镜头或旁白的播放时才放(页面只在处理人自己的那一下点击、按键时开始播放):打开一站、点窗口把它提到前面的那一下、地址里的时间、页面自己的代码,都不会让它出声。选一段播放时,窗口在后台也停在这一段的结尾。离开成片页时片子还在放,也不再报错、不再去改下一页的意见框。(报告里"开站自己带声音放"那次没能复现,上面这些是把能放起来的路都堵上。) +- 意见框:按下"记下"时框不再缩回去,按钮不会从鼠标底下跑开,点一次就记下。框里 ↩ 换行,⌘↩(别处 Ctrl+↩)或按钮记下,这条规矩用字写在框下面(对话那一栏照旧是 ↩ 发送);逐条的意见框、交出去之前的整体意见框和改片对比里的回复框,也都在框下写着"↩ 换行"。用输入法上屏的那一下回车不算。多行的意见在列表里照原样分行。 +- 不对着片子的话:意见框"对着"那一行多了"不对着片子",写下的话进整体意见,交出去时标着〔不对着片子〕,列表里没有时间、排在前面。对整片说的话也各占一条,交出去时前面多了〔整片〕这个标签(交出去的格式不变,还是整体意见那一段文字,只是内容里多了标签)。一条意见里哪怕有一行以〔…〕开头,也还是一条,× 删掉的是整条。 +- 分镜:agent 按 6 镜一页切开的同一段("开场(1/2)""开场(2/2)")合回一页;页签写镜号和段名("S1–S13 开场"),不再是"第 n 页";← → 一镜一镜走,选中的那一镜亮起来,意见框对着它,小播放器跳到它,走到头进下一段。以前存下的 `board/` 地址,现在按合并以后的段数算,打开的可能是另一段。 +- 成片里点得到长段落里的一镜:用剪辑表做的片子,成片的渲染记录里本来记着每一段页面里的镜头;`bin/vh timeline --resolved` 给剪辑表的每一条加上 `inner`(里面的镜头,片子里的秒,切到这一条里面;渲染时用的不是这份剪辑表就不给,并说一声)。成片模块多一行"段落"(英文 Sections)放这些条目,镜头那一行画里面的镜头,点一下意见框写"镜头 S1_3(PROLOGUE 里)"。点不到的照实说一句:成片是按改动以前的剪辑表渲的,或者那一段是先渲好的一整段视频。`inner` 写进了 `tools/schemas/output/timeline.schema.json`。 +- 新检查 `tools/desk/test_cut_page.py`:在真的无头 Chrome 里(像 Studio 的窗口那样允许自动播放),用一支 12 分 20 秒、67 个标记点的编造片子(WebM,哪个 Chromium 都放得了),真鼠标、真按键把上面这些走一遍,时间靠跳转和视频自己的事件推进(`tools/ci.sh` 的 console 组;找不到能放这支片子的浏览器时,和别的网页检查一样本机跳过、CI 上算失败);`timeline --resolved` 的那组加了剪辑表条目里镜头的用例。 diff --git a/tools/desk/README.md b/tools/desk/README.md index a7a3a8ad..6600813f 100644 --- a/tools/desk/README.md +++ b/tools/desk/README.md @@ -81,10 +81,10 @@ bin/vh desk agents install # 装那一家的 ACP 适配器 - **账本**:DECISIONS.md 的决定表和 agent 定的事:谁定的、什么时候、为什么(人定的那几件附 REVIEW.md 那一关的原话);agent 定的每一条有"翻案",这一版写成点评。你的原话(REVIEW.md 逐字记的),`bin/vh versions` 的每一版改了什么。页签:决定 · 历史 · 文档。 - **新建**:模块栏里的"新建"回到空间,右边一列给一个空的写一句话的框(见下面"agent 那一列"的"从空间开一支新片子")。 - **点评对着什么**:有 target 的(`card:`、`seg:`、`shot:`、`fact:`、`asset:`、`led:`、`doc:`、`range:`、`atime:`、`time:`、`concept:line`)照 target 记;没有 target 的(一个读数、一个音色、BRIEF 的一行、一条检查)记进这一轮的整体意见,前面带上它的名字,比如 `〔声音 · LOUDNESS〕`。页面只做 `feedback.py` 收得下的 target 和标签:控制字符去掉,太长的名字截短,项目外的路径和倒着的时段不当 target(它们记进整体意见);提交前再查一遍,收不下的那几条列在提交单上、不发,不会让整轮被拒。反馈文件的格式不变。 -- **成片模块**(提案第 4 节):左边是列表(镜头、旁白稿、点评、检查),中间是画面:四周中性灰,上面一行等宽字的读数(哪一镜、要看懂什么、尺寸、帧率、第几版;这一版没有声音时,读数里写着“这一版没有声音”);播放键旁边有静音和音量,浏览器记住;左边和中间的下面是时间线,三组轨道:画面(章节、带缩略图的镜头)、声音(旁白、音乐的段落和节拍、卡点、波形)、审阅(你的点评,agent 没把握和请你听的记号,检查查出的问题,这一版改了哪里)。点一下选这一秒,拖一下选一段,点镜头或章节选中它;`I` `O` 设入点出点,拖的时候吸附到镜头边界、节拍、旁白和记号,`N` 跳到下一处要看的,空格播放(选了一段就只播这一段),`←` `→` 逐镜(选中那一镜,和点它一样:写点评的框跟着换),`,` `.` 逐帧、`Shift` `←` `→` 一秒一秒走(选着的是一秒时,那一秒跟着走),`C` 在这一秒写一条。剪辑软件的规矩:点哪,播放头就到哪;拖是拖着看;`Shift` + 拖选一段。选着的是一秒时,播放、暂停以后它跟到停下的那一秒(写意见的框也跟着),时间线上只有播放头一根线;选着一段、一镜时不动。放大最多到一秒约 100 像素(长片也看得清一镜、一句),放大后播放,播放头走到边上,时间线往后翻一页;自己横着滚过就不再跟,直到再按播放。横着滚时轨道名不动。审阅那组的记号一种一行(没把握、请你听、检查查出的、你的点评),挨得太近的再错开一行,几十个也不叠在一起。用剪辑表做的片子,成片的渲染记录里有每段页面里的镜头(`bin/vh timeline --resolved` 的 `inner`):多一行"段落"放剪辑表的条目,镜头那一行画里面的镜头,点得到"S1_3(PROLOGUE 里)"。片子只在人自己点播放、按空格时才放:打开一站、点窗口把它提到前面的那一下、页面的代码都不会让它出声。三种布局:审片(画面最大,只留主轨道;关卡 ③ 打开就是它)、精修、听声音(旁白稿和声音轨道放大,波形最高,按全片最响的地方画满)。窄屏(手机)上先是画面,接着是右边一列(要你定的、提交),再是时间线,列表在最后。有留着的上一版时,可以和它擦着对比(只看)。数据都来自已有的命令:`bin/vh timeline --resolved`(镜头、章节、旁白、节拍)、`bin/vh thumbs`(拖动时每一秒的画面、镜头图)、`bin/vh peaks`(波形)、`bin/vh check`(问题和它们的时间)、`bin/vh versions`(第几版、改了哪里、上一版);缺哪样,那条轨道就照实说空,写上做它的命令。没有成片时,画面是分镜的关键帧,没有关键帧就是联系表;要的那支片子不在了(移走、改名、在别的硬盘上),画面下写明是哪个文件。页面从不请求不在的文件:关卡页里引用的文件不在了,那里写"文件不在了",不给链接;镜头的关键帧不在,就当没有。 +- **成片模块**(提案第 4 节):左边是列表(镜头、旁白稿、点评、检查),中间是画面:四周中性灰,上面一行等宽字的读数(哪一镜、要看懂什么、尺寸、帧率、第几版;这一版没有声音时,读数里写着“这一版没有声音”);播放键旁边有静音和音量,浏览器记住;左边和中间的下面是时间线,三组轨道:画面(章节、带缩略图的镜头)、声音(旁白、音乐的段落和节拍、卡点、波形)、审阅(你的点评,agent 没把握和请你听的记号,检查查出的问题,这一版改了哪里)。点一下选这一秒,拖一下选一段,点镜头或章节选中它;`I` `O` 设入点出点,拖的时候吸附到镜头边界、节拍、旁白和记号,`N` 跳到下一处要看的,空格播放(选了一段就只播这一段),`←` `→` 逐镜(选中那一镜,和点它一样:写点评的框跟着换),`,` `.` 逐帧、`Shift` `←` `→` 一秒一秒走(选着的是一秒时,那一秒跟着走),`C` 在这一秒写一条。剪辑软件的规矩:点哪,播放头就到哪;拖是拖着看;`Shift` + 拖选一段。选着的是一秒时,播放、暂停以后它跟到停下的那一秒(写意见的框也跟着),时间线上只有播放头一根线;选着一段、一镜时不动。放大最多到一秒约 100 像素(长片也看得清一镜、一句),放大后播放,播放头走到边上,时间线往后翻一页;自己横着滚过就不再跟,直到再按播放。横着滚时轨道名不动。审阅那组的记号一种一行(没把握、请你听、检查查出的、你的点评),挨得太近的再错开一行,几十个也不叠在一起。用剪辑表做的片子,成片的渲染记录里有每段页面里的镜头(`bin/vh timeline --resolved` 的 `inner`):多一行"段落"放剪辑表的条目,镜头那一行画里面的镜头,点得到"S1_3(PROLOGUE 里)";点不到时下面一行说为什么(成片是按改动以前的剪辑表渲的,或者那一段是先渲好的一整段视频)。片子只在处理人自己的点击、按键时才开始放:打开一站、点窗口把它提到前面的那一下、地址里的时间、页面的代码都不会让它出声;选一段播放时,窗口在后台也停在这一段的结尾。三种布局:审片(画面最大,只留主轨道;关卡 ③ 打开就是它)、精修、听声音(旁白稿和声音轨道放大,波形最高,按全片最响的地方画满)。窄屏(手机)上先是画面,接着是右边一列(要你定的、提交),再是时间线,列表在最后。有留着的上一版时,可以和它擦着对比(只看)。数据都来自已有的命令:`bin/vh timeline --resolved`(镜头、章节、旁白、节拍)、`bin/vh thumbs`(拖动时每一秒的画面、镜头图)、`bin/vh peaks`(波形)、`bin/vh check`(问题和它们的时间)、`bin/vh versions`(第几版、改了哪里、上一版);缺哪样,那条轨道就照实说空,写上做它的命令。没有成片时,画面是分镜的关键帧,没有关键帧就是联系表;要的那支片子不在了(移走、改名、在别的硬盘上),画面下写明是哪个文件。页面从不请求不在的文件:关卡页里引用的文件不在了,那里写"文件不在了",不给链接;镜头的关键帧不在,就当没有。 - **右边一列**:这一轮要你定的事(关卡页的选项卡,能点,推荐的预先选上,`1`–`9` 给当前这件选第几个),它最没把握的和请你听的(点一下到那一秒),你的意见(点一下回到那一处,× 删掉),下一步、正在跑的命令和花费(`bin/vh status` 写给 agent 的英文,中文界面里认得的说成中文,不认得的照原话、标明是它的话;项目文件夹写成 `<项目>`),一个"交给 agent",和一个写意见的框:对着什么,就是模块里选中的那一处(一秒、一段、一个镜头、一章、一个记号、一张卡),没选就是整个模块(记进这一轮的整体意见)。右栏顶上两页:"对话"是和 agent 说话(下面一节),"这一站"是上面这些;这一轮有要你定的事时先打开"这一站",agent 等你批准时"对话"上亮一个琥珀色的数。 - **提交**:先列出每件决定选了什么(没动的标"按推荐")和每条点评,可以再写一句整体意见;走的还是 `POST …/feedback` 这一条通道,`bin/vh desk wait` 照样被唤醒。服务没起来时,回复复制到剪贴板。每次提交是一份反馈文件、REVIEW.md 里一节,所以一样东西只交一次:交上去的点评从草稿里拿掉(右栏写"已交 N 条"),决定交过以后只有改了选项才再交;写了一半没记下的字照留。交完重新读项目时,原来的画面留在屏幕上,新数据到了才换。 -- **输入框**:写意见的框里 `↩` 换行,`⌘↩`(别处 `Ctrl+↩`)或"记下"按钮记下一条,这条规矩用字写在框下面;"对话"那一页的框是 `↩` 发送、`⇧↩` 换行,也写在它旁边。框里有字时保持展开,按"记下"时它不缩,按钮不会从鼠标底下跑开。`Esc` 离开输入框(写的字留着),`⌘↩` 记下一条后也离开,接着按 `N`、`←` `→`、空格都是给片子的。"对着"那一行的"不对着片子":写下的话进整体意见,交出去时标着〔不对着片子〕(比如对 Studio 本身的意见);对整片说的标着〔整片〕。整体意见在"我的意见"里一条一行,没有时间,排在前面。 +- **输入框**:写意见的框里 `↩` 换行,`⌘↩`(别处 `Ctrl+↩`)或"记下"按钮记下一条,这条规矩用字写在框下面;逐条的意见框、交出去之前的整体意见框和改片对比里的回复框也都写着"↩ 换行";"对话"那一页的框是 `↩` 发送、`⇧↩` 换行,也写在它旁边。框里有字时保持展开,按"记下"时它不缩,按钮不会从鼠标底下跑开。`Esc` 离开输入框(写的字留着),`⌘↩` 记下一条后也离开,接着按 `N`、`←` `→`、空格都是给片子的。"对着"那一行的"不对着片子":写下的话进整体意见,交出去时标着〔不对着片子〕(比如对 Studio 本身的意见);对整片说的标着〔整片〕。整体意见在"我的意见"里一条一行,没有时间,排在前面。 - **主题**:暗场(默认)、棱镜、舰桥三套,顶上切换,浏览器记住;三套是 `ui.css` 里同一组语义变量的三块取值,默认用哪一套是 `ui.js` 里的一个值(`DEFAULT_THEME`)。四条规矩不随主题变:画面四周是中性灰;读数用等宽字;颜色只说谁、在发生什么(青是你选的和标的,紫是 agent,红是播放头、出错和正在发生,琥珀是等你,绿是过了),其余是灰;只有深色。 - **关卡页的标尺**(静态页和模块下面的关卡页):有镜头表(关卡页自己的分段和镜头,或项目的 `shots.json`、剪辑表)时标镜头和分段;都没有时用 BRIEF 大纲表的段落和时间;大纲也没写时间时,只是一把带秒刻度的尺子,加上没把握和请你听的记号。 - **键盘**:`/` 搜片子(↑↓ 选,回车打开,Esc 关);成片模块的见上面;关卡页里空格播放,`←` `→` 跳镜头,`1`–`9` 选选项。 diff --git a/tools/desk/static/core.js b/tools/desk/static/core.js index 812ebc35..5bdf6331 100644 --- a/tools/desk/static/core.js +++ b/tools/desk/static/core.js @@ -43,7 +43,7 @@ const STR = { c_spent: "已花 {s}", c_of: "预算 {l}", c_none_mine: "还没写。点一下时间轴或一个镜头,在下面写一句。", who_agent: "agent", who_person: "你", who_nobody: "已交付", submit_round: "交给 agent", c_whole_note: "整体", round_quiet: "现在没有等你定的事。", static_page: "单独打开审阅页", recent: "最近定下的", agent_decided_k: "agent 定的 · {x}", at: "对着", whole: "这一页", whole_film: "整片", to_whole: "取消选中", - c_ph: "对{x}的意见写在这里,点“交给 agent”时一起交出去", note_add: "记下", note_keys: "⌘↩", noted: "记下了:{x}", del: "删", + c_ph: "对{x}的意见写在这里,点“交给 agent”时一起交出去", note_add: "记下", noted: "记下了:{x}", del: "删", d_dropped: "这 {n} 条写不进去,不会交给 agent(对着的东西认不出,或者字太长)", d_title: "交给 agent 之前看一眼", d_decisions: "决定", d_items: "意见", by_rec: "(你没选,按推荐)", d_none: "你没写具体意见。", general: "整体意见(可选)", general_ph: "比如:整体节奏偏慢;开场很好……", submit: "交给 agent", cancel: "再看看", preview: "会交给 agent 的原文", @@ -75,7 +75,7 @@ const STR = { e_diff: "这一版没记下改了哪里(只有局部重新渲染的版本会记)", e_marks: "还没有标记", whole_render: "整支重渲", diff_label: "{v} 改了这里", next_q: "下一处 · {x}", no_next: "后面没有要看的了", k_least: "agent 没把握", k_listen: "请你听", k_check: "检查发现的", k_mine: "我的意见", sev_fail: "没过", sev_warn: "注意", no_thumbs: "还没做缩略图:拖动时看不到每一秒的画面", - note_keys_w: "{m}↩ 记下 · ↩ 换行", not_film: "不对着片子", not_film_tip: "写一句不对着片子哪一处的话,比如对 Studio 的意见;交出去时会标明", shot_in: "{s}({p} 里)", ln_parts: "段落", l_part: "段落 {x}", ph_not_film: "不对着片子哪一处的话写在这里(比如对 Studio 的意见),点“交给 agent”时一起交出去", + note_keys_w: "{m}↩ 记下 · ↩ 换行", not_film: "不对着片子", not_film_tip: "写一句不对着片子哪一处的话,比如对 Studio 的意见;交出去时会标明", shot_in: "{s}({p} 里)", ln_parts: "段落", l_part: "段落 {x}", why_clip: "{x} 是先渲好的一整段视频,里面的镜头点不到", why_more: " 和另外 {n} 段", why_stale: "成片是按改动以前的剪辑表渲的:段落里的镜头,重新渲染以后才点得到", fb_keys: "↩ 换行 · 写下就记着了", keys_nl: "↩ 换行", ph_not_film: "不对着片子哪一处的话写在这里(比如对 Studio 的意见),点“交给 agent”时一起交出去", // the other modules (the desk's views, moved in) sub_outline: "大纲", sub_script: "字幕 / 旁白", sub_facts: "事实", sub_check: "检查", sub_versions: "版本", sub_decisions: "决定", sub_history: "历史", sub_docs: "文档", concept: "立意", spine: "故事线", motif: "贯穿全片的", end: "看完能记住", spec: "规格", outline_tip: "点色块跳到那一段", @@ -201,7 +201,7 @@ const STR = { c_spent: "{s} spent", c_of: "of {l}", c_none_mine: "None yet. Click the timeline or a shot, then write a line below.", who_agent: "agent", who_person: "you", who_nobody: "delivered", submit_round: "Send to agent", c_whole_note: "Overall", round_quiet: "Nothing to decide now.", static_page: "Open the review page", recent: "Recently decided", agent_decided_k: "the agent decided · {x}", at: "On", whole: "this page", whole_film: "the whole film", to_whole: "Deselect", - c_ph: "A note on {x}: it goes when you press “Send to agent”", note_add: "Add note", note_keys: "⌘↩", noted: "Noted: {x}", del: "Delete", + c_ph: "A note on {x}: it goes when you press “Send to agent”", note_add: "Add note", noted: "Noted: {x}", del: "Delete", d_dropped: "{n} can't be sent: what they are on can't be read, or they are too long", d_title: "Before you send it", d_decisions: "Decisions", d_items: "Notes", by_rec: " (you didn't pick: the recommended one)", d_none: "You wrote no notes.", general: "Overall (optional)", general_ph: "e.g. the pace drags overall; the opening works…", submit: "Send to agent", cancel: "Keep looking", preview: "The text that will be sent", @@ -232,7 +232,7 @@ const STR = { e_diff: "This version doesn't record what changed (only a partial re-render records it)", e_marks: "No marks yet", whole_render: "re-rendered whole", diff_label: "{v} changed this", next_q: "Next · {x}", no_next: "Nothing more after here", k_least: "agent unsure", k_listen: "listen", k_check: "found by the check", k_mine: "my note", sev_fail: "failed", sev_warn: "warning", no_thumbs: "No thumbnails yet: dragging won't show each second", - note_keys_w: "{m}↩ adds the note · ↩ new line", not_film: "Not about the film", not_film_tip: "A note about no moment of the film, such as one about Studio itself; it goes marked as such", shot_in: "{s} (in {p})", ln_parts: "Parts", l_part: "Part {x}", ph_not_film: "A note about no moment of the film (Studio itself, say): it goes when you press “Send to agent”", + note_keys_w: "{m}↩ adds the note · ↩ new line", not_film: "Not about the film", not_film_tip: "A note about no moment of the film, such as one about Studio itself; it goes marked as such", shot_in: "{s} (in {p})", ln_parts: "Sections", l_part: "Section {x}", why_clip: "{x}: a video made beforehand, in one piece, so the shots inside it can't be picked", why_more: " and {n} more", why_stale: "The film was rendered from an earlier edit list: the shots inside its sections can be picked once it is rendered again", fb_keys: "↩ new line · kept as you type", keys_nl: "↩ new line", ph_not_film: "A note about no moment of the film (Studio itself, say): it goes when you press “Send to agent”", sub_outline: "Outline", sub_script: "Captions / narration", sub_facts: "Facts", sub_check: "Check", sub_versions: "Versions", sub_decisions: "Decisions", sub_history: "History", sub_docs: "Documents", concept: "Concept", spine: "Spine", motif: "Recurring motif", end: "Remembered after", spec: "Spec", outline_tip: "click a block to jump to it", seg_n: "Part {i}", know: "The viewer knows / feels", visual: "Key visual", seg_caps: "{n} {n|line|lines} in this part", to_script: "go through them →", bars: "bars {b}", diff --git a/tools/desk/static/modules.js b/tools/desk/static/modules.js index a58276e1..ab035d23 100644 --- a/tools/desk/static/modules.js +++ b/tools/desk/static/modules.js @@ -285,20 +285,18 @@ MODVIEW.outline = { main: mOutline2, wire: wireOutline2 }; /* ---------- 分镜: a page a part, the grey box, each shot with what it should get across ---------- */ moduleWords({ - board_title: "第 {i} 页 · {x}", board_title2: "{x} · {r}", board_keys: "← → 一镜一镜看", this_part: "这一段", part_seconds: "这一段的 {a}–{b}", board_sub2: "标黄的是 agent 没把握的镜头。其余的没写意见就算通过。", - page_n: "第 {i} 页", this_page: "这一页", shots_k: "镜头", shots_n: "{n} 镜", unsure_k: "没把握", none: "没有", span_k: "时长", grey_k: "粗样", grey_note: "先看节奏和构图,颜色后面再上", + board_title2: "{x} · {r}", board_keys: "← → 一镜一镜看", this_part: "这一段", part_seconds: "这一段的 {a}–{b}", board_sub2: "标黄的是 agent 没把握的镜头。其余的没写意见就算通过。", + shots_k: "镜头", shots_n: "{n} 镜", unsure_k: "没把握", none: "没有", span_k: "时长", grey_k: "粗样", grey_note: "先看节奏和构图,颜色后面再上", no_anim: "还没有粗样视频。", anim_gone: "粗样视频找不到了,可能被挪走了。", default_pass: "没写意见就通过", you_said: "你说了", trans_k: "转场", board_none: "还没有镜头表。", avg_s: "平均一镜 {s} 秒", plan_k: "打算改", bar_board: "分镜 · {s}", bar_said: "分镜 · {s}。你当时说:「{q}」", to_sound: "去声音", pass_done: "已通过", - page_seconds: "这一页的 {a}–{b}", skip_sub: "这一站没停下来给你看(你说了不用停)。只能看;要改就写一条意见。", }, { - board_title: "Page {i} · {x}", board_title2: "{x} · {r}", board_keys: "← → shot by shot", this_part: "This part", part_seconds: "this part, {a}–{b}", board_sub2: "Amber shots are the ones the agent is unsure about. The rest pass if you write no note.", - page_n: "Page {i}", this_page: "This page", shots_k: "Shots", shots_n: "{n} {n|shot|shots}", unsure_k: "Unsure", none: "none", span_k: "Span", grey_k: "Rough cut", grey_note: "Rhythm and framing first; colour comes later", + board_title2: "{x} · {r}", board_keys: "← → shot by shot", this_part: "This part", part_seconds: "this part, {a}–{b}", board_sub2: "Amber shots are the ones the agent is unsure about. The rest pass if you write no note.", + shots_k: "Shots", shots_n: "{n} {n|shot|shots}", unsure_k: "Unsure", none: "none", span_k: "Span", grey_k: "Rough cut", grey_note: "Rhythm and framing first; colour comes later", no_anim: "No rough cut video yet.", anim_gone: "The rough cut video can't be found; it may have been moved.", default_pass: "passes without a note", you_said: "you said", trans_k: "Transition", board_none: "No shot list yet.", avg_s: "{s} s a shot", plan_k: "will change", bar_board: "Storyboard · {s}", bar_said: "Storyboard · {s}. You said: “{q}”", to_sound: "To the sound", pass_done: "approved", - page_seconds: "this page, {a}–{b}", skip_sub: "This stop was skipped (you said not to stop). To look at only; to change it, write a note.", }); const shotName = (id) => String(id || "").replace(/^([A-Za-z]+)0+(?=\d)/, "$1"); // one way to write a shot: S4, never S04 or S004 diff --git a/tools/desk/static/studio.css b/tools/desk/static/studio.css index 68e93cd9..2b89635c 100644 --- a/tools/desk/static/studio.css +++ b/tools/desk/static/studio.css @@ -646,3 +646,5 @@ blockquote{margin:8px 0;padding:4px 14px;border-left:2px solid var(--rule-2);col .note-list.mine .nt,.lists .lrow .tx{white-space:pre-line} .composer #sayAdd{margin-left:auto} /* on a row of its own when the place's name is long: still at the right, where it was */ .composer .say-keys{margin:-4px 0 0;font-size:var(--fs-label);color:var(--ink-3);text-align:right} /* the keys in words, under the box they are for */ +.box-keys{margin:2px 0 0;font-size:var(--fs-label);color:var(--ink-3);text-align:right} /* a note box's keys, in words, under it */ +.lane.why .trk{height:20px} diff --git a/tools/desk/static/studio.js b/tools/desk/static/studio.js index c03253de..409c4863 100644 --- a/tools/desk/static/studio.js +++ b/tools/desk/static/studio.js @@ -483,9 +483,14 @@ function renderMarks() { // the round's places in the film: on the round's own } const COLOPEN = { least: false, listen: false }; function myItems() { return Object.entries(FB.items).filter(([, v]) => v && v.status); } -function generalParts() { // the overall words as written, a note each: "〔不对着片子〕…" its label and its words (a note keeps its own lines) - return String(FB.general || "").split(/\n(?=〔)/).filter((x) => x.trim()).map((x) => { const m = x.match(/^〔([^〕]*)〕([\s\S]*)$/); return m ? { label: m[1], text: m[2] } : { label: "", text: x }; }); -} +const joinGeneral = (L) => L.map((g) => (g.label ? `〔${g.label}〕` : "") + g.text).join("\n"); // what goes: the notes, each "〔its place〕its words", a line apart, as before +function generalParts() { // the overall notes, each with its label ("不对着片子", "整片", a module) and its words, its own lines kept + const L = Array.isArray(FB.generalItems) ? FB.generalItems.filter((g) => g && typeof g.text === "string") : []; + if (L.length && joinGeneral(L) === (FB.general || "")) return L; + const g = String(FB.general || ""); if (!g.trim()) return []; // an older draft, or what a submission left: its text is one note + const m = g.match(/^〔([^〕]*)〕([\s\S]*)$/); return [m ? { label: m[1], text: m[2] } : { label: "", text: g }]; +} +function setGeneral(L) { FB.generalItems = L; FB.general = joinGeneral(L); } function renderMine() { const items = myItems().sort((a, b) => (a[1].t != null ? a[1].t : 1e9) - (b[1].t != null ? b[1].t : 1e9)); const st = { ok: t("st_ok"), change: t("st_change"), ask: t("st_ask") }; @@ -556,7 +561,7 @@ $("#colBody").addEventListener("scroll", fadeMore); window.addEventListener("res $("#colBody").addEventListener("click", (e) => { const x = e.target.closest("[data-del]"); if (x) { e.stopPropagation(); const g = x.dataset.del.match(/^#general(?::(\d+))?$/); - if (g) FB.general = g[1] == null ? "" : String(FB.general || "").split(/\n(?=〔)/).filter((y) => y.trim()).filter((y, i) => i !== +g[1]).join("\n"); else delete FB.items[x.dataset.del]; save(); return; } + if (g) setGeneral(g[1] == null ? [] : generalParts().filter((y, i) => i !== +g[1])); else delete FB.items[x.dataset.del]; save(); return; } const li = e.target.closest("[data-goto]"); if (li && !e.target.closest("button:not([data-goto]),a,input,textarea")) { const tg = li.dataset.goto, k = tg.split(":")[0], words = cut(((li.querySelector("span:last-of-type") || li).textContent || "").trim(), 28); @@ -600,10 +605,10 @@ function buildComposer() { $("#toNone").addEventListener("click", () => { if (CUT) CUT.clear(); setScope({ label: t("not_film"), none: true }); $("#say").focus(); }); // a note about no moment of the film: the overall words, named $("#sayAdd").addEventListener("mousedown", (e) => e.preventDefault()); // the box keeps its focus and its size while the button is pressed: the button does not move away from the click $("#sayAdd").addEventListener("click", addNote); - $("#say").addEventListener("keydown", (e) => { if (e.key === "Enter" && (e.metaKey || e.ctrlKey) && !e.isComposing) { e.preventDefault(); addNote(); } }); + $("#say").addEventListener("keydown", (e) => { if (e.key === "Enter" && (e.metaKey || e.ctrlKey) && !e.isComposing && e.keyCode !== 229) { e.preventDefault(); addNote(); } }); } const MAC = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent || ""); -function scopeLabel() { return SCOPE ? SCOPE.label : MOD === "cut" ? t("whole_film") : t("whole", { m: t("m_" + (MOD || "cut")) }); } +function scopeLabel() { return SCOPE ? SCOPE.label : MOD === "cut" ? t("whole_film") : MOD === "board" ? t("this_part") : t("whole", { m: t("m_" + (MOD || "cut")) }); } function updateComposer() { if (!$("#composer").dataset.ready) return; const x = scopeLabel(); @@ -621,9 +626,8 @@ function setScope(s) { function addNote() { const ta = $("#say"), text = ta.value.trim(); if (!text) { ta.focus(); return; } - if (!SCOPE || !SCOPE.target) { // the whole module, or a place with no target of its own: the round's overall words, named - const pre = SCOPE ? `〔${SCOPE.label}〕` : MOD && MOD !== "cut" ? `〔${t("m_" + MOD)}〕` : `〔${t("whole_film")}〕`; // named, so each note stays a note of its own in the list - FB.general = (FB.general ? FB.general + "\n" : "") + pre + text; + if (!SCOPE || !SCOPE.target) { // the whole module, or a place with no target of its own: the round's overall words, a note of their own, named + setGeneral(generalParts().concat([{ label: SCOPE ? SCOPE.label : MOD && MOD !== "cut" ? t("m_" + MOD) : t("whole_film"), text }])); } else { const cur = FB.items[SCOPE.target]; FB.items[SCOPE.target] = Object.assign({}, cur || {}, { status: cur && cur.status === "ask" ? "ask" : "change", label: SCOPE.label, text: cur && cur.text ? cur.text + "\n" + text : text }, @@ -685,7 +689,7 @@ function openConfirm() { + (p.dropped.length ? `

    ${esc(t("d_dropped", { n: p.dropped.length }))}

    ${p.dropped.map((i) => `
  • ${esc(cut(i.label, 60))}${esc(cut(i.text, 120))}
  • `).join("")}` : ""); const c = $("#confirm"); c.innerHTML = `

    ${esc(t("d_title"))}

      ${decs ? `

      ${esc(t("d_decisions"))}

      ${decs}` : ""}${leastHtml}

      ${esc(t("d_items"))}

      ${items || `
    • ${esc(t("d_none"))}
    • `}${FB.general ? `
    • ${esc(t("overall"))}${esc(FB.general)}
    • ` : ""}
    - +

    ${esc(t("keys_nl"))}

    ${esc(t("submit_hint"))}

    ${esc(t("preview"))}
    `; @@ -825,7 +829,7 @@ function fbCtl(target, label, opt = {}) { ${st ? "" : `${esc(opt.def || t("fb_def"))}`}
    - +

    ${esc(t("fb_keys"))}

    ${opt.suggest != null && st === "change" ? `` : ""}
    `; } @@ -1097,7 +1101,7 @@ function openRevision(r) { ${r.state === "pending" && !readOnly() ? `
    -
    +

    ${esc(t("keys_nl"))}

    ` : ""} `; @@ -1187,6 +1191,13 @@ function openRevision(r) { function CutModule(area) { const T = TL(), ST = D.studio || {}, fps = +T.fps || 30; const film = filmPath(), shots = cutShots(), chapters = cutChapters(shots), parts = cutParts(); + const whyWhole = (() => { // an edit list's entry shown whole: the film was rendered from an earlier edit list, or the entry is a video made beforehand + if (T.shots_from !== "edit.json") return ""; + if ((T.missing || []).some((m) => /another edit\.json/.test((m && m.why) || ""))) return t("why_stale"); + const flat = cutRows().filter((r) => !(Array.isArray(r.inner) && r.inner.length) && /^(clip|film)$/.test(r.kind || "")).map((r) => String(r.id)); + if (!flat.length) return ""; + return t("why_clip", { x: flat.slice(0, 3).join(LANG === "zh" ? "、" : ", ") + (flat.length > 3 ? t("why_more", { n: flat.length - 3 }) : "") }); + })(); const lines = (T.narration && T.narration.length ? T.narration : T.captions || []).filter((x) => x.start != null && x.end != null).map((x, i) => ({ id: String(x.id || i + 1), t0: +x.start, t1: +x.end, text: x.text || "" })); const linesAreCaptions = !(T.narration && T.narration.length) && lines.length > 0; const M = D.music || {}, sections = (M.sections || []).filter((s) => s.end > s.start), hitsL = M.hits || [], beats = T.beats || []; @@ -1210,7 +1221,11 @@ function CutModule(area) { let zoom = 1, snapOn = store.get("desk:cut-snap") !== false, safe = false, cmp = false, wipe = 0.5; let closeRevision = null; let SEL = null, inPt = null, stopAt = null, clockT = 0, raf = 0, simPlaying = false, simLast = 0; - let follow = true, autoAt = -1, focusAt = 0, freshClick = false; // the timeline pages along with the playhead until the person scrolls it; a click that brings the window up plays nothing + let follow = true, autoAt = -1, focusAt = 0, freshClick = false, trusted = false, dead = false; + // trusted: true from the capture of a trusted click, press or key until that event's handling is over (a timer, not a microtask, + // which would run between its listeners); an element's click() from code is an untrusted click and sets it false + const gesture = (e) => { trusted = e.isTrusted; setTimeout(() => { trusted = false; }, 0); }; + ["click", "dblclick", "pointerup", "keydown"].forEach((k) => document.addEventListener(k, gesture, true)); // the timeline pages along with the playhead until the person scrolls it; a click that brings the window up plays nothing const notesOf = () => myItems().filter(([, v]) => v.t != null).map(([k, v]) => ({ kind: "mine", t: +v.t, t1: v.t1 != null ? +v.t1 : null, target: k, label: v.label || k, note: v.text || "" })); const agentMarks = () => gateMarks().filter((m) => m.t != null).map((m) => ({ kind: m.kind, t: +m.t, t1: m.t1 != null ? +m.t1 : null, target: m.target, label: m.id || "", note: m.note })); const checkMarks = () => findings.map((f, i) => ({ kind: "check", t: +f.t, t1: f.t1 != null ? +f.t1 : null, target: "time:" + (+f.t).toFixed(1), label: f.kind || "", note: shotText(f.message || ""), sev: f.severity, i })); @@ -1290,16 +1305,17 @@ function CutModule(area) { tick(); if (play) start(); } - function start() { // only ever from the person's own click or key: never from opening a stop, a time in the address, or code - if (video && navigator.userActivation && !navigator.userActivation.isActive) return; + function start() { // only while a person's own click, key or press is being handled: never from opening a stop, a time in the address, or code + if (video && !trusted) return; if (stopAt != null && now() >= stopAt - 0.04) stopAt = null; follow = true; if (video) { video.play().catch(() => {}); if (vb && cmp) vb.play().catch(() => {}); } else if (dur) { if (clockT >= dur - 0.01) clockT = 0; simPlaying = true; simLast = performance.now(); } loop(); } - function stop() { const was = simPlaying; if (video) { video.pause(); if (vb) vb.pause(); } simPlaying = false; tick(); if (!video && was) settle(); } + function stop() { if (dead) return; const was = simPlaying; if (video) { video.pause(); if (vb) vb.pause(); } simPlaying = false; tick(); if (!video && was) settle(); } function settle() { // stopped: a selected second (what the note box is on) moves to where the picture stopped, as an editor's marker goes where you pause + if (dead) return; const x = now(); if (drag) return; // a scrub ends by its own rule if (SEL && SEL.kind === "time" && Math.abs(SEL.t - x) > 0.05 && SCOPE && String(SCOPE.target || "").startsWith("time:")) select({ kind: "time", t: x, label: fmt(x) }); @@ -1310,22 +1326,23 @@ function CutModule(area) { if (SEL && SEL.t1 != null && (now() < SEL.t - 0.01 || now() >= SEL.t1 - 0.04)) { seek(SEL.t); stopAt = SEL.t1; } // a span selected: play it start(); } + function atEnd() { if (stopAt != null && now() >= stopAt) { const x = stopAt; stopAt = null; stop(); seek(x); } } // a span played to its end stops there function loop() { cancelAnimationFrame(raf); const step = (ts) => { if (!video && simPlaying) { clockT += (ts - simLast) / 1000; simLast = ts; if (clockT >= dur) { clockT = dur; simPlaying = false; settle(); } } - if (stopAt != null && now() >= stopAt) { stop(); seek(stopAt); stopAt = null; } + atEnd(); tick(); if (playing()) raf = requestAnimationFrame(step); }; raf = requestAnimationFrame(step); } if (video) { - video.addEventListener("loadedmetadata", () => { if (isFinite(video.duration) && video.duration > 0) dur = video.duration; lastShot = undefined; fit(); draw(); tick(); }); - video.addEventListener("play", loop); - video.addEventListener("pause", () => { if (vb) vb.pause(); tick(); settle(); }); - video.addEventListener("seeked", tick); - video.addEventListener("timeupdate", () => { if (!video.paused) tick(); }); // a window in the background gets no animation frames: the time still moves + video.addEventListener("loadedmetadata", () => { if (dead) return; if (isFinite(video.duration) && video.duration > 0) dur = video.duration; lastShot = undefined; fit(); draw(); tick(); }); + video.addEventListener("play", () => { if (!dead) loop(); }); + video.addEventListener("pause", () => { if (dead) return; if (vb) vb.pause(); tick(); settle(); }); + video.addEventListener("seeked", () => { if (!dead) tick(); }); + video.addEventListener("timeupdate", () => { if (dead || video.paused) return; atEnd(); tick(); }); // a window in the background gets no animation frames: the time and a span's end still hold video.addEventListener("error", () => { frame.insertAdjacentHTML("beforeend", `

    ${esc(film)}

    `); }); } @@ -1477,7 +1494,7 @@ function CutModule(area) { const grp = (k, name) => { const shut = layout !== "review" && closed.has(k); return `
    ${shut ? `${esc(t("g_folded"))}` : ""}
    `; }; tl.style.width = zoom * 100 + "%"; tl.innerHTML = `
    ${rulerTicks()}
    ` - + grp("pic", t("g_pic")) + lane("chap", t("ln_chap"), chapH, "pic", t("e_chap")) + (parts.length ? lane("parts", t("ln_parts"), partH, "pic") : "") + lane("shots", t("ln_shots"), shotH, "pic", t("e_shots")) + + grp("pic", t("g_pic")) + lane("chap", t("ln_chap"), chapH, "pic", t("e_chap")) + (parts.length ? lane("parts", t("ln_parts"), partH, "pic") : "") + lane("shots", t("ln_shots"), shotH, "pic", t("e_shots")) + (whyWhole ? lane("thin why", "", `${esc(whyWhole)}`, "pic") : "") + grp("sound", t("g_sound")) + lane("voice extra", t("ln_voice"), lineH, "sound", t("e_voice")) + lane("music extra", t("ln_music"), beatH + secH, "sound", t("e_music")) + (hitsL.length ? lane("thin extra", t("ln_hits"), hitH, "sound") : "") + lane("wave extra", t("ln_wave"), wave(), "sound", t("e_wave")) + grp("review", t("g_review")) + lane("marks", t("ln_marks"), markH, "review", t("e_marks")) + (diffH ? lane("thin extra", t("ln_diff"), diffH, "review") : "") // what changed: a lane only when it is on record @@ -1503,6 +1520,7 @@ function CutModule(area) { /* the playhead, the readout, the picture when there is no film */ let lastShot = null, lastPlaying = null; function tick() { + if (dead) return; const x = now(), ph = $(".tl-ph", tl); if (playing() !== lastPlaying) { lastPlaying = playing(); $("#cPlay", area).innerHTML = svg(lastPlaying ? "pause" : "play"); paintSel(); } if (ph) ph.style.left = pct(x) + "%"; @@ -1744,7 +1762,7 @@ function CutModule(area) { if (target.startsWith("chapter:") || target.startsWith("seg:")) return pickThing(target); if (tt != null) select(t1 != null ? { kind: "range", t: tt, t1, label: `${fmt(tt)}–${fmt(t1)}` } : { kind: "time", t: tt, label: fmt(tt) }); }, - destroy() { if (closeRevision) closeRevision(); window.removeEventListener("focus", onFocus); document.removeEventListener("focusin", onNote); document.removeEventListener("keydown", keys); document.removeEventListener("keyup", spaceUp); area.removeEventListener("click", eatClick, true); cancelAnimationFrame(raf); if (video) video.pause(); if (vb) vb.pause(); if (ro) ro.disconnect(); else window.removeEventListener("resize", fit); }, + destroy() { dead = true; ["click", "dblclick", "pointerup", "keydown"].forEach((k) => document.removeEventListener(k, gesture, true)); if (closeRevision) closeRevision(); window.removeEventListener("focus", onFocus); document.removeEventListener("focusin", onNote); document.removeEventListener("keydown", keys); document.removeEventListener("keyup", spaceUp); area.removeEventListener("click", eatClick, true); cancelAnimationFrame(raf); if (video) video.pause(); if (vb) vb.pause(); if (ro) ro.disconnect(); else window.removeEventListener("resize", fit); }, }; } diff --git a/tools/desk/test_cut_page.mjs b/tools/desk/test_cut_page.mjs index 88e18f34..5566a9f9 100644 --- a/tools/desk/test_cut_page.mjs +++ b/tools/desk/test_cut_page.mjs @@ -1,6 +1,8 @@ // The cut page and the note box, driven as a person drives them: real mouse presses and keys through the DevTools protocol // (tools/textcheck/browser.mjs's headless Chrome, no npm package). Run by test_cut_page.py, which builds the long made-up // films and starts their desk; {chrome, url, sheets, parts} on stdin. Prints one line a failure, nothing when all hold. +// Exit 4: this browser cannot play the film (no usable browser, not a fault of the page). Time is driven by seeks and the +// video's own events, with generous waits, so a slow runner gives the same answers. import fs from "node:fs"; import { launchTab } from "../textcheck/browser.mjs"; @@ -9,11 +11,12 @@ const base = opt.url.replace(/\?c=.*$/, ""); const bad = []; const want = (ok, msg) => { if (!ok) bad.push(msg); }; const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); -const watchdog = setTimeout(() => { console.log("cut page: no end within 300 s"); process.exit(1); }, 300000); +const watchdog = setTimeout(() => { console.log("cut page: no end within 420 s"); process.exit(1); }, 420000); // autoplay allowed, as in Studio's own window (Electron's default): only the page's own rule keeps the film still const { browser, sessionId: S } = await launchTab(opt.chrome, ["--window-size=1440,900", "--autoplay-policy=no-user-gesture-required"], ["Page", "Runtime"]); const send = (m, p = {}) => browser.send(m, p, S); +let unplayable = false; try { await send("Emulation.setDeviceMetricsOverride", { width: 1440, height: 900, deviceScaleFactor: 1, mobile: false }); const ev = async (expression) => { @@ -21,12 +24,13 @@ try { if (r.exceptionDetails) throw new Error(`${expression.slice(0, 80)}: ${(r.exceptionDetails.exception || {}).description || r.exceptionDetails.text}`); return r.result.value; }; - const until = async (expr, ms = 10000) => { for (const t0 = Date.now(); Date.now() - t0 < ms; await sleep(100)) { if (await ev(`!!(${expr})`)) return true; } return false; }; + const until = async (expr, ms = 15000) => { for (const t0 = Date.now(); Date.now() - t0 < ms; await sleep(100)) { if (await ev(`!!(${expr})`)) return true; } return false; }; + const frames = () => ev(`new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)))`); const go = async (u) => { await send("Page.navigate", { url: u }); await sleep(600); }; const rect = (sel) => ev(`(() => { const e = document.querySelector(${JSON.stringify(sel)}); if (!e) return null; const r = e.getBoundingClientRect(); return { x: r.left, y: r.top, w: r.width, h: r.height }; })()`); - const mouse = (type, x, y, extra = {}) => send("Input.dispatchMouseEvent", { type, x, y, button: "left", clickCount: type === "mouseMoved" ? 0 : 1, ...extra }); + const mouse = (type, x, y) => send("Input.dispatchMouseEvent", { type, x, y, button: "left", clickCount: type === "mouseMoved" ? 0 : 1 }); const click = async (x, y) => { await mouse("mouseMoved", x, y); await mouse("mousePressed", x, y); await mouse("mouseReleased", x, y); await sleep(150); }; - const clickOn = async (sel) => { const r = await rect(sel); if (!r) { bad.push(`no ${sel} on the page`); return false; } await click(r.x + r.w / 2, r.y + r.h / 2); return true; }; + const clickOn = async (sel) => { const r = await rect(sel); if (!r || !r.w) { bad.push(`no ${sel} on the page`); return false; } await click(r.x + r.w / 2, r.y + r.h / 2); return true; }; const key = async (k, code, keyCode, text, modifiers = 0) => { await send("Input.dispatchKeyEvent", { type: text ? "keyDown" : "rawKeyDown", key: k, code, windowsVirtualKeyCode: keyCode, text, modifiers }); await send("Input.dispatchKeyEvent", { type: "keyUp", key: k, code, windowsVirtualKeyCode: keyCode, modifiers }); @@ -38,43 +42,47 @@ try { await go(base + "#/"); await until(`document.querySelector('a[href*="long-tide"]')`); const hrefs = await ev(`Array.from(document.querySelectorAll('a[href^="#/p/"]')).map((a) => a.getAttribute("href"))`); const keyOf = (re) => (hrefs.find((h) => re.test(h)) || "").replace(/^#\/p\//, "").split("/")[0]; - const LONG = keyOf(/long-tide~/), EDIT = keyOf(/long-tide-edit~/); - want(LONG && EDIT, `the space lists the two films: ${hrefs.join(" ")}`); + const LONG = keyOf(/long-tide~/), EDIT = keyOf(/long-tide-edit~/), STALE = keyOf(/long-tide-stale~/); + want(LONG && EDIT && STALE, `the space lists the three films: ${hrefs.join(" ")}`); - // 1. the stop opens with the film still and its sound as it was; a click from code plays nothing - await go(`${base}#/p/${LONG}`); - want(await until(`document.querySelector('#cv') && document.querySelector('#cv').readyState >= 1`), "the cut opens on gate ③ with its film"); - await sleep(2000); + // 1. the stop opened by a person's click; the film plays nothing by itself, nor from a click from code just after it + await clickOn(`a[href^="#/p/${LONG}"]`); + if (!(await until(`document.querySelector('#cv') && document.querySelector('#cv').readyState >= 2 && document.querySelector('#cv').videoWidth > 0`, 30000))) { + if (await ev(`!!(document.querySelector('#cv') && document.querySelector('#cv').error)`)) { unplayable = true; throw new Error("this browser cannot play the film"); } + bad.push("the cut does not open on gate ③ with its film"); + } + await ev(`document.querySelector('#cPlay').click()`); await sleep(1500); const v0 = await ev(`(() => { const v = document.querySelector('#cv'); return { paused: v.paused, t: v.currentTime, muted: v.muted }; })()`); - want(v0.paused && v0.t === 0 && v0.muted === false, `opening the stop played the film or changed its sound: ${JSON.stringify(v0)}`); - await ev(`document.querySelector('#cPlay').click()`); await sleep(800); - want(await ev(`document.querySelector('#cv').paused`), "a click from code (no person's gesture) started the film"); + want(v0.paused && v0.t === 0 && v0.muted === false, `a stop opened by a click played by itself, or from a click from code just after, or changed the sound: ${JSON.stringify(v0)}`); // 2. a second picked, played on and paused: the note is on where the picture stopped, and one line marks it const ru = await rect(".ruler-l .trk"); await click(ru.x + ru.w * (80 / 740), ru.y + ru.h / 2); want((await ev(`document.querySelector('#scope').textContent`)).includes("1:20"), "a click on the ruler at 1:20 does not put the note there"); - await clickOn("#cPlay"); await sleep(2500); await clickOn("#cPlay"); await sleep(400); + await clickOn("#cPlay"); + want(await until(`document.querySelector('#cv').currentTime >= 81.5`, 30000), "the film does not play from a click on Play"); + await clickOn("#cPlay"); await until(`document.querySelector('#cv').paused`); await sleep(300); await frames(); const st = await ev(`({ scope: document.querySelector('#scope').textContent, tc: document.querySelector('#cTc').textContent.split(" /")[0].trim(), sel: !document.querySelector('.selr').hidden })`); want(st.scope.includes(st.tc) && st.tc !== "1:20.0", `played on and paused at ${st.tc}, the note box still says ${st.scope}`); want(!st.sel, "two lines on the timeline: the picked second's apart from the playhead it should follow"); - // 3. zoomed all the way in: about 100 px a second on a 12-minute film; playing, the playhead stays in sight and the lanes keep their names + // 3. zoomed all the way in: about 100 px a second on a 12-minute film; playing, the playhead stays in sight wherever the film goes, the lanes keep their names for (let i = 0; i < 12; i++) await clickOn("#zIn"); const px = await ev(`(document.querySelector('#tl').clientWidth - 92) / 740`); want(px >= 80, `zoomed all the way in, a second is ${px.toFixed(1)} px (a 12-minute film needs about 100)`); - await ev(`document.querySelector('#cv').playbackRate = 8`); - await clickOn("#cPlay"); + await clickOn("#cPlay"); await until(`!document.querySelector('#cv').paused`); let lost = 0, labs = 0; - for (let i = 0; i < 8; i++) { - await sleep(600); + for (const x of [95, 110, 140, 200, 320, 500]) { // the film moves on as it plays: each a seek while it plays, then two frames + await ev(`document.querySelector('#cv').currentTime = ${x}`); + await until(`!document.querySelector('#cv').seeking && Math.abs(document.querySelector('#cv').currentTime - ${x}) < 2`); + await frames(); await frames(); const g = await ev(`(() => { const s = document.querySelector('#tlScroll').getBoundingClientRect(), p = document.querySelector('.tl-ph').getBoundingClientRect(), l = document.querySelector('.lane.shots .lab').getBoundingClientRect(); return { inView: p.left >= s.left + 60 && p.left <= s.right, lab: Math.abs(l.left - s.left) < 2 }; })()`); if (!g.inView) lost++; if (!g.lab) labs++; } - await clickOn("#cPlay"); await ev(`document.querySelector('#cv').playbackRate = 1`); - want(!lost, `zoomed in and playing, the playhead was out of sight ${lost} of 8 times`); + await clickOn("#cPlay"); await until(`document.querySelector('#cv').paused`); + want(!lost, `zoomed in and playing, the playhead was out of sight ${lost} of 6 times`); want(!labs, "zoomed in and scrolled, the lanes' names scrolled away"); for (let i = 0; i < 14; i++) await clickOn("#zOut"); @@ -88,13 +96,13 @@ try { want(pins.length === 67, `${pins.length} pins for the 67 marked places`); want(!over, `${over} pairs of the marked places' pins lie on each other`); - // 5. the note box: ↩ is a new line; one press of 记下 keeps the note (the button stays under the pointer); ⌘/Ctrl+↩ keeps too; the keys in words beside it + // 5. the note box: ↩ is a new line; one press of 记下 keeps the note (the button stays under the pointer); ⌘/Ctrl+↩ keeps too; the keys in words if (await ev(`!document.querySelector('#toWhole').hidden`)) await clickOn("#toWhole"); await ev(`document.querySelector('#say').focus()`); await type("第一行"); await key("Enter", "Enter", 13, "\r"); await type("第二行"); want((await ev(`document.querySelector('#say').value`)) === "第一行\n第二行", "↩ in the note box is not a new line"); - await sleep(400); // the box has opened (its height eases in) + await until(`document.querySelector('#say').getBoundingClientRect().height >= 90`, 3000); await sleep(300); // open (its height eases in) const b0 = await rect("#sayAdd"); - await mouse("mouseMoved", b0.x + b0.w / 2, b0.y + b0.h / 2); await mouse("mousePressed", b0.x + b0.w / 2, b0.y + b0.h / 2); await sleep(200); + await mouse("mouseMoved", b0.x + b0.w / 2, b0.y + b0.h / 2); await mouse("mousePressed", b0.x + b0.w / 2, b0.y + b0.h / 2); await sleep(250); const b1 = await rect("#sayAdd"); await mouse("mouseReleased", b0.x + b0.w / 2, b0.y + b0.h / 2); await sleep(400); want(Math.abs(b1.y - b0.y) < 1 && Math.abs(b1.x - b0.x) < 1, `记下 moved ${Math.round(b1.y - b0.y)} px while it was pressed`); @@ -103,14 +111,26 @@ try { want((await ev(`document.querySelector('#say').value`)) === "", "Ctrl+↩ does not keep the note"); want(/↩.*记下.*↩.*换行/.test(await ev(`(document.querySelector('#sayKeys') || {}).textContent || ""`)), "the note box's keys are not said in words beside it"); - // 6. a note about no moment of the film: its own place, marked as such when it goes + // 6. a note about no moment of the film: its own place, marked when it goes; a line in it that starts with 〔…〕 is still that one note, and × takes all of it if (await clickOn("#toNone")) { - await type("给 Studio 的话"); await clickOn("#sayAdd"); - want((await ev(`payload().general`)).includes("〔不对着片子〕给 Studio 的话"), `a note not about the film goes unmarked: ${await ev("payload().general")}`); + const n0 = await ev(`generalParts().length`); + await type("给 Studio 的话"); await key("Enter", "Enter", 13, "\r"); await type("〔像个标签〕第二行"); await clickOn("#sayAdd"); + want((await ev(`payload().general`)).includes("〔不对着片子〕给 Studio 的话\n〔像个标签〕第二行"), `a note not about the film goes unmarked or changed: ${await ev("payload().general")}`); + want((await ev(`generalParts().length`)) === n0 + 1, "a note with a line that starts with 〔…〕 shows as two notes"); + await ev(`Array.from(document.querySelectorAll('#cMine li.general')).find((li) => li.textContent.includes('像个标签')).querySelector('[data-del]').scrollIntoView()`); + const x = await ev(`(() => { const b = Array.from(document.querySelectorAll('#cMine li.general')).find((li) => li.textContent.includes('像个标签')).querySelector('[data-del]').getBoundingClientRect(); return { x: b.left + b.width / 2, y: b.top + b.height / 2 }; })()`); + await click(x.x, x.y); + want(!(await ev(`payload().general`)).includes("像个标签") && !(await ev(`payload().general`)).includes("给 Studio 的话"), "× took half of a note"); } - // 7. the storyboard by shot: a tab a part with its shots, the sheets of one part together; ← → shot by shot - await go(`${base}#/p/${LONG}/board/1`); await until(`document.querySelector('.pgtabs')`); + // 7. leaving the cut while it plays: no page error, and the next module's note box is not moved by the cut that is gone + await ev(`window.__errs = []; window.addEventListener('error', (e) => window.__errs.push(String(e.message)))`); + await clickOn("#cPlay"); await until(`!document.querySelector('#cv').paused`); await sleep(300); + await ev(`location.hash = '#/p/${LONG}/board/1'`); await until(`document.querySelector('.pgtabs')`); await sleep(800); + want((await ev(`window.__errs.length`)) === 0, `leaving the cut while it played: ${await ev(`window.__errs.join(" | ")`)}`); + want(!/成片|\d:\d\d/.test(await ev(`document.querySelector('#scope').textContent`)), `the storyboard's note box is on ${await ev(`document.querySelector('#scope').textContent`)}`); + + // 8. the storyboard by shot: a tab a part with its shots, the sheets of one part together; ← → shot by shot const tabs = await ev(`Array.from(document.querySelectorAll('.pgtabs a')).map((a) => a.textContent.trim())`); want(tabs.length === opt.parts && opt.sheets > opt.parts, `${opt.sheets} sheets of ${opt.parts} parts made ${tabs.length} tabs`); want(tabs.every((x) => !/页|Page/.test(x)) && /^S1–S\d+ /.test(tabs[0] || ""), `the tabs say pages, not shots: ${tabs.slice(0, 3).join(" | ")}`); @@ -119,7 +139,7 @@ try { const cur = await ev(`({ id: (document.querySelector('.shotc.cur') || {}).id || "", scope: document.querySelector('#scope').textContent })`); want(cur.id === "shot-S2" && /S2\b/.test(cur.scope), `→ → on the storyboard: ${JSON.stringify(cur)}`); - // 8. an edit list's long part: a shot inside it is there to point at + // 9. an edit list's long part: a shot inside it is there to point at; a film rendered from an earlier edit list says why there are none await go(`${base}#/p/${EDIT}/cut`); want(await until(`document.querySelector('.lane.shots [data-pick="shot:PROLOGUE.S1_3"]')`), "the shots inside an edit list's part are not on the timeline"); if (await ev(`!!document.querySelector('.lane.shots [data-pick="shot:PROLOGUE.S1_3"]')`)) { @@ -127,11 +147,15 @@ try { const sc = await ev(`document.querySelector('#scope').textContent`); want(sc.includes("S1_3") && sc.includes("PROLOGUE"), `a click on S1_3 inside PROLOGUE names ${sc}`); } + want(!(await ev(`!!document.querySelector('.lane.why')`)), "a film whose parts list their shots says they can't be picked"); + await go(`${base}#/p/${STALE}/cut`); await until(`document.querySelector('.lane.shots .blk')`); + want(/重新渲染/.test(await ev(`(document.querySelector('.lane.why') || {}).textContent || ""`)), "a film rendered from an earlier edit list shows its parts whole and does not say why"); } catch (e) { - bad.push(`cut page: ${e.message}`); + if (!unplayable) bad.push(`cut page: ${e.message}`); } finally { await browser.close(); clearTimeout(watchdog); } +if (unplayable) { console.error("this browser cannot play the test film (WebM)"); process.exit(4); } for (const b of bad) console.log(b); process.exit(bad.length ? 1 : 0); diff --git a/tools/desk/test_cut_page.py b/tools/desk/test_cut_page.py index ce01fc0c..cd9c9aa9 100644 --- a/tools/desk/test_cut_page.py +++ b/tools/desk/test_cut_page.py @@ -5,10 +5,10 @@ A made-up 12:20 film is built in a temp folder from tools/desk/fixtures/demo: 60 shots in nine parts, about 180 lines, gate ③ with 67 marked places (30 the agent is unsure of, 30 to listen to, 7 the check found), gate ② cut into sheets of six as an agent writes it ("开场(1/2)"), and the same film again cut from an edit list whose render kept the shots inside each part. -The picture is ffmpeg's test pattern, 64×36 at 5 frames a second (a few hundred KB). A desk of its own serves them (a temp +The picture is ffmpeg's test pattern, 64×36 at 5 frames a second, VP8 and Opus in WebM (every Chromium plays it; about 2.5 MB). A desk of its own serves them (a temp HOME and every Studio folder in the temp folder, no window, no browser, no keychain), and test_cut_page.mjs drives the pages through the DevTools protocol with real mouse and key events. Prints nothing and exits 0 when every check holds; -else one line a failure, exit 1. Exit 3: no ffmpeg; 4: no Chrome (CHROME_PATH, the usual installs, Playwright's Chromium, as bin/vh's +else one line a failure, exit 1. Exit 3: no ffmpeg with VP8 and Opus; 4: no Chrome, or one that cannot play the film (CHROME_PATH, the usual installs, Playwright's Chromium, as bin/vh's chrome_path looks; the caller skips, or on CI fails). """ import json, os, random, re, shutil, subprocess, sys, tempfile, time @@ -23,13 +23,12 @@ def film(path): r = subprocess.run(["ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-f", "lavfi", "-i", f"testsrc=s=64x36:r=5:d={D:g}", "-f", "lavfi", - "-i", f"sine=f=330:sample_rate=8000:d={D:g}", "-c:v", "libx264", "-preset", "ultrafast", "-crf", "40", "-g", "5", - "-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "16k", "-shortest", str(path)], capture_output=True, text=True) - if r.returncode: - raise SystemExit(f"ffmpeg: {r.stderr.strip()[:300]}") + "-i", f"sine=f=330:sample_rate=48000:d={D:g}", "-c:v", "libvpx", "-deadline", "realtime", "-cpu-used", "8", "-b:v", "40k", "-g", "25", + "-c:a", "libopus", "-b:a", "12k", "-shortest", str(path)], capture_output=True, text=True) + return r.returncode == 0 -def long_film(root, mp4): +def long_film(root, webm): p = root / "2026-11-20-long-tide" shutil.copytree(HERE / "fixtures/demo", p) R = random.Random(7) @@ -53,7 +52,7 @@ def long_film(root, mp4): t += d + R.uniform(0.3, 0.9) (p / "audio/timeline.zh.json").write_text(json.dumps({"version": 1, "lang": "zh", "provider": "fixture", "segments": segs}, ensure_ascii=False), encoding="utf-8") g = json.loads((p / "out/review/gate-3.json").read_text(encoding="utf-8")) - g.update(film="out/draft.mp4", least_sure=[{"id": shots[k]["id"], "t": round(shots[k]["start"] + 0.5, 1), "note": f"没把握 {k}"} for k in range(0, 60, 2)], + g.update(film="out/draft.webm", least_sure=[{"id": shots[k]["id"], "t": round(shots[k]["start"] + 0.5, 1), "note": f"没把握 {k}"} for k in range(0, 60, 2)], listen=[{"t": round(10 + j * 24.1, 1), "note": f"请听 {j}"} for j in range(30)]) (p / "out/review/gate-3.json").write_text(json.dumps(g, ensure_ascii=False), encoding="utf-8") c = json.loads((p / "out/check/draft.check.json").read_text(encoding="utf-8")) @@ -68,7 +67,8 @@ def long_film(root, mp4): "shots": [{"id": x["id"], "t0": x["start"], "t1": x["end"], "frame": x["frame"], "see": x["label"]} for x in c0]} for j, c0 in enumerate(ch)] g2["segments"] = sheets (p / "out/review/gate-2.json").write_text(json.dumps(g2, ensure_ascii=False), encoding="utf-8") - shutil.copy(mp4, p / "out/draft.mp4") + (p / "out/draft.mp4").unlink(missing_ok=True) + shutil.copy(webm, p / "out/draft.webm") return p, shots, len(sheets) @@ -87,7 +87,7 @@ def edit_film(root, src, shots): sha = hashlib.sha256((p / "edit.json").read_bytes()).hexdigest() rec = [{"id": NAMES[k], "start": ss[0]["start"], "end": ss[-1]["end"], "kind": "color"} for k, ss in enumerate(parts)] rec += [{"id": f"{NAMES[k]}.S{k + 1}_{j + 1}", "start": x["start"], "end": x["end"], "kind": "shot"} for k, ss in enumerate(parts) for j, x in enumerate(ss)] - (p / "out/draft.mp4.render.json").write_text(json.dumps({"fps": 30, "frames": int(D * 30), "first_frame": 0, "edit": {"path": "edit.json", "sha256": sha}, "shots": rec}), encoding="utf-8") + (p / "out/draft.webm.render.json").write_text(json.dumps({"fps": 30, "frames": int(D * 30), "first_frame": 0, "edit": {"path": "edit.json", "sha256": sha}, "shots": rec}), encoding="utf-8") return p @@ -126,14 +126,20 @@ def main(argv): root.mkdir() env.update(OVH_PROJECTS=str(root), OVH_LOCAL_MD="/dev/null/LOCAL.md", OVH_STUDIO_SHELL="none", OVH_STUDIO_BROWSER="none", OVH_GATE_STUDIO="0", OVH_KEYSTORE="none", BROWSER="/usr/bin/true") - film(t / "film.mp4") - p, shots, sheets = long_film(root, t / "film.mp4") + if not film(t / "film.webm"): + return 3 + p, shots, sheets = long_film(root, t / "film.webm") for g in ("1", "2", "3"): r = subprocess.run([str(ROOT / "bin/vh"), "gate", str(p), g], env=env, capture_output=True, text=True) if r.returncode: print(f"bin/vh gate {g}: {r.stderr.strip()[:300]}") return 1 - edit_film(root, p, shots) + e = edit_film(root, p, shots) + stale = root / "2026-11-22-long-tide-stale" # the same, its film rendered from an earlier edit list + shutil.copytree(e, stale) + rec = json.loads((stale / "out/draft.webm.render.json").read_text()) + rec["edit"]["sha256"] = "0" * 64 + (stale / "out/draft.webm.render.json").write_text(json.dumps(rec)) log = t / "desk.log" desk = subprocess.Popen([sys.executable, str(HERE / "fixtures/with_tty.py"), str(ROOT / "bin/vh"), "desk", "--root", str(root), "--port", "0", "--idle", "0", "--no-open", "--print-address"], env=env, stdout=open(log, "w"), stderr=subprocess.STDOUT) @@ -152,6 +158,8 @@ def main(argv): r = subprocess.run(["node", str(HERE / "test_cut_page.mjs")], input=json.dumps({"chrome": chrome, "url": url, "sheets": sheets, "parts": len(PARTS)}), capture_output=True, text=True, timeout=600) out = (r.stdout + r.stderr).strip() + if r.returncode == 4: # the browser found plays no WebM: no usable browser, as the other page checks say it + return 4 if out: print(out) return 0 if r.returncode == 0 and not r.stdout.strip() else 1 diff --git a/tools/schemas/output/timeline.schema.json b/tools/schemas/output/timeline.schema.json index a730519c..a35b04f1 100644 --- a/tools/schemas/output/timeline.schema.json +++ b/tools/schemas/output/timeline.schema.json @@ -16,7 +16,9 @@ "frames": {"type": "integer"}, "size": {"type": ["array", "null"]}, "shots_from": {"type": ["string", "null"]}, - "shots": {"type": "array", "items": {"type": "object", "required": ["id", "start", "end", "start_frame", "end_frame"]}}, + "shots": {"type": "array", "items": {"type": "object", "required": ["id", "start", "end", "start_frame", "end_frame"], "properties": { + "inner": {"description": "An edit list's row only: the shots inside it as the current film's .render.json kept them (window.film.shots of its page, named .), in the film's seconds, cut to the row; only when that film was rendered from this edit.json. A row with none has no inner.", + "type": "array", "items": {"type": "object", "required": ["id", "start", "end", "start_frame", "end_frame"]}}}}}, "chapters": { "type": "array", "items": { From ba13362379ea109e4fcf21df158dfd279d233f67 Mon Sep 17 00:00:00 2001 From: zhanglinghao Date: Mon, 23 Nov 2026 17:35:14 +0800 Subject: [PATCH 4/4] =?UTF-8?q?timeline=20=E7=9A=84=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=EF=BC=9Ainner=20=E5=86=99=E5=9C=A8=20shots?= =?UTF-8?q?=20=E7=9A=84=E8=AF=B4=E6=98=8E=E9=87=8C=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=8F=A6=E5=BC=80=E5=AD=97=E6=AE=B5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/schemas/output/timeline.schema.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/schemas/output/timeline.schema.json b/tools/schemas/output/timeline.schema.json index a35b04f1..65c4d858 100644 --- a/tools/schemas/output/timeline.schema.json +++ b/tools/schemas/output/timeline.schema.json @@ -16,9 +16,8 @@ "frames": {"type": "integer"}, "size": {"type": ["array", "null"]}, "shots_from": {"type": ["string", "null"]}, - "shots": {"type": "array", "items": {"type": "object", "required": ["id", "start", "end", "start_frame", "end_frame"], "properties": { - "inner": {"description": "An edit list's row only: the shots inside it as the current film's .render.json kept them (window.film.shots of its page, named .), in the film's seconds, cut to the row; only when that film was rendered from this edit.json. A row with none has no inner.", - "type": "array", "items": {"type": "object", "required": ["id", "start", "end", "start_frame", "end_frame"]}}}}}, + "shots": {"type": "array", "description": "The shot table's rows, each with the table's other fields. An edit list's row may carry inner: the shots inside it as the current film's .render.json kept them (window.film.shots of its page, named .), each {id, start, end, start_frame, end_frame} in the film's seconds, cut to the row; only when that film was rendered from this edit.json. A row with none has no inner.", + "items": {"type": "object", "required": ["id", "start", "end", "start_frame", "end_frame"]}}, "chapters": { "type": "array", "items": {