dsh-movie-workbench 1.7.0 → 1.9.0

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
@@ -1,4 +1,4 @@
1
- **English** | [简体中文](README.zh.md)
1
+ **English** | [中文](README.zh.md)
2
2
 
3
3
  # dsh-movie-workbench
4
4
 
@@ -9,31 +9,13 @@ DSH **Movies workbench** : Search for movies and TV series from **TMDB**, **IMDb
9
9
 
10
10
  ## Features
11
11
 
12
- - **Film & TV search** — results grouped by channel, with posters, years, ratings and source links.
13
- - **Trending** — each channel's popular movies and TV series on the home page; the row length follows the panel width so every channel fills exactly two rows, and it re-requests on resize. DouBan rows come from the mobile recommendation feed, so each card shows its release year next to the type.
14
- - **Channel browse** — open any channel for its own page with category tabs (TMDB: This week /
15
- Movies / TV; IMDb: Featured / Movies / TV; DouBan: Popular / Movies / TV / Movie charts /
16
- TV charts) and infinite scroll for the next pages.
17
- - **DouBan charts (榜单)** — DouBan's channel page has two separate chart tabs, 电影榜单 and
18
- 剧集榜单, with collapsible sections. Movie lists group 官方榜单, 年度榜单 (2025–2021,
19
- high-score and recent-hit variants), 高分经典 and 近期热门 for 27 genres, and 冷门佳作 for
20
- each genre; TV lists group 官方榜单, 年度榜单 and 高分经典 / 近期热门 for the same genres.
21
- Generated charts use their first title's poster as the card cover. Open a chart to see the
22
- ranked titles with the same paged infinite scroll.
23
- - **Related sections on the detail page** — TMDB collections, IMDb related titles and
24
- DouBan charts sit in a right-hand rail on the title page as the same compact card:
25
- a cover, a name and a small meta line. A TMDB collection opens the collection page;
26
- an IMDb 相关系列 card opens the related-series page in release order; each DouBan
27
- 收录于榜单 card opens that chart's ranked titles directly. The middle column and the
28
- synopsis use the full remaining width, and the rail stacks below the title on narrow
29
- panels.
30
- - **Detail metadata** — the title page shows country/region, genres and runtime as small
31
- tags under the rating row: DouBan details come from the subject API, TMDB details from
32
- the movie endpoint, and IMDb details from its browser GraphQL endpoint. A DouBan title
33
- opened from a recommendation row (which carries no year) fills its release year from
34
- the same detail request.
35
- - **BT resources** — search BT resources, sortable by size, seeders or downloads, with paged
36
- loading (scroll or 加载更多 for the next page); copy the magnet link or open the source page.
12
+ - **Multi-source search** — search TMDB, IMDb and Douban together, grouped by source.
13
+ - **Trending and channel browse** — home rows plus per-source pages with category tabs and infinite scroll.
14
+ - **Douban charts** — official, annual and genre charts for movies and TV, plus movie hidden-gem charts.
15
+ - **Detail pages** — synopsis, metadata, related titles and chart placements.
16
+ - **BT resources** — search, sort, copy magnet links and open source pages.
17
+ - **AI resource pick** — rank BT rows with the profile's model, optional preferences and an editable prompt.
18
+ - **Settings** — manage data sources, the TMDB API key and the default model in one dialog.
37
19
 
38
20
  ## Installation
39
21
 
@@ -58,11 +40,24 @@ dsh plugin --profile desktop add dsh-movie-workbench
58
40
  A Git URL also works:
59
41
  `dsh plugin --profile desktop add git+https://github.com/aidc-lab/dsh-movie-workbench.git`.
60
42
 
61
- ## Data-source settings
43
+ ## Settings dialog
62
44
 
63
- The gear button next to the TMDB Key button in the page header opens the data-source switches. The
64
- choice is stored in `localStorage` (`dsh-movie-workbench.sources`); at least one channel must stay
65
- enabled, and when only one is left the filter row collapses to that channel.
45
+ The gear button in the page header opens the settings dialog, which keeps every browser-side
46
+ preference in one place:
47
+
48
+ - **Data sources** — switches for TMDB, IMDb and Douban, stored in `localStorage`
49
+ (`dsh-movie-workbench.sources`). At least one channel must stay enabled, and when only one is
50
+ left the filter row collapses to that channel.
51
+ - **TMDB API Key** — a v3 key or a v4 read token, kept in this browser only
52
+ (`dsh-movie-workbench.tmdb-key`). When the Host already has a key configured the field can
53
+ stay empty.
54
+ - **Default model** — the models advertised by the profile's LLM providers (from the Host's
55
+ `GET /models`), used by AI resource pick; the choice lives in `localStorage`
56
+ (`dsh-movie-workbench.ai-model`). Models are only available when the DSH LLM service and a
57
+ model are configured.
58
+
59
+ Nothing is applied until you press Save; closing the dialog with ×, Escape or a click
60
+ outside discards the edits.
66
61
 
