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
|
@@ -23,7 +23,7 @@ export interface Paged<T> {
|
|
|
23
23
|
export type Ids = Record<string, string>;
|
|
24
24
|
|
|
25
25
|
// 能力由打包器按导出的函数生成(SLOT_RULES),插件不手写。
|
|
26
|
-
export type Capability = "browse" | "music" | "play" | "resolve" | "
|
|
26
|
+
export type Capability = "browse" | "music" | "play" | "resolve" | "resources" | "subtitles" | "subtitleSearch" | "danmaku" | "danmakuMatch" | "status" | "login" | "playbackReport" | "danmakuSend" | "browseLists" | "playerPanels" | "cardActions";
|
|
27
27
|
|
|
28
28
|
// 内容对象。通用域三样结构:频道、合集、条目,每个种类一个类型,只带属于它的字段。
|
|
29
29
|
// 种类的取值是内核定死的词表,插件不能自造。比插件旧的 App 遇到不认识的种类时跳过数组里的那一项、把可选字段当作没给;
|
|
@@ -124,11 +124,11 @@ export interface PodcastEpisode {
|
|
|
124
124
|
summary?: string; // App 尚未使用
|
|
125
125
|
media: Media;
|
|
126
126
|
podcast: ChannelRef;
|
|
127
|
-
season?: number; //
|
|
128
|
-
index?: number; //
|
|
127
|
+
season?: number; // 整数
|
|
128
|
+
index?: number; // 整数
|
|
129
129
|
episodeType?: PodcastEpisodeType; // App 尚未使用
|
|
130
130
|
duration?: number;
|
|
131
|
-
published?: number;
|
|
131
|
+
published?: number;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
export type PodcastEpisodeType = "full" | "trailer" | "bonus";
|
|
@@ -178,7 +178,7 @@ export interface Upcoming {
|
|
|
178
178
|
end?: number; // App 尚未使用
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
// filename
|
|
181
|
+
// filename 是原始文件名,给字幕匹配用。
|
|
182
182
|
export interface File {
|
|
183
183
|
kind: "file";
|
|
184
184
|
id: string;
|
|
@@ -255,7 +255,7 @@ export interface Season {
|
|
|
255
255
|
ancestors?: CollectionRef[]; // App 尚未使用
|
|
256
256
|
index: number; // 整数
|
|
257
257
|
series: CollectionRef;
|
|
258
|
-
ids?: Ids;
|
|
258
|
+
ids?: Ids; // App 尚未使用
|
|
259
259
|
}
|
|
260
260
|
|
|
261
261
|
export interface BoxSet {
|
|
@@ -266,7 +266,7 @@ export interface BoxSet {
|
|
|
266
266
|
summary?: string;
|
|
267
267
|
count?: number; // 整数
|
|
268
268
|
ancestors?: CollectionRef[]; // App 尚未使用
|
|
269
|
-
ids?: Ids;
|
|
269
|
+
ids?: Ids; // App 尚未使用
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
export interface Playlist {
|
|
@@ -299,6 +299,16 @@ export type Entry =
|
|
|
299
299
|
| { type: "collection"; collection: Collection }
|
|
300
300
|
;
|
|
301
301
|
|
|
302
|
+
// 具名列表:插件交出的一份数据,id 稳定,App 按 kind(内容大类)给它取默认的样式,怎么画全由 App 定。
|
|
303
|
+
// video 影视与点播,live 直播与电视台,audio 电台与播客,file 文件与文件夹。
|
|
304
|
+
export type BrowseListKind = "video" | "live" | "audio" | "file";
|
|
305
|
+
|
|
306
|
+
export interface BrowseList {
|
|
307
|
+
id: string;
|
|
308
|
+
title: string;
|
|
309
|
+
kind: BrowseListKind;
|
|
310
|
+
}
|
|
311
|
+
|
|
302
312
|
// 音乐曲库:歌手、专辑、歌单、歌曲四样,不是频道、合集、条目的种类。
|
|
303
313
|
// 歌曲的歌手与它所在专辑的歌手分开给:合辑的专辑歌手可以为空,compilation 为真。歌曲不记续播位置,进播放队列。
|
|
304
314
|
export interface ArtistRef {
|
|
@@ -374,7 +384,7 @@ export type MusicKind = "artist" | "album" | "playlist" | "song" | "station";
|
|
|
374
384
|
export interface MusicSection {
|
|
375
385
|
id: string;
|
|
376
386
|
title: string;
|
|
377
|
-
kind: MusicKind;
|
|
387
|
+
kind: MusicKind;
|
|
378
388
|
}
|
|
379
389
|
|
|
380
390
|
export type MusicEntry =
|
|
@@ -415,54 +425,6 @@ export interface LyricsLine {
|
|
|
415
425
|
translation?: string;
|
|
416
426
|
}
|
|
417
427
|
|
|
418
|
-
// 资料库:文件类来源的 list 列出一个目录下的一层,内核据此扫描进索引库。path 相对来源实例的根,根是 "",
|
|
419
|
-
// 分隔符是 /,开头不带 /。path 只用于识别与手动改正,起播只认 itemId(与 browse 给的同一个 File 的 id 一致)。
|
|
420
|
-
// 媒体服务器实现 changes 与 ids,交回已经识别过的条目(identified),内核直接用它给的 id,不再按文件名搜索。
|
|
421
|
-
export interface LibraryDirectory {
|
|
422
|
-
type: "directory";
|
|
423
|
-
path: string;
|
|
424
|
-
name: string;
|
|
425
|
-
modified?: number;
|
|
426
|
-
tag?: string;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
export interface LibraryFile {
|
|
430
|
-
type: "file";
|
|
431
|
-
path: string;
|
|
432
|
-
name: string;
|
|
433
|
-
itemId: string;
|
|
434
|
-
media: Media;
|
|
435
|
-
size?: number; // 整数
|
|
436
|
-
modified?: number;
|
|
437
|
-
tag?: string;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
// 媒体服务器已经识别过的一部电影(movie)或一集(episode),别的种类内核跳过。item.id 是起播用的 id,
|
|
441
|
-
// 也是增量与对账认这一项的键;电影的 versions 各是一个文件,起播用版本自己的 id。ids 是作品的外部 id(集的看 series.ids),
|
|
442
|
-
// 内核拿它与别的来源里的同一部聚合。series 是集所在的剧的完整资料(海报、年份),给了内核用它显示这部剧,没给时只有 item.series 里的片名与 ids。
|
|
443
|
-
export interface LibraryIdentified {
|
|
444
|
-
type: "identified";
|
|
445
|
-
item: Item;
|
|
446
|
-
series?: Series;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
export type LibraryEntry = LibraryDirectory | LibraryFile | LibraryIdentified;
|
|
450
|
-
|
|
451
|
-
// changes 的一页:entries 是 since 之后新增或改过的条目(都是 identified),removed 是来源知道的删除(条目 id)。
|
|
452
|
-
// next 有值时内核原样带回取下一页;since 是全部取完之后下次增量用的 since,内核只认最后一页(没有 next 的那页)给的。
|
|
453
|
-
export interface LibraryChanges {
|
|
454
|
-
entries: LibraryEntry[];
|
|
455
|
-
removed?: string[];
|
|
456
|
-
next?: string;
|
|
457
|
-
since: string;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
// ids 的一页:来源里现在全部条目的 id(与 identified 的 item.id 一致),内核拿它做只取 id 的全量对账,认出删除。
|
|
461
|
-
export interface LibraryIds {
|
|
462
|
-
ids: string[];
|
|
463
|
-
next?: string;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
428
|
// krillplayer.files:内核替插件读用户填的那台服务器或选的那个文件夹,插件拿不到套接字,也走不出来源实例的根。
|
|
467
429
|
// 清单的 files 声明要哪种协议;path 相对来源实例的根,根是 "",分隔符是 /,开头不带 /,不接受 . 与 ..。
|
|
468
430
|
// modified 是 Unix 秒;目录不带 size。
|
|
@@ -518,6 +480,7 @@ export interface ResolvedBrowse {
|
|
|
518
480
|
// multiChoice 是一个 JSON 数组的文本。secret 的值按凭证存放,不进任何 id,也不进日志。不认识的种类当作 text。
|
|
519
481
|
// dynamicOptions:选项要向插件的 options(krillplayer, name, values) 要;dependsOn 里的参数变了重新要。
|
|
520
482
|
// visibleWhen 全部满足才显示;当前不显示的参数不传给插件。constant 不显示给用户,值固定为 defaultValue。
|
|
483
|
+
// perSource 只在清单的 settings 里有意义:这一项每个来源各存一份,在来源的编辑页里改;不写是插件级,所有来源共用一份。
|
|
521
484
|
export interface Parameter {
|
|
522
485
|
name: string;
|
|
523
486
|
title: string;
|
|
@@ -530,6 +493,7 @@ export interface Parameter {
|
|
|
530
493
|
dynamicOptions?: boolean;
|
|
531
494
|
dependsOn?: string[];
|
|
532
495
|
visibleWhen?: ParameterCondition[];
|
|
496
|
+
perSource?: boolean;
|
|
533
497
|
}
|
|
534
498
|
|
|
535
499
|
// App 不认识的取值当作 "text"。
|
|
@@ -540,7 +504,7 @@ export interface ParameterCondition {
|
|
|
540
504
|
values: string[];
|
|
541
505
|
}
|
|
542
506
|
|
|
543
|
-
// 贡献点:插件只声明往哪里加、对哪些种类的条目生效,内容在 views
|
|
507
|
+
// 贡献点:插件只声明往哪里加、对哪些种类的条目生效,内容在 views 槽位里给(交数据,App 画)。
|
|
544
508
|
// 播放器面板经 views.panel 取,卡片操作经 views.action 执行;kinds 之外的条目上不出现,
|
|
545
509
|
// 过滤掉内核不认识的种类后一个不剩时这一项不显示。
|
|
546
510
|
// backgroundTasks:插件在后台要做的事与建议周期(秒)。只认 task 为 "status"(查订阅频道的
|
|
@@ -574,8 +538,11 @@ export interface PlatformCapabilities {
|
|
|
574
538
|
tvOS?: Capability[];
|
|
575
539
|
}
|
|
576
540
|
|
|
577
|
-
//
|
|
578
|
-
//
|
|
541
|
+
// 插件是来源类型,来源是它的实例:能浏览或有曲库的插件,用户在来源页「+」每添加一次就建一个来源实例,没有实例参数的也一样。
|
|
542
|
+
// parameters 是实例参数,添加时填;url 参数里的主机在声明了 userProvidedURLs 时放行。
|
|
543
|
+
// settings 是设置项,值由插件用 krillplayer.settings.get() 读;默认插件级,带 perSource 的那一项每个来源各一份。
|
|
544
|
+
// loginRequired:导出了 login 的插件声明添加来源时必须登录;不写是可以登录、也可以不登录。没导出 login 的插件没有登录,不能写它。
|
|
545
|
+
// singleSource:这个插件只能有一个来源实例;不写可以有多个(多个账号就是多个来源)。
|
|
579
546
|
export interface PluginManifest {
|
|
580
547
|
id: string;
|
|
581
548
|
sourceId: string;
|
|
@@ -588,6 +555,8 @@ export interface PluginManifest {
|
|
|
588
555
|
hosts: string[];
|
|
589
556
|
userProvidedURLs?: boolean;
|
|
590
557
|
readsCredentials?: boolean;
|
|
558
|
+
loginRequired?: boolean;
|
|
559
|
+
singleSource?: boolean;
|
|
591
560
|
imageCacheIgnoredParameters?: string[];
|
|
592
561
|
files?: FilesProtocol;
|
|
593
562
|
appKeys?: string[];
|
|
@@ -622,7 +591,10 @@ export interface PlayableSubtitle {
|
|
|
622
591
|
headers?: Record<string, string>;
|
|
623
592
|
}
|
|
624
593
|
|
|
625
|
-
// container
|
|
594
|
+
// container 知道就给,视频引擎把它当格式提示交给播放引擎,并用它认出 HLS;不认识的取值当作没给,引擎再看地址后缀。
|
|
595
|
+
// audioURL 是这一路单独的音轨,给了它 url 就只有画面。两个地址都是 http 或 https(不收 krillplayer.files.playable 给的地址),
|
|
596
|
+
// 都指向分片 MP4:第一个顶层盒子是 ftyp,moov 之后、第一个 moof 或 mdat 之前有顶层的 sidx,moov 在前 64 MiB 里;服务器认 Range。
|
|
597
|
+
// 缺一样这一路就播不了(separateAudioUnindexed)。两个地址带同一组 headers。
|
|
626
598
|
export interface PlayableStream {
|
|
627
599
|
quality: string;
|
|
628
600
|
url: string;
|
|
@@ -677,59 +649,51 @@ export type PlayableSegmentKind = "intro" | "outro" | "chapter";
|
|
|
677
649
|
|
|
678
650
|
export type PlayableDecryptionMethod = "cencAesCtr";
|
|
679
651
|
|
|
680
|
-
//
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
// 卡片按 kind 各取所需的字段,缺了必需字段的卡片按坏元素跳过:
|
|
688
|
-
// entry 必须有 entry:点频道与合集进内核的原生页面,点条目起播或进详情;link 必须有 open,点开推入插件的页面;
|
|
689
|
-
// banner 必须有 image,给 entry 或 open 之一;comment 必须有 text,title 是作者、image 是头像、time 是 Unix 秒。
|
|
690
|
-
// 卡片自己没有 image 时用 entry 里对象的图。徽标与续播进度由内核按 entry 画,插件不给;颜色、尺寸与动画都由内核决定。
|
|
691
|
-
export interface Card {
|
|
692
|
-
kind: CardKind;
|
|
693
|
-
title: string;
|
|
694
|
-
subtitle?: string;
|
|
695
|
-
caption?: string;
|
|
696
|
-
image?: string;
|
|
697
|
-
text?: string;
|
|
652
|
+
// 面板里的一条评论(views.panel 交 comments 时):id 在这个条目的评论里唯一,翻页时内核按它去重;
|
|
653
|
+
// author 是作者名,avatar 是作者头像,time 是发表时刻(Unix 秒),likes 是点赞数。怎么画由 App 定。
|
|
654
|
+
export interface Comment {
|
|
655
|
+
id: string;
|
|
656
|
+
author: string;
|
|
657
|
+
text: string;
|
|
658
|
+
avatar?: string; // App 尚未使用
|
|
698
659
|
time?: number;
|
|
699
|
-
|
|
700
|
-
open?: PageLink;
|
|
660
|
+
likes?: number; // 整数
|
|
701
661
|
}
|
|
702
662
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
//
|
|
706
|
-
export interface
|
|
707
|
-
|
|
663
|
+
// 播放器面板的一页(views.panel):一串条目,或一串评论,不交版式,App 用通用样式画。
|
|
664
|
+
// title 是这串条目自己的名字(比如选集所在的合集),没有时 App 用清单里面板的标题。
|
|
665
|
+
// next 有值时内核滚到底再要下一页,把它原样放进下一次请求的 cursor;maxAge 是这一页可以缓存几秒。
|
|
666
|
+
export interface EntriesPanel {
|
|
667
|
+
kind: "entries";
|
|
708
668
|
title?: string;
|
|
709
|
-
|
|
710
|
-
|
|
669
|
+
entries: Entry[];
|
|
670
|
+
next?: string;
|
|
671
|
+
maxAge?: number;
|
|
711
672
|
}
|
|
712
673
|
|
|
713
|
-
export
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
// next 有值时内核滚到底再要下一页,把它原样放进下一次请求的 cursor:下一页的第一个分区与上一页最后一个分区布局与标题相同时接在后面。
|
|
717
|
-
// empty 是没有分区时空状态里的说明。Swift 里叫 PageContent:内核校验后的页面类型叫 ComponentPage。
|
|
718
|
-
export interface ComponentPage {
|
|
719
|
-
title?: string;
|
|
720
|
-
filters?: Parameter[];
|
|
721
|
-
sections: Section[];
|
|
674
|
+
export interface CommentsPanel {
|
|
675
|
+
kind: "comments";
|
|
676
|
+
comments: Comment[];
|
|
722
677
|
next?: string;
|
|
723
678
|
maxAge?: number;
|
|
724
|
-
empty?: string;
|
|
725
679
|
}
|
|
726
680
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
681
|
+
export type PanelPage = EntriesPanel | CommentsPanel;
|
|
682
|
+
|
|
683
|
+
// 卡片操作的结果(views.action):一句给用户看的话,或一串条目(App 画成列表,title 是这串条目的名字)。
|
|
684
|
+
export interface ActionMessage {
|
|
685
|
+
kind: "message";
|
|
686
|
+
message: string;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
export interface ActionEntries {
|
|
690
|
+
kind: "entries";
|
|
691
|
+
title?: string;
|
|
692
|
+
entries: Entry[];
|
|
731
693
|
}
|
|
732
694
|
|
|
695
|
+
export type ActionResult = ActionMessage | ActionEntries;
|
|
696
|
+
|
|
733
697
|
// 状态槽位的一项:一批频道 id 进,每个 id 一项出,顺序不限。
|
|
734
698
|
// offline 时 offlineReason 说明为什么不在播:notLive 未开播、rerun 在放轮播或录像、gone 频道已不存在(订阅标成失效)。
|
|
735
699
|
// unknown 时 unknownReason 说明为什么查不出:failed 来源答非所问或出错、rateLimited 被限流(retryAfter 是来源要求等待的秒数)、
|
|
@@ -1019,15 +983,19 @@ export interface RSSFeed {
|
|
|
1019
983
|
|
|
1020
984
|
// krillplayer.metadata:目录插件经它查影视资料,请求由内核发出,插件看不到背后是哪家服务,也不用在 hosts 里声明。
|
|
1021
985
|
// 名字是自己定的,不跟哪一家的接口名与类型编号走。榜单:trending 是本周的热门,popular 是一直以来的热门,topRated 是评分高的,
|
|
1022
|
-
// upcoming
|
|
986
|
+
// upcoming 与 nowPlaying(正在院线上映)只有电影,onAir 只有剧集。筛选(genre、country、year、network)只有 popular 与 topRated 能用,
|
|
987
|
+
// 可以一起用;network 是剧集首播的平台,只有剧集能用。
|
|
1023
988
|
// 剧集没有 horror、history、music、romance、thriller,电影没有 kids、news、reality、soap、talk;剧集的 action 与 adventure、
|
|
1024
989
|
// scienceFiction 与 fantasy 各是同一组。组合不成立、名字写错,调用直接失败并说明原因。
|
|
1025
990
|
export type WorkKind = "movie" | "series";
|
|
1026
991
|
|
|
1027
|
-
export type ListName = "trending" | "popular" | "topRated" | "upcoming" | "onAir";
|
|
992
|
+
export type ListName = "trending" | "popular" | "topRated" | "upcoming" | "nowPlaying" | "onAir";
|
|
1028
993
|
|
|
1029
994
|
export type Genre = "action" | "adventure" | "animation" | "comedy" | "crime" | "documentary" | "drama" | "family" | "fantasy" | "history" | "horror" | "kids" | "music" | "mystery" | "news" | "reality" | "romance" | "scienceFiction" | "soap" | "talk" | "thriller" | "war" | "western";
|
|
1030
995
|
|
|
996
|
+
// 剧集首播的平台,名字是自己定的一组。
|
|
997
|
+
export type Network = "netflix" | "hbo" | "disneyPlus" | "appleTv" | "primeVideo" | "hulu" | "peacock" | "paramountPlus" | "iqiyi" | "tencentVideo" | "youku" | "bilibili" | "mangoTv";
|
|
998
|
+
|
|
1031
999
|
// search 与 list 返回的 ids 只有 tmdb;get 返回这家知道的全部判定 id,调用方带来的别家 id 原样留着。image 是海报,经代理转发,不用声明域名。
|
|
1032
1000
|
export interface Work {
|
|
1033
1001
|
kind: WorkKind;
|
|
@@ -1045,9 +1013,10 @@ export interface MetadataSearchOptions {
|
|
|
1045
1013
|
cursor?: string;
|
|
1046
1014
|
}
|
|
1047
1015
|
|
|
1048
|
-
// 筛选只有 popular 与 topRated 能用;country 是 ISO 3166-1 两位大写代码,year
|
|
1016
|
+
// 筛选只有 popular 与 topRated 能用;country 是 ISO 3166-1 两位大写代码,year 是上映或首播年,network 只有剧集能用。
|
|
1049
1017
|
export interface MetadataListOptions {
|
|
1050
1018
|
genre?: Genre;
|
|
1019
|
+
network?: Network;
|
|
1051
1020
|
country?: string;
|
|
1052
1021
|
year?: number; // 整数
|
|
1053
1022
|
cursor?: string;
|
|
@@ -1345,11 +1314,27 @@ export interface KrillPlayer {
|
|
|
1345
1314
|
// 槽位的调用约定:导出名就是槽位名,每个函数的第一个参数是 krillplayer。槽位接口不生成,内核按名字调用。
|
|
1346
1315
|
// 翻页一律用游标:函数收 cursor,返回 Paged<T>,next 有值就是还有下一页;第一页不传 cursor。翻页只往后翻。
|
|
1347
1316
|
|
|
1348
|
-
//
|
|
1317
|
+
// 浏览:通用域的来源实现这一组。插件只交数据,不交版式,来源页与首页怎么画由 App 定。
|
|
1318
|
+
// 有几份列表的插件导出 lists,交出几份具名列表(形状同 music 的 sections),写成 BrowseListsSlot:list、parameters、options
|
|
1319
|
+
// 都多收一个列表的 id。只有一份列表的插件不导出 lists,写成 BrowseSlot:list、parameters、options 不收列表的 id。
|
|
1320
|
+
// values 是这份列表参数的取值,按参数名传入,都是字符串。
|
|
1349
1321
|
// channel 与 collection 返回对象本身加它下面的一页;条目必须已经按播放顺序排好,内核不重排。
|
|
1350
1322
|
// schedule 一次查多个频道的节目单,返回按频道 id 分的排期。
|
|
1351
1323
|
// search 是跨来源搜索里本来源的那一份:内核同时问每个导出了 search 的来源要第一页,结果按来源分组标明来源。
|
|
1324
|
+
export interface BrowseListsSlot {
|
|
1325
|
+
lists(krillplayer: KrillPlayer): BrowseList[] | Promise<BrowseList[]>;
|
|
1326
|
+
parameters?(krillplayer: KrillPlayer, list: string): Parameter[] | Promise<Parameter[]>;
|
|
1327
|
+
options?(krillplayer: KrillPlayer, list: string, name: string, values: Record<string, string>): Promise<Option[]>;
|
|
1328
|
+
list(krillplayer: KrillPlayer, list: string, values: Record<string, string>, cursor?: string): Promise<Paged<Entry>>;
|
|
1329
|
+
search?(krillplayer: KrillPlayer, query: string, cursor?: string): Promise<Paged<Entry>>;
|
|
1330
|
+
channel?(krillplayer: KrillPlayer, channelId: string, at?: At): Promise<ChannelPage>;
|
|
1331
|
+
collection?(krillplayer: KrillPlayer, collectionId: string, at?: At): Promise<CollectionPage>;
|
|
1332
|
+
schedule?(krillplayer: KrillPlayer, channelIds: string[], range: { start: number; end: number }): Promise<Record<string, ScheduleEntry[]>>;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
// 只有一份列表的特例:App 把它当作一份具名列表,标题用来源的名字。
|
|
1352
1336
|
export interface BrowseSlot {
|
|
1337
|
+
lists?: never;
|
|
1353
1338
|
parameters?(krillplayer: KrillPlayer): Parameter[] | Promise<Parameter[]>;
|
|
1354
1339
|
options?(krillplayer: KrillPlayer, name: string, values: Record<string, string>): Promise<Option[]>;
|
|
1355
1340
|
list(krillplayer: KrillPlayer, values: Record<string, string>, cursor?: string): Promise<Paged<Entry>>;
|
|
@@ -1375,23 +1360,8 @@ export interface MusicSlot {
|
|
|
1375
1360
|
lyrics?(krillplayer: KrillPlayer, songId: string): Promise<Lyrics | null>;
|
|
1376
1361
|
}
|
|
1377
1362
|
|
|
1378
|
-
// 资料库:能列举全部内容的来源实现它,内核据此扫描进索引库。
|
|
1379
|
-
// list 给 dir 下的一层(不递归,子目录由内核再列),翻页用游标;dir 相对来源实例的根,根是 ""。
|
|
1380
|
-
// 目录不存在时抛 krillplayer.error("notFound"),内核据此删掉它在索引里的内容;连不上抛 retryable、没有权限抛 loginRequired,
|
|
1381
|
-
// 内核什么都不删,把来源标为离线。read 读一个文件的一段(内核读 NFO 用,每个文件最多 64 KiB)。
|
|
1382
|
-
// 媒体服务器不实现 list,实现 changes 与 ids(两个一起):changes 交回 since 之后新增或改过的条目,都是来源已经识别过的
|
|
1383
|
-
// { type: "identified", item },since 为 null 时交回全部;ids 交回现在全部条目的 id,内核每天第一次增量与用户手动时拿它对账、认出删除。
|
|
1384
|
-
// 两者都按游标翻页。连不上抛 retryable、没有权限抛 loginRequired,内核什么都不删,条目照样留在海报墙上、标明不可播。
|
|
1385
|
-
export interface LibrarySlot {
|
|
1386
|
-
list?(krillplayer: KrillPlayer, dir: string, cursor?: string): Promise<Paged<LibraryEntry>>;
|
|
1387
|
-
read?(krillplayer: KrillPlayer, path: string, offset: number, length: number): Promise<Uint8Array>;
|
|
1388
|
-
changes?(krillplayer: KrillPlayer, since: string | null, cursor?: string): Promise<LibraryChanges>;
|
|
1389
|
-
ids?(krillplayer: KrillPlayer, cursor?: string): Promise<LibraryIds>;
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
1363
|
// 资源插件:用户要看某部作品时内核同时问每个资源插件,返回的每一项是一个版本,之后用它的 id 调 play.start;
|
|
1393
1364
|
// 不用造出季和剧集。没有就返回空数组,不抛错。内核给 find 的时限比别的调用短,超时当作没有。
|
|
1394
|
-
// 实现了 library 的来源不实现 find,否则同一份内容会出现两次。
|
|
1395
1365
|
export interface ResourcesSlot {
|
|
1396
1366
|
find(krillplayer: KrillPlayer, work: WorkQuery): Promise<ResourceVersion[]>;
|
|
1397
1367
|
}
|
|
@@ -1460,17 +1430,13 @@ export interface SubtitlesSlot {
|
|
|
1460
1430
|
fetch(krillplayer: KrillPlayer, trackId: string, itemId?: string): Promise<Subtitle>;
|
|
1461
1431
|
}
|
|
1462
1432
|
|
|
1463
|
-
// views
|
|
1464
|
-
//
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
export interface PageRequest { page: string; values: Record<string, string>; cursor?: string; components: number }
|
|
1468
|
-
export interface PanelRequest { panel: string; item: string; values: Record<string, string>; cursor?: string; components: number }
|
|
1469
|
-
export interface ActionRequest { action: string; item?: string; channel?: string }
|
|
1433
|
+
// views 槽位:播放器面板与卡片操作,都只交数据,App 画。cursor 是上一页给的 next,第一页不给;
|
|
1434
|
+
// panel 与 action 的 id 来自清单的贡献点声明,item 是来源内的条目 id。插件拼整页的 page 去掉了,来源页由 App 按具名列表画。
|
|
1435
|
+
export interface PanelRequest { panel: string; item: string; cursor?: string }
|
|
1436
|
+
export interface ActionRequest { action: string; item: string }
|
|
1470
1437
|
|
|
1471
1438
|
export interface ViewsSlot {
|
|
1472
|
-
|
|
1473
|
-
panel?(krillplayer: KrillPlayer, request: PanelRequest): Promise<ComponentPage>;
|
|
1439
|
+
panel?(krillplayer: KrillPlayer, request: PanelRequest): Promise<PanelPage>;
|
|
1474
1440
|
action?(krillplayer: KrillPlayer, request: ActionRequest): Promise<ActionResult>;
|
|
1475
1441
|
}
|
|
1476
1442
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
| 报错里有 | 意思 | 怎么改 |
|
|
10
10
|
|---|---|---|
|
|
11
|
-
| `plugins export only` | plugin.ts 导出了契约里没有的名字 | 只导出槽位对象(browse、play、
|
|
11
|
+
| `plugins export only` | plugin.ts 导出了契约里没有的名字 | 只导出槽位对象(browse、play、status、login、danmaku、subtitles、playbackReport、views、parameters)与顶层函数 resolve;辅助函数不要 export |
|
|
12
12
|
| `is not in the contract` | 槽位对象里有契约没列的函数 | 把辅助函数移到槽位对象外面;函数名照 contract.d.ts 里的槽位接口拼 |
|
|
13
13
|
| `needs one of` | 槽位导出了却一项能力都生成不了 | 补上这一项列出的函数中的一个 |
|
|
14
14
|
| `is inherited; slot functions must be the object's own properties` | 槽位函数放在类的方法或原型上 | 写成对象字面量:export const browse = { async list(krillplayer, values, cursor) {…} } satisfies BrowseSlot |
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"slot": "library",
|
|
3
|
-
"call": "list",
|
|
4
|
-
"args": [
|
|
5
|
-
"Home Videos"
|
|
6
|
-
],
|
|
7
|
-
"exchanges": [],
|
|
8
|
-
"output": {
|
|
9
|
-
"entries": [
|
|
10
|
-
{
|
|
11
|
-
"type": "directory",
|
|
12
|
-
"path": "Home Videos/2025",
|
|
13
|
-
"name": "2025",
|
|
14
|
-
"modified": 1795748400
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"type": "file",
|
|
18
|
-
"path": "Home Videos/beach.MOV",
|
|
19
|
-
"name": "beach.MOV",
|
|
20
|
-
"itemId": "Home Videos/beach.MOV",
|
|
21
|
-
"media": "video",
|
|
22
|
-
"size": 1073741824,
|
|
23
|
-
"modified": 1795748400
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"next": "2"
|
|
27
|
-
}
|
|
28
|
-
}
|
package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-second-page.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"slot": "library",
|
|
3
|
-
"call": "list",
|
|
4
|
-
"args": [
|
|
5
|
-
"Home Videos",
|
|
6
|
-
"2"
|
|
7
|
-
],
|
|
8
|
-
"exchanges": [],
|
|
9
|
-
"output": {
|
|
10
|
-
"entries": [
|
|
11
|
-
{
|
|
12
|
-
"type": "file",
|
|
13
|
-
"path": "Home Videos/interview.m4a",
|
|
14
|
-
"name": "interview.m4a",
|
|
15
|
-
"itemId": "Home Videos/interview.m4a",
|
|
16
|
-
"media": "audio",
|
|
17
|
-
"size": 8388608,
|
|
18
|
-
"modified": 1795748400
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|
package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-skips-subtitles.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"slot": "library",
|
|
3
|
-
"call": "list",
|
|
4
|
-
"args": [
|
|
5
|
-
"电影"
|
|
6
|
-
],
|
|
7
|
-
"exchanges": [],
|
|
8
|
-
"output": {
|
|
9
|
-
"entries": [
|
|
10
|
-
{
|
|
11
|
-
"type": "file",
|
|
12
|
-
"path": "电影/Big Buck Bunny (2008).mkv",
|
|
13
|
-
"name": "Big Buck Bunny (2008).mkv",
|
|
14
|
-
"itemId": "电影/Big Buck Bunny (2008).mkv",
|
|
15
|
-
"media": "video",
|
|
16
|
-
"size": 734003200,
|
|
17
|
-
"modified": 1795748400
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
}
|
package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-root-first-page.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"slot": "library",
|
|
3
|
-
"call": "list",
|
|
4
|
-
"args": [
|
|
5
|
-
""
|
|
6
|
-
],
|
|
7
|
-
"exchanges": [],
|
|
8
|
-
"output": {
|
|
9
|
-
"entries": [
|
|
10
|
-
{
|
|
11
|
-
"type": "directory",
|
|
12
|
-
"path": "Home Videos",
|
|
13
|
-
"name": "Home Videos",
|
|
14
|
-
"modified": 1795748400
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"type": "directory",
|
|
18
|
-
"path": "电影",
|
|
19
|
-
"name": "电影",
|
|
20
|
-
"modified": 1795748400
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
"next": "2"
|
|
24
|
-
}
|
|
25
|
-
}
|
package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-root-second-page.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"slot": "library",
|
|
3
|
-
"call": "list",
|
|
4
|
-
"args": [
|
|
5
|
-
"",
|
|
6
|
-
"2"
|
|
7
|
-
],
|
|
8
|
-
"exchanges": [],
|
|
9
|
-
"output": {
|
|
10
|
-
"entries": [
|
|
11
|
-
{
|
|
12
|
-
"type": "file",
|
|
13
|
-
"path": "trailer.mp4",
|
|
14
|
-
"name": "trailer.mp4",
|
|
15
|
-
"itemId": "trailer.mp4",
|
|
16
|
-
"media": "video",
|
|
17
|
-
"size": 52428800,
|
|
18
|
-
"modified": 1795748400
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"slot": "library",
|
|
3
|
-
"call": "changes",
|
|
4
|
-
"args": [
|
|
5
|
-
null
|
|
6
|
-
],
|
|
7
|
-
"exchanges": [],
|
|
8
|
-
"output": {
|
|
9
|
-
"entries": [
|
|
10
|
-
{
|
|
11
|
-
"type": "identified",
|
|
12
|
-
"item": {
|
|
13
|
-
"kind": "movie",
|
|
14
|
-
"id": "m1",
|
|
15
|
-
"title": "磷虾:起源",
|
|
16
|
-
"year": 2024,
|
|
17
|
-
"duration": 6120,
|
|
18
|
-
"ids": {
|
|
19
|
-
"tmdb": "200001",
|
|
20
|
-
"imdb": "tt0000001"
|
|
21
|
-
},
|
|
22
|
-
"image": "https://media.example/posters/m1.jpg",
|
|
23
|
-
"versions": [
|
|
24
|
-
{
|
|
25
|
-
"id": "m1-4k",
|
|
26
|
-
"title": "4K HDR",
|
|
27
|
-
"filename": "Krill.Origins.2024.2160p.mkv",
|
|
28
|
-
"version": {
|
|
29
|
-
"width": 3840,
|
|
30
|
-
"height": 2160,
|
|
31
|
-
"hdr": "dolbyVision",
|
|
32
|
-
"videoCodec": "hevc",
|
|
33
|
-
"audioCodec": "eac3",
|
|
34
|
-
"audioChannels": 6,
|
|
35
|
-
"size": 42000000000
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"id": "m1-1080",
|
|
40
|
-
"title": "1080p",
|
|
41
|
-
"filename": "Krill.Origins.2024.1080p.mkv",
|
|
42
|
-
"version": {
|
|
43
|
-
"width": 1920,
|
|
44
|
-
"height": 1080,
|
|
45
|
-
"hdr": "sdr",
|
|
46
|
-
"videoCodec": "h264",
|
|
47
|
-
"audioCodec": "aac",
|
|
48
|
-
"audioChannels": 2,
|
|
49
|
-
"size": 8000000000
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"type": "identified",
|
|
57
|
-
"item": {
|
|
58
|
-
"kind": "movie",
|
|
59
|
-
"id": "m2",
|
|
60
|
-
"title": "磷虾:归途",
|
|
61
|
-
"year": 2026,
|
|
62
|
-
"duration": 6840,
|
|
63
|
-
"version": {
|
|
64
|
-
"width": 1920,
|
|
65
|
-
"height": 1080,
|
|
66
|
-
"videoCodec": "hevc"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
],
|
|
71
|
-
"next": "2",
|
|
72
|
-
"since": "5"
|
|
73
|
-
}
|
|
74
|
-
}
|