@pls-compile-owo/fisheye 0.2.1 → 0.4.2

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 ADDED
@@ -0,0 +1,60 @@
1
+ # Changelog
2
+
3
+ 本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 规范与 [语义化版本](https://semver.org/lang/zh-CN/)。
4
+
5
+ ## [0.4.2] - 2026-11-14
6
+
7
+ ### Fixed
8
+
9
+ - `lib/env.mjs` 缺少 `execFileSync` 导入:`onPath()` 失败导致 PATH 上的 ffmpeg/python 永远无法被识别(影响 `resolveTool` 的 PATH 兜底)。
10
+ - `selftest`:PATH 上的 python 无法执行(如 Windows 商店占位符)时降级为跳过而不是失败。
11
+
12
+ ## [0.4.1] - 2026-11-14
13
+
14
+ ### Added
15
+
16
+ - 音频转写能力探测(`lib/audio.mjs`):检测 whisper.cpp,`selftest` 显示音频转写是否可用;不可用时优雅提示安装方式。
17
+ - README 环境变量表补充 `FISHEYE_WHISPER` / `FISHEYE_WHISPER_MODEL`。
18
+
19
+ ### Fixed
20
+
21
+ - 首次运行(`out/`、`cache/` 目录不存在)时字幕缓存写入与视频下载不再报 ENOENT。
22
+
23
+ ## [0.4.0] - 2026-11-14
24
+
25
+ ### Added
26
+
27
+ - B站 API 请求自动重试:网络错误 / 超时 / 5xx / 429 自动重试,指数退避 + 抖动;4xx 不重试(`lib/retry.mjs`)。
28
+ - token 预算估算可配置:`FISHEYE_TOKENS_PER_GRID` / `FISHEYE_TOKENS_PER_SUBS` / `FISHEYE_TOKENS_PER_FINE` 覆盖单张成本,`FISHEYE_TOKEN_MODEL`(gpt / qwen / gemini / 数字)按模型 tokenizer 修正(`lib/budget.mjs`)。
29
+ - CLI 中英双语:`FISHEYE_LANG=en` 输出英文,默认中文(`lib/i18n.mjs`)。
30
+
31
+ ### Changed
32
+
33
+ - `lib/bili.mjs` 的请求统一走 `fetchWithRetry`(函数签名与返回值不变)。
34
+ - `lib/stages.mjs` 的预算估算改用 `lib/budget.mjs`(默认值与旧 COST 一致)。
35
+
36
+ ## [0.3.0] - 2026-11-14
37
+
38
+ ### Changed
39
+
40
+ - 主程序拆分为模块:`lib/env.mjs`(路径/依赖解析)、`lib/util.mjs`(时间/参数工具)、`lib/bili.mjs`(B站 API)、`lib/frame.mjs`(抽帧与时间点)、`lib/danmaku.mjs`(弹幕分析)、`lib/stages.mjs`(六个子命令);入口只保留 CLI 分发。
41
+ - `selftest`:缓存目录缺失时不再报错。
42
+
43
+ ### Added
44
+
45
+ - 单元测试(`node --test`):参数解析、弹幕分析。
46
+ - GitHub Actions CI:Node 18/20/22 语法检查 + 单元测试。
47
+
48
+ ## [0.2.1] - 2026-11-14
49
+
50
+ 首个公开发布版本。
51
+
52
+ ### Added
53
+
54
+ - 六个子命令:`auto`(自动规划铺网)、`grid`(分段铺网)、`subs`(字幕带)、`refine`(关键帧精读)、`grab`(按时间点截帧)、`local`(本地视频)。
55
+ - 四层信息源优先级:官方字幕 → 烧录字幕带 → 弹幕热区 → 画面拼图。
56
+ - 字幕带自动定位(行梯度 + 跨帧分位 + 峰值检测)与官方字幕质量判断。
57
+ - 九宫格铺网:等间隔骨架 + 吸附画面变化点 + 阈值阶梯 + 去重。
58
+ - 关键帧精读:模型决策(--template / --decisions)与几何兜底两种模式。
59
+ - 弹幕过滤(刷屏 / 重复 / 引流 / 联系方式)。
60
+ - `selftest` 自检:依赖、凭证、API、磁盘。
package/README.en.md CHANGED
@@ -37,6 +37,10 @@ Then refine only a few key moments at original resolution.
37
37
  Requirements: Node.js 18+, ffmpeg.
38
38
 
39
39
  ```bash
40
+ # Option 1: install from npm (recommended)
41
+ npm i -g @pls-compile-owo/fisheye
42
+
43
+ # Option 2: from source
40
44
  git clone <repo> && cd fisheye
41
45
  cp credentials.example.json credentials.json # fill SESSDATA / bili_jct / buvid3
42
46
  node fisheye.mjs selftest --deep
package/README.md CHANGED
@@ -43,11 +43,13 @@ node fisheye.mjs auto BV1xxx --budget 20000
43
43
  **可选**:Python 3.9+(带 `numpy` 和 `Pillow`)——不装也能用,只是「烧录字幕带」功能会降级
44
44
 
45
45
  ```bash
46
+ # 方式一:npm 全局安装(推荐)
47
+ npm i -g @pls-compile-owo/fisheye
48
+
49
+ # 方式二:从源码
46
50
  git clone <this-repo>
47
51
  cd fisheye
48
-
49
- # 可选:装成全局命令
50
- npm link
52
+ npm link # 可选:装成全局命令
51
53
  ```
52
54
 
53
55
  ### 配置 B 站登录态
@@ -66,6 +68,18 @@ npm link
66
68
 
67
69
  > ⚠️ 这个文件已被 `.gitignore` 排除,**永远不要提交**。
68
70
 
71
+ ### 环境变量
72
+
73
+ | 变量 | 说明 |
74
+ |---|---|
75
+ | `FISHEYE_LANG` | CLI 输出语言:`zh`(默认)/ `en` |
76
+ | `FISHEYE_TOKENS_PER_GRID` / `FISHEYE_TOKENS_PER_SUBS` / `FISHEYE_TOKENS_PER_FINE` | 单张拼图 / 字幕带 / 精读帧的 token 估算覆盖(默认 1200 / 1000 / 1300) |
77
+ | `FISHEYE_TOKEN_MODEL` | 按模型 tokenizer 修正估算:`gpt`(1.0)/ `qwen`(1.35)/ `gemini`(0.8)/ 数字 |
78
+ | `FISHEYE_WHISPER` | whisper.cpp 可执行文件路径(音频转写,可选;不装则跳过) |
79
+ | `FISHEYE_WHISPER_MODEL` | whisper 模型文件(ggml-*.bin,可选) |
80
+ | `FISHEYE_HOME` | 数据目录(cache/out 位置,默认项目目录) |
81
+ | `FFMPEG` / `PYTHON` / `BILI_CRED` | 工具与登录态路径覆盖 |
82
+
69
83
  ### 依赖路径(一般不用管)
70
84
 
71
85
  fisheye 按这个顺序找 ffmpeg / python / 凭证:
@@ -238,10 +252,24 @@ B 站的弹幕密度本身就是内容信号。实测一条 40 分钟视频:
238
252
  ## 开发
239
253
 
240
254
  ```bash
241
- node test-danmaku-filter.js # 弹幕过滤规则单元测试(48 用例)
242
- node fisheye.mjs selftest --deep # 含抽帧/字幕带实测的自检
255
+ node --test test/ # 单元测试(参数解析 / 弹幕分析)
256
+ node test-danmaku-filter.js # 弹幕过滤规则测试(51 条用例)
257
+ node fisheye.mjs selftest --deep # 含抽帧/字幕带实测的自检
243
258
  ```
244
259
 
260
+ 项目结构:
261
+
262
+ | 文件 | 职责 |
263
+ |---|---|
264
+ | `fisheye.mjs` | CLI 入口(参数解析 / 依赖检查 / 命令分发) |
265
+ | `lib/env.mjs` | 路径与依赖解析(ffmpeg / python / 凭证 / 配置) |
266
+ | `lib/util.mjs` | 时间格式化 / 参数校验 / 文件头探测 |
267
+ | `lib/bili.mjs` | B站 API(视频信息 / WBI 签名 / 官方字幕 / 弹幕) |
268
+ | `lib/frame.mjs` | 抽帧与时间点选择(场景检测 / 字幕带定位 / 单帧截取) |
269
+ | `lib/danmaku.mjs` | 弹幕分析(广告段检测 / 热区摘要) |
270
+ | `lib/stages.mjs` | 六个子命令(auto / grid / subs / refine / grab / local) |
271
+ | `test/` | `node:test` 单元测试;CI 见 `.github/workflows/ci.yml` |
272
+
245
273
  更多文档:
246
274
 
247
275
  - [`docs/DESIGN.md`](docs/DESIGN.md) — 设计决策与取舍