67
62
  ## Host API
68
63
 
@@ -74,17 +69,20 @@ The Host side (`index.js` + `lib/`) exposes a single prefix route, `/movie-workb
74
69
  | `GET /search?q=&source=&lang=` | dispatch to the selected channels and return normalized results |
75
70
  | `GET /trending?source=&lang=&limit=` | recommendation rows, or a longer list for one channel |
76
71
  | `GET /browse?source=&category=&page=&cursor=&lang=` | one page (20 items) of a channel browse category; returns `hasMore` and, for IMDb, an opaque `next` cursor for infinite scroll |
77
- | `GET /charts?source=douban&kind=movie\|tv` | one chart catalog: `movie` (default) has 3 official charts with live metadata, 10 annual charts (高分/热门 for 2025–2021), 27 hidden-gem charts (one per genre) and 54 genre charts (94 total); `tv` has 3 official, 10 annual and 54 genre charts (67 total, no hidden gems) |
72
+ | `GET /charts?source=douban&kind=movie\|tv` | one chart catalog: `movie` (default) has 3 official charts with live metadata, 10 annual charts (high-score / recent-hit variants for 2025–2021), 27 hidden-gem charts (one per genre) and 54 genre charts (94 total); `tv` has 3 official, 10 annual and 54 genre charts (67 total, no hidden gems) |
78
73
  | `GET /chart?source=douban&id=&start=&count=` | one page of a chart's ranked titles; `id` is an official id, `year:<yyyy>:<S or U>`, `hidden:<genre>`, `genre:<genre>:<S or U>`, or the TV forms `tv-year:<yyyy>:<S or U>` / `tv-genre:<genre>:<S or U>` (S = high-score, U = recent hits) |
79
- | `GET /detail?source=douban\|tmdb\|imdb&id=` | synopsis and metadata (country/region, genres, runtime) for a DouBan title, the collection reference of a TMDB movie, or an IMDb title's metadata |
74
+ | `GET /detail?source=douban\|tmdb\|imdb&id=` | synopsis and metadata (country/region, genres, runtime) for a Douban title, the collection reference of a TMDB movie, or an IMDb title's metadata |
80
75
  | `GET /collection?source=tmdb&id=` | every part of a TMDB collection, as normalized movie results |
81
76
  | `GET /series?source=imdb&id=` | the IMDb connection chain of one title (follows / followed by / spin-off), ordered by release year |
82
- | `GET /chart?source=douban&id=collection:<id>` | one of the official charts a DouBan title is listed in, with the same ranked envelope as other charts |
77
+ | `GET /chart?source=douban&id=collection:<id>` | one of the official charts a Douban title is listed in, with the same ranked envelope as other charts |
83
78
  | `GET /torrents?q=&alt=&source=&limit=&page=` | BT resource search; one page of results (`page` 1–20) plus `hasMore` for scroll loading |
79
+ | `GET /models` | models advertised by the profile's LLM providers, plus the current profile selection |
80
+ | `POST /pick` | ask the Host's AI model to choose the best of up to 30 BT rows; body `{ item, rows, lang, preferences?, prompt?, preview?, model? }` (`preferences` = `{ quality, language, subtitle }`, `prompt` overrides the generated prompt, `preview: true` returns the prompt without calling a model), returns `pick` (`{id, rank, reason}`), `picks`, `prompt`, `preferences` and `errors` (`llm_unavailable` / `llm_no_model` / `bad_preferences` / `bad_prompt` / timeout) |
84
81
  | `GET /image?url=` | proxy posters from allowlisted image hosts |
85
82
 
86
- All upstream HTTP requests happen in the Host, so the page stays same-origin and DouBan's `Referer`
87
- requirement is handled server-side.
83
+ All upstream HTTP requests happen in the Host, so the page stays same-origin and Douban's `Referer`
84
+ requirement is handled server-side. Every route is admitted by the authenticated DSH browser
85
+ session; responses are same-origin only and carry no CORS grant.
88
86
 
89
87
  ## Configuration
90
88
 
@@ -96,21 +94,25 @@ Plugin configuration in `cordis.patch.yml`:
96
94
  | `maxResults` | `12` | result cap per channel |
97
95
  | `requestTimeoutMs` | `8000` | timeout for a single upstream request |
98
96
 
99
- TMDB needs a credential: set `tmdbApiKey`, or paste a v3 key / v4 token into the Key control in the
100
- panel (stored only in the local browser). IMDb and DouBan need no key.
97
+ TMDB needs a credential: set `tmdbApiKey`, or paste a v3 key / v4 token into the settings
98
+ dialog in the panel (stored only in the local browser). IMDb and Douban need no key.
99
+
100
+ ## Development
101
+
102
+ The browser half stays in a single `client.js` because the DSH client loader expects one
103
+ classic-script registration; edit it directly, with no build step. The Host is split into
104
+ focused ES modules under `lib/host/` behind `lib/host.js`; upstream adapters live under
105
+ `lib/providers/` behind `lib/providers.js`.
106
+
107
+ | Command | Purpose |
108
+ |---|---|
109
+ | `make check` | `node --check` on every source file |
110
+ | `make smoke` | the offline client/render/pick test suite |
111
+ | `make live` | live upstream harness against TMDB, IMDb, Douban and the BT indexes |
112
+ | `make publish` | publish the package to npm (prompts for a 2FA code) |
101
113
 
102
114
  ## Notes
103
115
 
104
- - Requires the DSH Web GUI (it provides `ctx.webServer`) and access to `api.themoviedb.org`,
105
- `v2.sg.media-imdb.com`, `api.graphql.imdb.com`, `movie.douban.com`, `bt4gprx.com`,
106
- `bitsearch.to` and the poster image hosts.
107
- - IMDb search results carry no rating; DouBan recommendations include the public `rate`; TMDB
108
- provides ratings and vote counts.
109
- - IMDb related titles come from IMDb's browser GraphQL `connections` field (up to 1,250
110
- relations per title); DouBan ranking chips come from `subject_collections` in the
111
- subject payload.
112
- - Channel browse pages return 20 items per page and stop at page 100. IMDb browse pages are
113
- cursor paged through IMDb's browser GraphQL popularity index, so scrolling keeps loading new
114
- titles; the home Trending row still uses a curated seed list, which is why it is limited.
115
- - suggestion, rexxar, BT4G and BitSearch are undocumented endpoints and may change or rate-limit;
116
- failures are surfaced per channel and do not affect the others.
116
+ - Requires the DSH Web GUI and network access to TMDB, IMDb, Douban, BT4G, BitSearch and the poster hosts.
117
+ - IMDb search results have no rating; Douban recommendations include the public `rate`; TMDB returns ratings and votes.
118
+ - Some upstream endpoints are undocumented and may change or rate-limit; failures are isolated per channel.
package/README.zh.md CHANGED
@@ -9,23 +9,13 @@ DSH **影视工作台**:在一个页面里检索 **TMDB**、**IMDb** 和 **豆
9
9
 
10
10
  ## 功能
11
11
 
12
- - **影视搜索** — 结果按渠道分组,含海报、年份、评分与来源链接。
13
- - **热门推荐** — 首页展示各渠道热门推荐影视;每行数量随面板宽度自适应,正好铺满两行,窗口尺寸变化时自动重新请求。豆瓣推荐数据来自移动端推荐接口,卡片与其它渠道一样显示年份。
14
- - **渠道浏览** — 点进渠道进入独立页面,按分类标签切换(TMDB:本周趋势 / 电影 / 剧集;
15
- IMDb:精选作品 / 电影 / 剧集;豆瓣:热门推荐 / 电影 / 剧集 / 电影榜单 / 剧集榜单),下滑自动加载下一页。
16
- - **豆瓣榜单** — 豆瓣渠道页有「电影榜单」和「剧集榜单」两个标签,分组均可折叠。电影榜单包含
17
- 官方榜单、年度榜单(2025–2021,含高分/热门两档)、高分经典(27 个类型)、近期热门(27 个类型)和
18
- 冷门佳作(27 个类型);剧集榜单包含官方榜单、年度榜单和高分经典 / 近期热门。
19
- 无封面的榜单自动取第一名作品的封面,点开榜单按排名展示影片,同样支持下滑加载更多。
20
- - **详情页的相关卡片** — TMDB 合集、IMDb 相关系列、豆瓣收录于榜单统一放在详情页右侧栏,
21
- 显示为同一款紧凑卡片(封面 + 名称 + 一行说明):TMDB 合集进入合集页,IMDb 相关系列
22
- 按上映年份浏览全部相关作品,豆瓣的每个榜单卡片直接打开该榜单的排名影片。中间正文与简介
23
- 占满剩余宽度,面板较窄时右侧栏自动落到正文下方。
24
- - **详情元数据** — 详情页在评分标签下以小型标签展示国家/地区、分类与片长:豆瓣来自条目
25
- 接口,TMDB 来自电影详情接口,IMDb 来自其浏览器 GraphQL 接口;从推荐行进入的豆瓣条目
26
- (推荐数据不带年份)会用同一次详情请求补上发行年份。
27
- - **BT 资源** — 查找 BT 资源,可按大小、做种、下载排序,支持下滑/「加载更多」分页;
28
- 可复制磁力链接或打开来源页。
12
+ - **多源搜索** — 同时检索 TMDB、IMDb 和豆瓣,结果按来源分组。
13
+ - **热门与渠道浏览** — 首页热门行,以及各来源的渠道页、分类标签和无限加载。
14
+ - **豆瓣榜单** — 电影与剧集的官方、年度和类型榜单,以及电影冷门佳作。
15
+ - **详情页** — 简介、元数据、相关作品与榜单收录。
16
+ - **BT 资源** — 搜索、排序、复制磁力链接和打开来源页。
17
+ - **AI 选资源** — 用 Profile 模型为 BT 资源排序,可选偏好并编辑提示词。
18
+ - **设置** — 在一个对话框里管理数据源、TMDB API Key 和默认模型。
29
19
 
30
20
  ## 安装
31
21
 
@@ -49,10 +39,19 @@ dsh plugin --profile desktop add dsh-movie-workbench
49
39
  也支持 Git URL:`dsh plugin --profile desktop add
