krillplayer-plugin 0.1.1 → 0.3.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 +22 -0
- package/dist/cli.js +215 -196
- package/dist/crypto.d.ts +8 -0
- package/dist/crypto.js +1589 -0
- package/dist/zip.d.ts +13 -0
- package/dist/zip.js +68 -0
- package/package.json +11 -2
- package/skill/krillplayer-plugin/SKILL.md +2 -1
- package/skill/krillplayer-plugin/assets/samples/file-share/plugin.ts +1 -20
- package/skill/krillplayer-plugin/assets/samples/media-server/plugin.ts +1 -35
- package/skill/krillplayer-plugin/assets/samples/network-share/plugin.ts +1 -20
- package/skill/krillplayer-plugin/references/choosing-a-kind.md +2 -2
- package/skill/krillplayer-plugin/references/contract.d.ts +95 -129
- package/skill/krillplayer-plugin/references/errors-and-fixes.md +1 -1
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-empty-folder.json +0 -11
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-gone-not-found.json +0 -12
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-lists-subfolders-and-media.json +0 -28
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-second-page.json +0 -22
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-skips-subtitles.json +0 -21
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-root-first-page.json +0 -25
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-root-second-page.json +0 -22
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-changes-everything-first-page.json +0 -74
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-changes-everything-last-page.json +0 -86
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-changes-nothing-new.json +0 -12
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-changes-since-a-token-with-a-removal.json +0 -88
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-ids-first-page.json +0 -15
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-ids-last-page.json +0 -14
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-empty-folder.json +0 -60
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-folder-gives-size-and-modified-time.json +0 -78
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-folder-gone-not-found.json +0 -60
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-folder-second-page.json +0 -71
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-read-a-range.json +0 -62
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-read-an-info-file.json +0 -62
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-read-file-gone-not-found.json +0 -62
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-root.json +0 -84
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-source-offline-retryable.json +0 -61
package/dist/zip.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// krillplayer-plugin/zip:读写插件包(zip),与 `krillplayer-plugin bundle` 用的是同一份代码,只在 Node 里用。
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 按给的顺序把文件写成插件包:只存不压、时间固定为 1980-01-01、文件名按 UTF-8 写,同样的输入在任何机器上得到同样的字节。
|
|
6
|
+
* 与 bundle 打出的插件包逐字节相同的前提是文件与顺序也相同。
|
|
7
|
+
*/
|
|
8
|
+
export function writeZip(entries: { name: string; data: Uint8Array }[]): Buffer;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 读出插件包里的每个文件(文件名 → 内容)。只认只存不压的 zip;找不到目录、目录坏了、有压缩过的文件或 CRC 对不上时抛错。
|
|
12
|
+
*/
|
|
13
|
+
export function readZip(zip: Buffer): Map<string, Buffer>;
|
package/dist/zip.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// packer/zip.ts
|
|
2
|
+
import { crc32 } from "node:zlib";
|
|
3
|
+
var DOS_DATE = 0 << 9 | 1 << 5 | 1;
|
|
4
|
+
var UTF8_NAMES = 2048;
|
|
5
|
+
function writeZip(entries) {
|
|
6
|
+
const locals = [];
|
|
7
|
+
const centrals = [];
|
|
8
|
+
let offset = 0;
|
|
9
|
+
for (const { name, data } of entries) {
|
|
10
|
+
const nameBytes = Buffer.from(name, "utf8");
|
|
11
|
+
const crc = crc32(data);
|
|
12
|
+
const local = Buffer.alloc(30);
|
|
13
|
+
local.writeUInt32LE(67324752, 0);
|
|
14
|
+
local.writeUInt16LE(20, 4);
|
|
15
|
+
local.writeUInt16LE(UTF8_NAMES, 6);
|
|
16
|
+
local.writeUInt16LE(DOS_DATE, 12);
|
|
17
|
+
local.writeUInt32LE(crc, 14);
|
|
18
|
+
local.writeUInt32LE(data.length, 18);
|
|
19
|
+
local.writeUInt32LE(data.length, 22);
|
|
20
|
+
local.writeUInt16LE(nameBytes.length, 26);
|
|
21
|
+
const central = Buffer.alloc(46);
|
|
22
|
+
central.writeUInt32LE(33639248, 0);
|
|
23
|
+
central.writeUInt16LE(20, 4);
|
|
24
|
+
central.writeUInt16LE(20, 6);
|
|
25
|
+
central.writeUInt16LE(UTF8_NAMES, 8);
|
|
26
|
+
central.writeUInt16LE(DOS_DATE, 14);
|
|
27
|
+
central.writeUInt32LE(crc, 16);
|
|
28
|
+
central.writeUInt32LE(data.length, 20);
|
|
29
|
+
central.writeUInt32LE(data.length, 24);
|
|
30
|
+
central.writeUInt16LE(nameBytes.length, 28);
|
|
31
|
+
central.writeUInt32LE(offset, 42);
|
|
32
|
+
locals.push(local, nameBytes, Buffer.from(data));
|
|
33
|
+
centrals.push(central, nameBytes);
|
|
34
|
+
offset += local.length + nameBytes.length + data.length;
|
|
35
|
+
}
|
|
36
|
+
const directory = Buffer.concat(centrals);
|
|
37
|
+
const end = Buffer.alloc(22);
|
|
38
|
+
end.writeUInt32LE(101010256, 0);
|
|
39
|
+
end.writeUInt16LE(entries.length, 8);
|
|
40
|
+
end.writeUInt16LE(entries.length, 10);
|
|
41
|
+
end.writeUInt32LE(directory.length, 12);
|
|
42
|
+
end.writeUInt32LE(offset, 16);
|
|
43
|
+
return Buffer.concat([...locals, directory, end]);
|
|
44
|
+
}
|
|
45
|
+
function readZip(zip) {
|
|
46
|
+
const end = zip.length - 22;
|
|
47
|
+
if (end < 0 || zip.readUInt32LE(end) !== 101010256) throw new Error("not a plugin zip (end of central directory not found)");
|
|
48
|
+
const files = /* @__PURE__ */ new Map();
|
|
49
|
+
let position = zip.readUInt32LE(end + 16);
|
|
50
|
+
for (let index = 0; index < zip.readUInt16LE(end + 10); index += 1) {
|
|
51
|
+
if (zip.readUInt32LE(position) !== 33639248) throw new Error("corrupt central directory");
|
|
52
|
+
const nameLength = zip.readUInt16LE(position + 28);
|
|
53
|
+
const name = zip.toString("utf8", position + 46, position + 46 + nameLength);
|
|
54
|
+
if (zip.readUInt16LE(position + 10) !== 0) throw new Error(`${name} is compressed; plugin zips are stored only`);
|
|
55
|
+
const size = zip.readUInt32LE(position + 24);
|
|
56
|
+
const local = zip.readUInt32LE(position + 42);
|
|
57
|
+
const start = local + 30 + zip.readUInt16LE(local + 26) + zip.readUInt16LE(local + 28);
|
|
58
|
+
const data = zip.subarray(start, start + size);
|
|
59
|
+
if (crc32(data) !== zip.readUInt32LE(position + 16)) throw new Error(`${name} fails its CRC`);
|
|
60
|
+
files.set(name, data);
|
|
61
|
+
position += 46 + nameLength + zip.readUInt16LE(position + 30) + zip.readUInt16LE(position + 32);
|
|
62
|
+
}
|
|
63
|
+
return files;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
readZip,
|
|
67
|
+
writeZip
|
|
68
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "krillplayer-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Write, pack, record and test KrillPlayer source plugins on the App's own QuickJS-ng engine, with an AI skill.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://krillplayer.kami.asia",
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"types": "./skill/krillplayer-plugin/references/contract.d.ts"
|
|
18
18
|
},
|
|
19
|
+
"./zip": {
|
|
20
|
+
"types": "./dist/zip.d.ts",
|
|
21
|
+
"default": "./dist/zip.js"
|
|
22
|
+
},
|
|
23
|
+
"./crypto": {
|
|
24
|
+
"types": "./dist/crypto.d.ts",
|
|
25
|
+
"default": "./dist/crypto.js"
|
|
26
|
+
},
|
|
19
27
|
"./package.json": "./package.json"
|
|
20
28
|
},
|
|
21
29
|
"files": [
|
|
@@ -25,6 +33,7 @@
|
|
|
25
33
|
"templates",
|
|
26
34
|
"skill",
|
|
27
35
|
"README.md",
|
|
36
|
+
"CHANGELOG.md",
|
|
28
37
|
"LICENSE"
|
|
29
38
|
],
|
|
30
39
|
"dependencies": {
|
|
@@ -32,6 +41,6 @@
|
|
|
32
41
|
"eslint": "9.39.5"
|
|
33
42
|
},
|
|
34
43
|
"optionalDependencies": {
|
|
35
|
-
"@krillplayer/plugin-engine-darwin-arm64": "0.
|
|
44
|
+
"@krillplayer/plugin-engine-darwin-arm64": "0.3.0"
|
|
36
45
|
}
|
|
37
46
|
}
|
|
@@ -40,11 +40,12 @@ cd <目录> && npm install && npx krillplayer-plugin check
|
|
|
40
40
|
先弄清来源有什么,再动代码:
|
|
41
41
|
|
|
42
42
|
- **种类**:照 [choosing-a-kind.md](references/choosing-a-kind.md) 的问题按顺序问,给来源里的每样东西定一个种类(频道、合集、条目各自的哪一种)。哪个都不像时不要硬套。
|
|
43
|
-
- **槽位**:大多数来源导出 `browse`(`list` 必须有,`search`、`channel`、`collection`、`schedule` 按需)与 `play`(`start
|
|
43
|
+
- **槽位**:大多数来源导出 `browse`(`list` 必须有,`search`、`channel`、`collection`、`schedule` 按需)与 `play`(`start`)。插件只交数据,不交版式:有几份列表(推荐、分区、排行)的导出 `browse.lists`,交几份具名列表,`list`、`parameters`、`options` 多收一个列表的 id(`BrowseListsSlot`);只有一份的不导出 `lists`(`BrowseSlot`)。来源页怎么画由 App 定,没有拼页面的槽位。播放器的侧栏(相关推荐、评论、选集)与卡片上的操作导出 `views`(`panel`、`action`),在清单的 `contributes.playerPanels`、`cardActions` 里按条目种类声明:`panel` 交一串条目(`{ kind: "entries", entries }`)或一串评论(`{ kind: "comments", comments }`),`action` 交一句话(`{ kind: "message", message }`)或一串条目,长相都由 App 定(`ViewsSlot`)。认分享链接导出顶层的 `resolve`;开播状态导出 `status`;要登录导出 `login`。能按作品回答有没有可播版本的来源导出 `resources`(`find`,返回版本,不是条目)。App 不整库扫描来源,没有列出全部内容的槽位。只给作品清单(榜单)的目录插件只导出 `browse`,电影与剧集带上外部 `ids`,App 就把它们当作品,版本由别的来源给。函数名与参数只照 `contract.d.ts` 里的 `BrowseListsSlot`、`BrowseSlot`、`PlaySlot` 等接口写。
|
|
44
44
|
- **App 尚未使用**:`contract.d.ts` 里行尾注释标着「App 尚未使用」的函数与字段,契约里已经有了,这一版的 App 还没接上:导出了这类函数,打包与试跑照常通过,但会打一条 `WARN`,App 不会调它;这类字段给了也不会被读。先把标注之外的做好,标注的按来源有的给,别为了它们改种类或 id。
|
|
45
45
|
- **id**:每个频道、合集、条目的 id 由你定,要稳定(之后改 id 等于让用户的订阅、收藏、续播全部失效)。同一来源里能起播的 id 不重复;直播条目的 id 也由你给。
|
|
46
46
|
- **主机**:插件自己经 `krillplayer.http.request` 发的请求只能去清单 `hosts` 里的主机,按主机名精确匹配,不分大小写,不看端口,**不含子域名**(`api.example.com` 与 `example.com` 要分别写),重定向的每一跳都查。`hosts` 只管插件自己的请求:`play.start` 交给播放器的流地址、`image` 等图片地址不用写进去,播放器拉流时的重定向也不查。用户自己填的服务器地址:声明 `userProvidedURLs: true`,并在 `parameters` 里声明一个 `kind: "url"` 的实例参数。
|
|
47
47
|
- **图片地址**:公网的只取 https(给 http 时改成 https 取),局域网与本机的只在它就是用户填的那台主机时才取,按用户填的协议。App 按「来源实例、去掉尺寸参数后的地址、尺寸档」缓存图片;地址里每次都变的令牌或盐(例如 Subsonic 的 `t`、`s`,Emby 的 `api_key`)写进清单的 `imageCacheIgnoredParameters`,换了令牌仍命中同一份缓存。
|
|
48
|
+
- **来源与登录**:用户在 App 的来源页每添加一次就是一个来源实例,没有实例参数也能加多个(多个账号就是多个来源)。导出 `login` 的插件添加时就能登录,登不登由用户选;不登录什么都看不了的来源在清单写 `loginRequired: true`,添加时就必须登录。确实只能有一个来源的才写 `singleSource: true`。设置项(`settings`)默认所有来源共用一份,要每个来源各一份的那一项写 `perSource: true`。
|
|
48
49
|
- **失败**:每种失败应答(不存在、要登录、地区限制、还没开始、已结束、被拒、暂时失败)给哪个 `PluginErrorKind`。
|
|
49
50
|
|
|
50
51
|
完成判据:对每个要导出的函数,说得出它的入参、返回类型名、每种失败抛哪个 kind;id 的写法定下来;`hosts` 列全。
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// 目录的应答是一份 WebDAV 的 PROPFIND(207 Multi-Status),用 krillplayer.formats.xml 解,按命名空间与本地名找元素。
|
|
5
5
|
// 资料库槽位把同一份目录给内核扫描进索引:一次一层,带名字、大小与修改时间,目录不在了抛 notFound。
|
|
6
6
|
import type {
|
|
7
|
-
At, BrowseSlot, CollectionRef, Entry, File, Folder,
|
|
7
|
+
At, BrowseSlot, CollectionRef, Entry, File, Folder, Paged, PlaySlot, XMLNode,
|
|
8
8
|
} from "krillplayer-plugin";
|
|
9
9
|
|
|
10
10
|
const SERVER = "https://dav.example/share/";
|
|
@@ -158,25 +158,6 @@ export const browse = {
|
|
|
158
158
|
},
|
|
159
159
|
} satisfies BrowseSlot;
|
|
160
160
|
|
|
161
|
-
// 资料库:一次列一层,内核自己往下走。文件的 itemId 就是 browse 给的那个 File 的 id(路径),不是音视频的文件不列。
|
|
162
|
-
export const library = {
|
|
163
|
-
async list(krillplayer, dir, cursor) {
|
|
164
|
-
const found = listingOf(krillplayer, dir);
|
|
165
|
-
if (found === undefined) throw krillplayer.error("notFound", "这个文件夹已不在了");
|
|
166
|
-
const entries = found.flatMap((resource): LibraryEntry[] => {
|
|
167
|
-
const times = resource.modified === undefined ? {} : { modified: resource.modified };
|
|
168
|
-
if (resource.directory) return [{ type: "directory", path: resource.path, name: resource.name, ...times }];
|
|
169
|
-
const media = mediaOf(resource);
|
|
170
|
-
if (media === undefined) return [];
|
|
171
|
-
return [{
|
|
172
|
-
type: "file", path: resource.path, name: resource.name, itemId: resource.path, media,
|
|
173
|
-
...(resource.size === undefined ? {} : { size: resource.size }), ...times,
|
|
174
|
-
}];
|
|
175
|
-
});
|
|
176
|
-
return page(entries, cursor);
|
|
177
|
-
},
|
|
178
|
-
} satisfies LibrarySlot;
|
|
179
|
-
|
|
180
161
|
// 文件按路径起播:地址是来源根加上逐段编码的路径。文件不连播,也没有别的线路。
|
|
181
162
|
// 文件不在了抛 notFound:内核给出「文件不在了」的说明,并重扫它所在的目录。
|
|
182
163
|
export const play = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// 看点:电影、剧集、季、集、影视合集、文件夹与文件各是一个种类;层级用字段表示,不拼进 id;
|
|
3
3
|
// 同一部电影的几个文件是一个条目的几个版本;集按播放顺序排好,at.around 从那一集开始往后给。
|
|
4
4
|
import type {
|
|
5
|
-
At, BrowseSlot, Collection, CollectionRef, Entry, Episode, File, Item,
|
|
5
|
+
At, BrowseSlot, Collection, CollectionRef, Entry, Episode, File, Item, Movie, Paged, PlaySlot,
|
|
6
6
|
} from "krillplayer-plugin";
|
|
7
7
|
|
|
8
8
|
const MEDIA = "https://media.example/stream";
|
|
@@ -116,40 +116,6 @@ export const browse = {
|
|
|
116
116
|
},
|
|
117
117
|
} satisfies BrowseSlot;
|
|
118
118
|
|
|
119
|
-
// 资料库:媒体服务器不列目录,交回自己已经识别过的电影与集,内核直接用这里的 id 与 ids 进海报墙,
|
|
120
|
-
// 不按文件名搜索。每个条目记着最后一次改动的序号,交回的 since 是最新的序号,since 之后改过的才交回;删掉的条目在 REMOVED 里。
|
|
121
|
-
// 影视合集(boxSet)与文件夹不进资料库:服务器自建的合集只在它自己的浏览里。
|
|
122
|
-
const CHANGED: Record<string, number> = { m1: 1, m2: 2, "e0-1": 3, "e1-1": 3, "e1-2": 4, "e2-1": 5 };
|
|
123
|
-
const REMOVED: Record<string, number> = { m0: 4 };
|
|
124
|
-
const LATEST = "5";
|
|
125
|
-
const SERIES = COLLECTIONS.find((candidate): candidate is Series => candidate.kind === "series")!;
|
|
126
|
-
const identified = (value: Movie | Episode): LibraryEntry =>
|
|
127
|
-
value.kind === "movie" ? { type: "identified", item: value } : { type: "identified", item: value, series: SERIES };
|
|
128
|
-
|
|
129
|
-
export const library = {
|
|
130
|
-
async changes(krillplayer, since, cursor) {
|
|
131
|
-
const after = since === null ? 0 : Number(since);
|
|
132
|
-
if (!Number.isInteger(after)) throw krillplayer.error("other", "认不出的 since");
|
|
133
|
-
const changed = [...MOVIES, ...EPISODES].filter((candidate) => CHANGED[candidate.id]! > after).map(identified);
|
|
134
|
-
const start = Number(cursor ?? "0");
|
|
135
|
-
const end = start + PAGE_SIZE;
|
|
136
|
-
const removed = since === null || start > 0 ? [] : Object.keys(REMOVED).filter((id) => REMOVED[id]! > after);
|
|
137
|
-
return {
|
|
138
|
-
entries: changed.slice(start, end),
|
|
139
|
-
...(removed.length > 0 ? { removed } : {}),
|
|
140
|
-
...(end < changed.length ? { next: String(end) } : {}),
|
|
141
|
-
since: LATEST,
|
|
142
|
-
};
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
async ids(_krillplayer, cursor) {
|
|
146
|
-
const all = [...MOVIES, ...EPISODES].map((candidate) => candidate.id);
|
|
147
|
-
const start = Number(cursor ?? "0");
|
|
148
|
-
const end = start + 4;
|
|
149
|
-
return { ids: all.slice(start, end), ...(end < all.length ? { next: String(end) } : {}) };
|
|
150
|
-
},
|
|
151
|
-
} satisfies LibrarySlot;
|
|
152
|
-
|
|
153
119
|
// 条目与版本都用自己的 id 起播:一个来源实例里它们不重复。
|
|
154
120
|
export const play = {
|
|
155
121
|
async start(krillplayer, itemId) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// 不接住 krillplayer.files 的失败:找不到、没有权限、连不上各带着自己的种类交给内核;
|
|
5
5
|
// 起播时顺手把同目录、同名的字幕文件列进 Playable.subtitles,地址同样用 krillplayer.files.playable 给。
|
|
6
6
|
import type {
|
|
7
|
-
At, BrowseSlot, CollectionRef, Entry, File, FileEntry, Folder, KrillPlayer,
|
|
7
|
+
At, BrowseSlot, CollectionRef, Entry, File, FileEntry, Folder, KrillPlayer, Paged, Playable, PlaySlot,
|
|
8
8
|
} from "krillplayer-plugin";
|
|
9
9
|
|
|
10
10
|
const VIDEO = new Set(["mp4", "m4v", "mov", "mkv", "avi", "ts", "m2ts", "webm", "flv", "wmv"]);
|
|
@@ -66,25 +66,6 @@ export const browse = {
|
|
|
66
66
|
},
|
|
67
67
|
} satisfies BrowseSlot;
|
|
68
68
|
|
|
69
|
-
// 资料库:对 krillplayer.files 的薄包装。一次列一层,内核自己往下走;文件的 itemId 就是 browse 给的那个 File 的 id。
|
|
70
|
-
export const library = {
|
|
71
|
-
async list(krillplayer, dir, cursor) {
|
|
72
|
-
const page = await krillplayer.files.list(dir, cursor);
|
|
73
|
-
const entries = page.entries.filter(shown).flatMap((entry): LibraryEntry[] => {
|
|
74
|
-
if (entry.isDirectory) return [{ type: "directory", path: entry.path, name: entry.name, ...times(entry) }];
|
|
75
|
-
const media = mediaOf(entry.name);
|
|
76
|
-
if (media === undefined) return [];
|
|
77
|
-
return [{ type: "file", path: entry.path, name: entry.name, itemId: entry.path, media, ...sizes(entry), ...times(entry) }];
|
|
78
|
-
});
|
|
79
|
-
return { entries, ...(page.next === undefined ? {} : { next: page.next }) };
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
// 内核读同目录的信息文件(NFO)用。
|
|
83
|
-
async read(krillplayer, path, offset, length) {
|
|
84
|
-
return krillplayer.files.read(path, offset, length);
|
|
85
|
-
},
|
|
86
|
-
} satisfies LibrarySlot;
|
|
87
|
-
|
|
88
69
|
// 同目录里与视频同名的字幕:「片名.srt」或「片名.zh.srt」,中间那一段当语言,没有就是 und。最多翻 SUBTITLE_PAGES 页目录。
|
|
89
70
|
const SUBTITLE_PAGES = 20;
|
|
90
71
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
排期与预告的分界只有一条:**来源给没给它一个能拿去 `play.start` 的 id。** 给了是预告,没给是排期。
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
哪个都不像时不要硬套:用最朴素的 `onDemand` 或 `file`,并在插件的说明里写一句。这是我们该不该加种类的信号。
|
|
38
38
|
|
|
39
39
|
试跑器按本节的类型逐个检查返回的对象,字段不属于这个种类、必填的没给,都直接报错并说明该怎么改。
|
|
40
40
|
|
|
@@ -66,4 +66,4 @@
|
|
|
66
66
|
| `onDemand` 点播 | 频道发布的、随时能播的一段内容,不是影视作品,也不是播客单集。平台上的普通视频、直播的回放、电台的回听都是它 | 记 | 播放页 |
|
|
67
67
|
| `live` 直播 | 此刻正在播出的一路:直播间在播的、电视台与电台正在播的 | 不记 | 播放页 |
|
|
68
68
|
| `upcoming` 预告 | 来源给了独立 id、还没开始的一场直播或首播 | 不能播 | 详情与提醒 |
|
|
69
|
-
| `file` 文件 |
|
|
69
|
+
| `file` 文件 | 文件类来源里的一个媒体文件。App 按文件夹浏览,不把它认成作品,续播记在文件上 | 记 | 播放页 |
|