dsh-watch-together 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/dsh.plugin.json +1 -1
- package/examples/floating-chat/run-glass.cmd +37 -9
- package/examples/floating-chat/window.py +12 -1
- package/extension/content.js +41 -8
- package/package.json +1 -1
- package/examples/floating-chat/run-glass-60fps.cmd +0 -7
- package/examples/floating-chat/run-glass-acrylic.cmd +0 -8
- package/examples/floating-chat/run-glass-nochroma.cmd +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
3
3
|
All notable changes to **dsh-watch-together** are documented here.
|
|
4
4
|
This package starts its own version line at `0.0.7` — it is not a continuation of `dsh-video-storyboard`.
|
|
5
5
|
|
|
6
|
+
## [0.2.8] - 2026-11-03
|
|
7
|
+
|
|
8
|
+
> 三个社区 PR(都是 @ggfgfgf-on)+ 一批失效入口的清理。
|
|
9
|
+
|
|
10
|
+
### Fixed — 多 P / 选集页面读错 `<video>`(合 PR #45,对应 #44)
|
|
11
|
+
|
|
12
|
+
旧实现按 `duration` 挑播放器,遇到 B 站多语言版本这种页面,会挑中一个隐藏的 13 分钟长视频,
|
|
13
|
+
上报的 `pos` 直接跳到 13:42,插件判定「换片了」,陪看中断。
|
|
14
|
+
|
|
15
|
+
新逻辑:先排除不可见 / 零尺寸 / `opacity: 0` 的候选,再按在视口里占据的面积排序;
|
|
16
|
+
播放中只加一档权重(不能压过更大的主播放器);认画中画和全屏;整页都不可见才退回全部。
|
|
17
|
+
|
|
18
|
+
### Fixed — 气泡形状变化后不重合成(合 PR #42)
|
|
19
|
+
|
|
20
|
+
静态跳帧只看 `_sig_bbox`,只清 `_sig` 不够。气泡/内框形状变了之后,如果桌面本身静止,
|
|
21
|
+
worker 会一直 `return None`,新遮罩和新色散要等用户动一下鼠标才出现。
|
|
22
|
+
`FORCE` 模式下看不出来,只在真机静置时暴露。
|
|
23
|
+
|
|
24
|
+
### Fixed — `_tick` 每 4ms 重读一次配置(合 PR #47,fixes #46)
|
|
25
|
+
|
|
26
|
+
`not capturable()` 每拍读一次 `watch-window.json` —— `__init__` 早就把结果缓存在
|
|
27
|
+
`self._cappable` 了,这里纯属白花。0.2.7 引入的疏漏,谢谢抓出来。
|
|
28
|
+
|
|
29
|
+
### Fixed — 删掉失效的 `run-glass*.cmd`,并去掉里面的本机绝对路径(#43)
|
|
30
|
+
|
|
31
|
+
玻璃渲染重写之后 `DSH_WATCH_GLASS_TTL/FPS/CHROMA/BLUR/SAT` 和 `DSH_GLASS_ACRYLIC`
|
|
32
|
+
已经没有任何代码读取,但那几个脚本还在设置它们:双击 `run-glass-acrylic.cmd` 以为开了
|
|
33
|
+
亚克力,实际还是普通软件模糊。静默失效比报错更糟。
|
|
34
|
+
|
|
35
|
+
现在只留一个 `run-glass.cmd`,开头列清哪些变量废弃、哪些真正有效;解释器也不再写死
|
|
36
|
+
本机路径(先找 PATH 上的 `pythonw`,再退 `py -3`)—— 这个仓库是公开的。
|
|
37
|
+
|
|
6
38
|
## [0.2.7] - 2026-11-03
|
|
7
39
|
|
|
8
40
|
> 五个社区 PR 一起收(都是 @ggfgfgf-on 提的),外加录屏模式的两个真 bug。
|
package/dsh.plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-watch-together",
|
|
3
3
|
"description": "Watch a video together with a text-only agent: follow the user's real playback position and hand over one segment at a time, just before the segment ends.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.8",
|
|
5
5
|
"entry": {
|
|
6
6
|
"name": "dsh-watch-together",
|
|
7
7
|
"inject": [
|
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
@echo off
|
|
2
|
-
rem
|
|
3
|
-
rem
|
|
4
|
-
rem
|
|
5
|
-
rem
|
|
6
|
-
rem
|
|
7
|
-
rem
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
rem ---------------------------------------------------------------------------
|
|
3
|
+
rem 手工启动悬浮窗(开发/调试用)。正常使用时插件自己会拉起窗口,不需要这个。
|
|
4
|
+
rem
|
|
5
|
+
rem 【重要】旧版的这组变量在玻璃渲染重写之后**已经全部不读了**,设了也不会有
|
|
6
|
+
rem 任何效果 —— 见 issue #43。以前双击 run-glass-acrylic.cmd 以为开了亚克力,
|
|
7
|
+
rem 实际还是普通软件模糊:
|
|
8
|
+
rem
|
|
9
|
+
rem DSH_WATCH_GLASS_TTL / FPS / CHROMA / BLUR / SAT (不读)
|
|
10
|
+
rem DSH_GLASS_ACRYLIC (不读,没有 acrylic 路径了)
|
|
11
|
+
rem
|
|
12
|
+
rem 现在真正有效的开关:
|
|
13
|
+
rem
|
|
14
|
+
rem DSH_GLASS_NATIVE=1 走 GPU 路径(D3D11)
|
|
15
|
+
rem GLASS_FORCE=1 每帧强制重合成(调试用,很费 CPU)
|
|
16
|
+
rem DSH_GLASS_PREVIEW=1 预览模式:不抓屏,只贴最后一帧
|
|
17
|
+
rem DSH_GLASS_SNAPSHOT=1 文档截图模式:跑 2.5 秒后冻结画面
|
|
18
|
+
rem DSH_GLASS_WDA=0 允许截图/录屏拍到窗口(等价于配置里的 capturable)
|
|
19
|
+
rem
|
|
20
|
+
rem 尺寸、名字、capturable 这类持久设置写 ~/.dsh/watch-window.json。
|
|
21
|
+
rem ---------------------------------------------------------------------------
|
|
22
|
+
|
|
10
23
|
cd /d "%~dp0"
|
|
11
|
-
|
|
24
|
+
|
|
25
|
+
rem 不写死解释器路径:先在 PATH 上找,找不到再试 py 启动器。
|
|
26
|
+
where pythonw >nul 2>&1
|
|
27
|
+
if %errorlevel%==0 (
|
|
28
|
+
start "" pythonw window.py
|
|
29
|
+
goto :eof
|
|
30
|
+
)
|
|
31
|
+
where py >nul 2>&1
|
|
32
|
+
if %errorlevel%==0 (
|
|
33
|
+
start "" py -3 window.py
|
|
34
|
+
goto :eof
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
echo 找不到 pythonw / py。
|
|
38
|
+
echo 需要一个带 tkinter 的 Python(python.org 官方包勾 tcl/tk,或 Microsoft Store 版),
|
|
39
|
+
echo 或者直接用插件拉起窗口(它自己会挑解释器)。
|
|
12
40
|
pause
|
|
@@ -949,6 +949,13 @@ class LiveGlass:
|
|
|
949
949
|
ctypes.windll.user32.GetWindowRect(hwnd, ctypes.byref(rc))
|
|
950
950
|
return (rc.left, rc.top, rc.right, rc.bottom)
|
|
951
951
|
|
|
952
|
+
def _invalidate_glass(self):
|
|
953
|
+
"""让下一帧必须重新合成(静态跳帧只看 _sig_bbox,单清 _sig 不够)。"""
|
|
954
|
+
with self._geo_lock:
|
|
955
|
+
self._sig = None
|
|
956
|
+
self._sig_bbox = None
|
|
957
|
+
self._prev_out = None
|
|
958
|
+
|
|
952
959
|
def _capture(self, sct):
|
|
953
960
|
l, t, r, b = self._bbox()
|
|
954
961
|
if r <= l or b <= t:
|
|
@@ -1453,6 +1460,10 @@ class LiveGlass:
|
|
|
1453
1460
|
if shapes != SHAPES:
|
|
1454
1461
|
with self._geo_lock:
|
|
1455
1462
|
apply_shapes(shapes)
|
|
1463
|
+
# 气泡/内框形状变了,合成的遮罩也变了;必须让上一帧的静态跳帧
|
|
1464
|
+
# 失效,否则桌面静止时 worker 会一直 return None,新遮罩/色散
|
|
1465
|
+
# 要等用户动一下鼠标或背景动一下才出现(调试 FORCE 模式下看不出)。
|
|
1466
|
+
self._invalidate_glass()
|
|
1456
1467
|
# 每条消息只按正文占一块;时间戳贴在气泡上方,不进框。
|
|
1457
1468
|
for info in infos:
|
|
1458
1469
|
bx0, by0, bx1, by1, _r = info["shape"]
|
|
@@ -1742,7 +1753,7 @@ class LiveGlass:
|
|
|
1742
1753
|
# 底部圆角/暗边会闪一下,看起来像渲染错位。
|
|
1743
1754
|
self.root.after(INTERVAL_MS, self._tick)
|
|
1744
1755
|
return
|
|
1745
|
-
if not self._excluded and not
|
|
1756
|
+
if not self._excluded and not self._cappable:
|
|
1746
1757
|
self._set_exclude(True)
|
|
1747
1758
|
self._pause.clear()
|
|
1748
1759
|
|
package/extension/content.js
CHANGED
|
@@ -13,18 +13,51 @@
|
|
|
13
13
|
/* global chrome */
|
|
14
14
|
|
|
15
15
|
(() => {
|
|
16
|
-
// 有些站点在一个页面里放多个 video
|
|
17
|
-
// 挑"
|
|
16
|
+
// 有些站点在一个页面里放多个 video(广告、预览、小窗、多 P、多语言选集)。
|
|
17
|
+
// 挑"用户正在看的那个":先排除不可见 / 零尺寸的,再按可见面积选最大的;
|
|
18
|
+
// 播放中只加一点权重,不能让它压过一个更大的主播放器。
|
|
19
|
+
// 旧实现按 duration 选,多 P 页面会挑到隐藏的 13 分钟长视频,位置直接跳到另一集。
|
|
20
|
+
function visibleBox(v) {
|
|
21
|
+
if (!v.isConnected) return null;
|
|
22
|
+
const r = v.getBoundingClientRect();
|
|
23
|
+
if (!(r.width > 2 && r.height > 2)) return null;
|
|
24
|
+
let style;
|
|
25
|
+
try { style = getComputedStyle(v); } catch { return null; }
|
|
26
|
+
if (style.display === 'none' || style.visibility === 'hidden'
|
|
27
|
+
|| Number(style.opacity) === 0) return null;
|
|
28
|
+
const left = Math.max(0, r.left);
|
|
29
|
+
const top = Math.max(0, r.top);
|
|
30
|
+
const right = Math.min(window.innerWidth, r.right);
|
|
31
|
+
const bottom = Math.min(window.innerHeight, r.bottom);
|
|
32
|
+
if (right - left <= 2 || bottom - top <= 2) return null;
|
|
33
|
+
return { area: (right - left) * (bottom - top) };
|
|
34
|
+
}
|
|
35
|
+
|
|
18
36
|
function pickVideo() {
|
|
19
37
|
const all = [...document.querySelectorAll('video')];
|
|
20
38
|
if (all.length === 0) return null;
|
|
21
39
|
if (all.length === 1) return all[0];
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
|
|
41
|
+
const viewport = Math.max(1, window.innerWidth * window.innerHeight);
|
|
42
|
+
const info = all.map((v) => ({ v, box: visibleBox(v) }));
|
|
43
|
+
// 先只在可见的里挑;整页都不可见(比如刚切走)时才退回全部。
|
|
44
|
+
const visible = info.filter((x) => x.box);
|
|
45
|
+
const pool = visible.length > 0 ? visible : info;
|
|
46
|
+
// 用户主动暂停时视频是 paused 但没 ended;只有 ended 才该让位给别的。
|
|
47
|
+
const live = pool.filter((x) => !x.v.ended);
|
|
48
|
+
const candidates = live.length > 0 ? live : pool;
|
|
49
|
+
|
|
50
|
+
const score = ({ v, box }) => {
|
|
51
|
+
let s = box ? (box.area / viewport) * 1e7 : 0;
|
|
52
|
+
if (!v.paused && !v.ended) s += 1e5;
|
|
53
|
+
if (v.readyState >= 2) s += 1e3;
|
|
54
|
+
if (v.currentTime > 0) s += 1e3;
|
|
55
|
+
if (v === document.pictureInPictureElement) s += 1e9;
|
|
56
|
+
const fs = document.fullscreenElement;
|
|
57
|
+
if (fs && fs !== document.documentElement && fs.contains(v)) s += 5e8;
|
|
58
|
+
return s;
|
|
59
|
+
};
|
|
60
|
+
return candidates.reduce((best, cur) => (score(cur) > score(best) ? cur : best)).v;
|
|
28
61
|
}
|
|
29
62
|
|
|
30
63
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-watch-together",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Watch a video together with a text-only agent: follow the user's real playback position, hand over one segment at a time just before it ends, and keep a single text stream of scripted lines, interjections and the user's replies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
rem 磨砂模式:背景由 Windows 的 GPU 合成(DWM Acrylic),一次屏都不截。
|
|
3
|
-
rem 气泡和标题栏会变成实心卡片(Tk 不支持半透明叠加)。
|
|
4
|
-
rem 想调色调:DSH_GLASS_ACRYLIC_TINT,ABGR 十六进制,默认 0xB4121014
|
|
5
|
-
set DSH_GLASS_ACRYLIC=1
|
|
6
|
-
cd /d "%~dp0"
|
|
7
|
-
"C:/Users/10437/AppData/Local/Microsoft/WindowsApps/python.exe" window.py
|
|
8
|
-
pause
|