50
40
  git+https://github.com/aidc-lab/dsh-movie-workbench.git`。
51
41
 
52
- ## 数据源设置
42
+ ## 设置对话框
53
43
 
54
- 页头 TMDB Key 按钮旁的齿轮按钮打开数据源开关。选择保存在 `localStorage`
55
- (`dsh-movie-workbench.sources`);至少保留一个渠道,只剩一个时筛选行收起到该渠道。
44
+ 页头的齿轮按钮打开设置对话框,浏览器的本地偏好都集中在这里:
45
+
46
+ - **数据源** — TMDB、IMDb、豆瓣三个开关,保存在 `localStorage`
47
+ (`dsh-movie-workbench.sources`);至少保留一个渠道,只剩一个时筛选行收起到该渠道。
48
+ - **TMDB API Key** — 支持 v3 Key 或 v4 读取令牌,只保存在本机浏览器
49
+ (`dsh-movie-workbench.tmdb-key`);Host 端已配置 Key 时可以留空。
50
+ - **默认模型** — 列出 Profile 的 LLM 提供商所提供的模型(来自 Host 的 `GET /models`),
51
+ 供「AI 选资源」使用;选择保存在 `localStorage`(`dsh-movie-workbench.ai-model`)。
52
+ 只有配置了 DSH LLM 服务与模型时才可用。
53
+
54
+ 所有修改按下「保存」后才会生效;点 ×、按 Escape 或点击对话框外部关闭会丢弃本次修改。
56
55
 
