dsh-bili-watch 0.3.0 → 0.3.1

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/README.md CHANGED
@@ -45,7 +45,7 @@ dsh plugin --profile web add dsh-bili-watch@latest
45
45
  dsh plugin --profile web remove dsh-bili-watch
46
46
  ```
47
47
 
48
- 升级后重启 DSH。`deps/` 在包目录内,卸载或重装会连模型、环境一起删掉(**登录凭证不在 `deps/`**,它已经搬到 `$DSH_HOME/bili-watch/`);把 `BILI_WATCH_SEEN` 指到包外可以保住「已看过」记录。**注意 `BILI_WATCH_PROJ` 只影响运行时查找顺序,不影响 `fetch-deps` 的安装位置**——`fetch-deps` 永远装进包内 `deps/`,而且查找时 `deps/` 优先,所以「指到包外」这一步要真的生效,得先让包内 `deps/.venv-*` 不存在。**抽帧缓存根在包目录外**(默认 `~/.dsh/bili-watch/cache`,即 `$DSH_HOME/bili-watch/cache`;自定义过 `BILI_WATCH_CACHE` 就指到你自己设的位置,插件会在那个目录下再建一层 `bili-watch-cache/` 当缓存根),`dsh plugin remove` 不会动它,卸载后需手动删这个缓存目录。**只删 `cache/` 这一层:登录凭证是它的兄弟文件 `$DSH_HOME/bili-watch/credential.json`,删了要重新扫码。** 日常清理在面板里逐项删即可。
48
+ 升级后重启 DSH。`deps/` 在包目录内,卸载或重装会连模型、环境一起删掉(**登录凭证不在 `deps/`**,它已经搬到 `$DSH_HOME/bili-watch/`)。**面板里调过的东西也在 `deps/` 里**——`deps-config.json`(5 个调优参数与自定义缓存路径)、`cache-config.json`、`ui-config.json`、`seen.md`,卸载前先拷出来,重装后原样放回;把 `BILI_WATCH_SEEN` 指到包外可以保住「已看过」记录。**注意 `BILI_WATCH_PROJ` 只影响运行时查找顺序,不影响 `fetch-deps` 的安装位置**——`fetch-deps` 永远装进包内 `deps/`,而且查找时 `deps/` 优先,所以「指到包外」这一步要真的生效,得先让包内 `deps/.venv-*` 不存在。**抽帧缓存根在包目录外**(默认 `~/.dsh/bili-watch/cache`,即 `$DSH_HOME/bili-watch/cache`;自定义过 `BILI_WATCH_CACHE` 就指到你自己设的位置,插件会在那个目录下再建一层 `bili-watch-cache/` 当缓存根),`dsh plugin remove` 不会动它,卸载后需手动删这个缓存目录。**只删 `cache/` 这一层:登录凭证是它的兄弟文件 `$DSH_HOME/bili-watch/credential.json`,删了要重新扫码。** 日常清理在面板里逐项删即可。
49
49
 
50
50
  ## 模块架构
51
51
 
package/index.js CHANGED
@@ -248,19 +248,19 @@ const OWN_CACHE_DIRS = new Set(['_logs', 'frames', 'sheets', 'sheet-tmp', 'subst
248
248
  function hasBvLayout(dir) {
249
249
  // 判据一:我们写过的标记(新用户、二次运行都靠它)
250
250
  try { if (existsSync(join(dir, CACHE_MARK))) return true } catch {}
251
- // 判据二(N05-A1,2026-10-27 改):BV* 目录 **且** 我们必建的工作目录之一,两条同时成立才算。
252
- // 原来只看 BV*,可目标用户就是 B 站素材库——目录名全以 BV 开头,于是把用户自己的素材库
253
- // 认成缓存根,removeOwned / autoCleanCache 会成片删掉 original.mp4。
254
- // 单看 frames/asr 也不行(通用名,别人也会有),所以改成「两者同时成立」。
251
+ // 判据二(2026-10-28 W-01 改):BV* 目录 **且** 该目录里有我们自己写的 meta.json。
252
+ // N05-A1 那版用「BV* + frames/asr/_logs 之一」,实测仍会误判:用户素材库只要同时有 BV 目录和
253
+ // 一个 frames 目录,clean 就把 BV 目录整片删掉(rc=0、无警告),还顺手写下 .bili-watch-root 自我固化,
254
+ // 此后永远走删的那条路、不会自己纠正。frames/asr/_logs 是通用名,等于拿别人的东西证明自己的身份;
255
+ // meta.json 只有 writeMeta() 会写,用户素材库不会有。
255
256
  // 口径必须与 tools/look.mjs 的同名函数逐字一致,否则面板与 CLI 判据分叉。
256
- let hasBv = false
257
- let hasWork = false
258
257
  try {
259
258
  for (const e of readdirSync(dir, { withFileTypes: true })) {
260
259
  if (!e.isDirectory()) continue
261
- if (/^BV[0-9A-Za-z]{10}/i.test(e.name)) hasBv = true
262
- else if (e.name === 'frames' || e.name === 'asr' || e.name === '_logs') hasWork = true
263
- if (hasBv && hasWork) return true
260
+ if (!/^BV[0-9A-Za-z]{10}/i.test(e.name)) continue
261
+ try {
262
+ if (existsSync(join(dir, e.name, 'meta.json'))) return true
263
+ } catch {}
264
264
  }
265
265
  } catch {}
266
266
  return false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-bili-watch",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "private": false,
5
5
  "description": "把 B 站视频读成文本给 DSH agent 用:元数据、评论、弹幕、字幕、本地转写、抽帧 OCR;支持 b23.tv 短链与 av 号,抽帧缓存目录可换。只读命令零依赖。",
6
6
  "type": "module",
package/tools/look.mjs CHANGED
@@ -69,18 +69,18 @@ const OWN_CACHE_DIRS = new Set(['_logs', 'frames', 'sheets', 'sheet-tmp', 'subst
69
69
  function hasBvLayout(dir) {
70
70
  // 判据一:我们写过的标记(新用户、二次运行都靠它)
71
71
  try { if (existsSync(join(dir, CACHE_MARK))) return true } catch {}
72
- // 判据二(N05-A1,2026-10-27 改):BV* 目录 **且** 我们必建的工作目录之一,两条同时成立才算。
73
- // 原来只看 BV*,可目标用户就是 B 站素材库——目录名全以 BV 开头,于是把用户自己的素材库
74
- // 认成缓存根,removeOwned 会成片删掉 original.mp4。单看 frames/asr 也不行(通用名,别人也会有),
75
- // 所以改成「两者同时成立」:我们写出来的缓存根一定同时有 BV 子目录和 frames/asr/_logs(抽帧/转写/日志)。
76
- let hasBv = false
77
- let hasWork = false
72
+ // 判据二(2026-10-28 W-01 改):BV* 目录 **且** 该目录里有我们自己写的 meta.json。
73
+ // N05-A1 那版用「BV* + frames/asr/_logs 之一」,实测仍会误判:用户素材库只要同时有 BV 目录和
74
+ // 一个 frames 目录,clean 就把 BV 目录整片删掉(rc=0、无警告),还顺手写下 .bili-watch-root 自我固化,
75
+ // 此后永远走删的那条路、不会自己纠正。frames/asr/_logs 是通用名,等于拿别人的东西证明自己的身份;
76
+ // meta.json 只有 writeMeta() 会写,用户素材库不会有。
78
77
  try {
79
78
  for (const e of readdirSync(dir, { withFileTypes: true })) {
80
79
  if (!e.isDirectory()) continue
81
- if (/^BV[0-9A-Za-z]{10}/i.test(e.name)) hasBv = true
82
- else if (e.name === 'frames' || e.name === 'asr' || e.name === '_logs') hasWork = true
83
- if (hasBv && hasWork) return true
80
+ if (!/^BV[0-9A-Za-z]{10}/i.test(e.name)) continue
81
+ try {
82
+ if (existsSync(join(dir, e.name, 'meta.json'))) return true
83
+ } catch {}
84
84
  }
85
85
  } catch {}
86
86
  return false