57
56
  ## Host API
58
57
 
@@ -71,11 +70,12 @@ Host 端(`index.js` + `lib/`)只有一个前缀路由 `/movie-workbench/api`
71
70
  | `GET /series?source=imdb&id=` | 单个 IMDb 条目的相关系列(前作 / 续作 / 衍生),按上映年份排序 |
72
71
  | `GET /chart?source=douban&id=collection:<id>` | 豆瓣条目收录的某个官方榜单,返回结构与其他榜单一致 |
73
72
  | `GET /torrents?q=&alt=&source=&limit=&page=` | BT 资源搜索;返回一页结果(`page` 1–20)及 `hasMore` 供下滑加载 |
73
+ | `GET /models` | Profile 的 LLM 提供商所提供的模型,以及当前 Profile 选中的模型 |
74
+ | `POST /pick` | 让 Host 端 AI 模型从最多 30 条 BT 资源中挑选最佳;请求体 `{ item, rows, lang, preferences?, prompt?, preview?, model? }`(`preferences` 为 `{ quality, language, subtitle }`,`prompt` 覆盖默认提示词,`preview: true` 只返回提示词不调用模型),返回 `pick`(`{id, rank, reason}`)、`picks`、`prompt`、`preferences` 与 `errors`(`llm_unavailable` / `llm_no_model` / `bad_preferences` / `bad_prompt` / 超时等) |
74
75
  | `GET /image?url=` | 代理白名单图床的海报 |
75
76
 
76
- 所有上游 HTTP 请求都在 Host 完成,因此页面保持同源,豆瓣的 `Referer` 要求也在服务端
77
- 处理。IMDb 浏览页通过 IMDb 的浏览器 GraphQL 接口做游标分页,可以一直下滑加载新条目;
78
- 首页推荐行仍使用固定精选列表,因此数量有限。
77
+ 所有上游 HTTP 请求都在 Host 完成,因此页面保持同源,豆瓣的 `Referer` 要求也由服务端
78
+ 处理。所有路由都经过 DSH 浏览器会话的访问检查;响应仅限同源,不发送 CORS 授权。
79
79
 
80
80
  ## 配置
81
81
 
@@ -87,18 +87,24 @@ Host 端(`index.js` + `lib/`)只有一个前缀路由 `/movie-workbench/api`
87
87
  | `maxResults` | `12` | 每个渠道的结果上限 |
88
88
  | `requestTimeoutMs` | `8000` | 单个上游请求超时 |
89
89
 
90
- TMDB 需要凭据:可设置 `tmdbApiKey`,或在面板的 Key 控件里粘贴 v3 Key / v4 令牌
90
+ TMDB 需要凭据:可设置 `tmdbApiKey`,或在面板的「设置」对话框里粘贴 v3 Key / v4 令牌
91
91
  (只保存在本机浏览器)。IMDb 与豆瓣无需 Key。
92
92
 
93
+ ## 开发
94
+
95
+ 浏览器端仍保持单个 `client.js`(DSH 客户端加载器只接受一次 classic-script 注册),
96
+ 直接修改即可,没有构建步骤。Host 拆分为 `lib/host/` 下的独立 ES 模块,统一由
97
+ `lib/host.js` 导出;上游适配器位于 `lib/providers/`,统一由 `lib/providers.js` 导出。
98
+
99
+ | 命令 | 用途 |
100
+ |---|---|
101
+ | `make check` | 对所有源文件执行 `node --check` |
102
+ | `make smoke` | 离线的 client/render/pick 测试 |
103
+ | `make live` | 对 TMDB、IMDb、豆瓣和 BT 索引的在线联调 |
104
+ | `make publish` | 发布到 npm(会提示输入 2FA 验证码) |
105
+
93
106
  ## 说明
94
107
 
95
- - 需要 DSH Web GUI(提供 `ctx.webServer`),并能访问
96
- `api.themoviedb.org`、`v2.sg.media-imdb.com`、`movie.douban.com`、`bt4gprx.com`、
97
- `bitsearch.to` 及海报图床。
108
+ - 需要 DSH Web GUI,并能访问 TMDB、IMDb、豆瓣、BT4G、BitSearch 及海报图床。
98
109
  - IMDb 搜索结果没有评分;豆瓣推荐带公开的 `rate`;TMDB 提供评分与票数。
99
- - IMDb 相关系列来自 IMDb 浏览器 GraphQL 的 `connections` 字段(单个条目最多 1250 条关系);
100
- 豆瓣收录于榜单来自条目详情里的 `subject_collections` 字段。
101
- - 渠道浏览每页 20 条、最多 100 页;IMDb 浏览页基于精选种子列表经 suggestion API 解析,
102
- 因此一页可能不足 20 条。
103
- - suggestion、rexxar、BT4G 与 BitSearch 都是未公开接口,可能变更或限流;失败时按渠道
104
- 单独提示,不影响其他渠道。
110
+ - 部分上游接口未公开,可能变更或限流;失败按渠道隔离,不影响其他渠道。