krillplayer-plugin 0.0.0-stage → 0.1.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/LICENSE +24 -0
- package/README.md +85 -2
- package/bin/krillplayer-plugin.js +13 -0
- package/dist/cli.js +5607 -0
- package/dist/engine/engine.c +140 -0
- package/kernel/Sources/CQuickJS/include/kernel_qjs.h +47 -0
- package/kernel/Sources/CQuickJS/kernel_qjs.c +407 -0
- package/kernel/Sources/CQuickJS/quickjs_vendor.c +8 -0
- package/kernel/Sources/CQuickJS/vendor/LICENSE +24 -0
- package/kernel/Sources/CQuickJS/vendor/builtin-array-fromasync.h +121 -0
- package/kernel/Sources/CQuickJS/vendor/builtin-iterator-zip-keyed.h +313 -0
- package/kernel/Sources/CQuickJS/vendor/builtin-iterator-zip.h +321 -0
- package/kernel/Sources/CQuickJS/vendor/cutils.h +2374 -0
- package/kernel/Sources/CQuickJS/vendor/dtoa.c +1619 -0
- package/kernel/Sources/CQuickJS/vendor/dtoa.h +87 -0
- package/kernel/Sources/CQuickJS/vendor/libregexp-opcode.h +73 -0
- package/kernel/Sources/CQuickJS/vendor/libregexp.c +3530 -0
- package/kernel/Sources/CQuickJS/vendor/libregexp.h +106 -0
- package/kernel/Sources/CQuickJS/vendor/libunicode-table.h +5160 -0
- package/kernel/Sources/CQuickJS/vendor/libunicode.c +2074 -0
- package/kernel/Sources/CQuickJS/vendor/libunicode.h +172 -0
- package/kernel/Sources/CQuickJS/vendor/list.h +107 -0
- package/kernel/Sources/CQuickJS/vendor/quickjs-atom.h +279 -0
- package/kernel/Sources/CQuickJS/vendor/quickjs-c-atomics.h +54 -0
- package/kernel/Sources/CQuickJS/vendor/quickjs-opcode.h +377 -0
- package/kernel/Sources/CQuickJS/vendor/quickjs.c +65536 -0
- package/kernel/Sources/CQuickJS/vendor/quickjs.h +1529 -0
- package/kernel/Sources/Kernel/PluginPrelude.js +312 -0
- package/package.json +35 -4
- package/skill/krillplayer-plugin/SKILL.md +100 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/list-next-page-passes-the-cursor-back.json +28 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/list-popular-movies.json +48 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/list-service-unavailable-fails.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/list-top-rated-series.json +68 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/list-trending-movies-by-default.json +71 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/list-unknown-values-fall-back.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/parameters.json +42 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/search-blank.json +11 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/search-movies-first.json +50 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/search-series-after-the-movies.json +50 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/cases/search-series-next-page.json +25 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/manifest.ts +12 -0
- package/skill/krillplayer-plugin/assets/samples/catalog/plugin.ts +57 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/comments-first-segment.json +77 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/comments-last-segment-stops-at-the-end.json +77 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/comments-past-the-end-empty.json +14 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/comments-segment-covering-the-position.json +77 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/comments-unknown-match-not-found.json +13 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/match-by-filename-with-spaces.json +34 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/match-by-filename-without-a-work.json +28 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/match-episode-by-absolute-number.json +25 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/match-episode-by-season-and-number.json +32 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/match-episode-not-in-the-catalog-empty.json +20 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/match-movie-by-tmdb-gives-both-cuts.json +34 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/match-nothing-to-go-on-empty.json +13 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/cases/match-unknown-work-empty.json +18 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/manifest.ts +12 -0
- package/skill/krillplayer-plugin/assets/samples/danmaku-tool/plugin.ts +72 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/folder-gone-ended.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/folder-second-page-by-cursor.json +39 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/folder-skips-files-that-are-not-media.json +36 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/folder-with-subfolder-first-page.json +52 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-empty-folder.json +11 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-gone-not-found.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-lists-subfolders-and-media.json +28 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-second-page.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-folder-skips-subtitles.json +21 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-root-first-page.json +25 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/library-root-second-page.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/list-cursor-not-a-number-starts-over.json +30 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/list-root-first-page.json +29 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/list-root-second-page.json +25 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/nested-folder-carries-ancestors.json +25 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/play-file-at-the-root.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/play-file-encodes-each-path-segment.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/cases/play-file-gone-not-found.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/manifest.ts +12 -0
- package/skill/krillplayer-plugin/assets/samples/file-share/plugin.ts +192 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/list-first-page.json +247 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/list-missing-docs.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/list-not-json.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/list-refused.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/list-second-page.json +248 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/list-server-error.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/list-skips-incomplete-items.json +225 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/play-about-bananas.json +45 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/play-http-404.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/play-no-video-files.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/play-unknown-id.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/search-bad-request.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/search-bananas.json +247 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/search-blank-query.json +11 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/cases/search-rate-limited.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/manifest.ts +14 -0
- package/skill/krillplayer-plugin/assets/samples/internet-archive/plugin.ts +85 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/channel-creator-next-page.json +99 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/channel-creator-off-air-has-no-live.json +28 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/channel-creator-on-air.json +92 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/channel-creator-replays-tab.json +69 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/channel-unknown-ended.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/collection-playlist-around-a-video.json +56 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/collection-playlist.json +78 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-connect.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-decode.json +19 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-content-rejected.json +31 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-login-expired.json +31 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-muted.json +31 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-not-logged-in.json +14 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-other.json +31 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-rate-limited.json +31 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-sent.json +28 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/list-live.json +33 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/list-videos-first-page.json +59 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/list-videos-next-page.json +64 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/parameters.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-off-air-not-started.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-replay.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-upcoming-not-started.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-video.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/resolve-channel-link.json +28 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/resolve-live-link.json +29 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/resolve-other-site-unclaimed.json +8 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/resolve-playlist-link.json +27 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/resolve-removed-video-unclaimed.json +8 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/resolve-video-link.json +34 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/search-creator-live-playlist-and-videos.json +115 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/search-off-air-room.json +47 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/status-live-id-comes-from-the-plugin.json +28 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/manifest.ts +13 -0
- package/skill/krillplayer-plugin/assets/samples/live-video-platform/plugin.ts +162 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/collection-box-set.json +80 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/collection-empty-subfolder.json +25 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/collection-folder-has-a-subfolder-and-files.json +53 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/collection-season-around-a-removed-episode-ended.json +15 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/collection-season-around-an-episode.json +67 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/collection-season-episodes.json +89 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/collection-series-lists-seasons.json +79 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/collection-series-next-page.json +54 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/collection-unknown-ended.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-changes-everything-first-page.json +74 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-changes-everything-last-page.json +86 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-changes-nothing-new.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-changes-since-a-token-with-a-removal.json +88 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-ids-first-page.json +15 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/library-ids-last-page.json +14 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/list-files.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/list-movies-first-page.json +69 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/list-movies-next-page.json +30 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/list-shows.json +27 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/parameters.json +27 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/play-episode.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/play-file-without-duration.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/play-movie-version.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/play-movie.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/play-unknown-ended.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/search-across-kinds.json +81 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/cases/search-blank.json +11 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/manifest.ts +12 -0
- package/skill/krillplayer-plugin/assets/samples/media-server/plugin.ts +167 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/album-compilation-has-no-album-artist.json +63 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/album-songs-in-disc-order.json +117 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/artist-lists-albums-and-top-songs.json +103 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/artist-unknown-not-found.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/list-artists.json +32 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/list-newest-albums-first-page.json +51 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/list-past-the-end.json +13 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/list-playlists.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/list-stations-are-channels.json +28 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/list-unknown-section-not-found.json +13 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/play-song.json +24 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/play-station.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/play-unknown-not-found.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/playlist-first-page.json +67 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/playlist-next-page.json +48 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/cases/sections-lists-every-kind.json +28 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/manifest.ts +12 -0
- package/skill/krillplayer-plugin/assets/samples/music-library/plugin.ts +120 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/folder-gone-not-found.json +60 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/folder-nested-carries-ancestors.json +74 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/folder-second-page-by-cursor.json +88 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/folder-skips-subtitles-and-system-files.json +101 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/folder-without-access-asks-to-log-in.json +60 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-empty-folder.json +60 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-folder-gives-size-and-modified-time.json +78 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-folder-gone-not-found.json +60 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-folder-second-page.json +71 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-read-a-range.json +62 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-read-an-info-file.json +62 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-read-file-gone-not-found.json +62 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-root.json +84 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/library-source-offline-retryable.json +61 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/list-root-first-page.json +71 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/list-root-next-page-by-the-kernel-cursor.json +83 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/list-root-page-of-only-other-files-still-has-next.json +63 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/list-root.json +96 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/list-source-offline-retryable.json +61 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/list-wrong-account-asks-to-log-in.json +61 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/play-a-folder-not-found.json +61 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/play-audio-takes-no-subtitles.json +71 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/play-file-at-the-root.json +71 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/play-file-gone-not-found.json +60 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/play-finds-subtitles-across-pages.json +88 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/play-lists-subtitles-next-to-the-video.json +87 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/play-similar-name-takes-only-its-own-subtitles.json +80 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/cases/play-without-access-asks-to-log-in.json +60 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/manifest.ts +13 -0
- package/skill/krillplayer-plugin/assets/samples/network-share/plugin.ts +122 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/channel-around-a-removed-episode-ended.json +15 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/channel-around-an-episode.json +62 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/channel-episodic-newest-first.json +57 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/channel-episodic-next-page.json +42 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/channel-serial-oldest-first.json +57 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/channel-unknown-ended.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/list-first-page.json +32 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/list-past-the-end.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/play-episode.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/play-removed-ended.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/search-next-page.json +47 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/cases/search-shows-and-episodes.json +41 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/manifest.ts +12 -0
- package/skill/krillplayer-plugin/assets/samples/podcast/plugin.ts +77 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/find-episode-by-absolute-number.json +24 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/find-episode-by-season-and-number.json +26 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/find-episode-it-does-not-have.json +17 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/find-movie-by-imdb-only.json +39 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/find-movie-by-tmdb.json +40 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/find-movie-ids-win-over-the-title.json +16 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/find-movie-title-in-another-year-has-none.json +14 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/find-movie-without-ids-by-title-and-year.json +25 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/play-episode-version.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/play-movie-version.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/cases/play-unknown-ended.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/manifest.ts +12 -0
- package/skill/krillplayer-plugin/assets/samples/resource-finder/plugin.ts +70 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/fetch-after-login-gives-the-text.json +16 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/fetch-gives-the-text.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/fetch-login-required-without-credentials.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/fetch-unknown-track-not-found.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/login-methods-fields.json +24 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-by-filename-without-a-work.json +34 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-by-hash-gives-only-that-file.json +29 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-episode-by-season-and-number.json +32 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-episode-not-in-the-catalog-empty.json +22 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-hash-wins-over-a-misleading-filename.json +27 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-language-by-primary-subtag.json +24 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-movie-by-tmdb-in-language-order.json +51 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-nothing-to-go-on-empty.json +13 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-unknown-hash-falls-back-to-the-work.json +53 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-unknown-work-empty.json +20 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/cases/search-unwanted-language-empty.json +21 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/manifest.ts +12 -0
- package/skill/krillplayer-plugin/assets/samples/subtitle-tool/plugin.ts +104 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/channel-radio-is-audio.json +33 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/channel-station.json +33 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/channel-unknown-ended.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/list-all-stations.json +81 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/list-group.json +37 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/parameters.json +31 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/play-catch-up-is-on-demand.json +23 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/play-future-programme-has-no-catch-up.json +12 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/play-live-two-lines.json +31 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/play-radio.json +31 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/schedule-future-window-has-no-items.json +24 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/schedule-past-programmes-carry-catch-up.json +58 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/schedule-several-stations-in-one-call.json +127 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/schedule-window-without-programmes.json +15 -0
- package/skill/krillplayer-plugin/assets/samples/tv/cases/search-station.json +35 -0
- package/skill/krillplayer-plugin/assets/samples/tv/manifest.ts +12 -0
- package/skill/krillplayer-plugin/assets/samples/tv/plugin.ts +81 -0
- package/skill/krillplayer-plugin/references/cases.md +86 -0
- package/skill/krillplayer-plugin/references/choosing-a-kind.md +69 -0
- package/skill/krillplayer-plugin/references/contract.d.ts +1486 -0
- package/skill/krillplayer-plugin/references/errors-and-fixes.md +117 -0
- package/templates/apple-hls/cases/list-filtered.json +24 -0
- package/templates/apple-hls/cases/list-first-page.json +35 -0
- package/templates/apple-hls/cases/list-last-page.json +25 -0
- package/templates/apple-hls/cases/parameters.json +31 -0
- package/templates/apple-hls/cases/play-bipbop.json +23 -0
- package/templates/apple-hls/cases/play-unknown.json +12 -0
- package/templates/apple-hls/cases/search-blank-query.json +11 -0
- package/templates/apple-hls/cases/search-no-match.json +11 -0
- package/templates/apple-hls/cases/search-title-ignores-case.json +22 -0
- package/templates/apple-hls/manifest.ts +12 -0
- package/templates/apple-hls/plugin.ts +77 -0
|
@@ -0,0 +1,1486 @@
|
|
|
1
|
+
// KrillPlayer 插件契约:接口级别 0、修订 2。
|
|
2
|
+
// 由 App 的契约生成器产出,随 npm 包 krillplayer-plugin 发布,不要手改。
|
|
3
|
+
// 插件里只 import 类型:import type { BrowseSlot, PlaySlot, PluginManifest } from "krillplayer-plugin";
|
|
4
|
+
//
|
|
5
|
+
// 一次调用最长 20 秒(含等网络),内存 64 MiB;纯计算的递归约 250 层爆栈,
|
|
6
|
+
// 契约保证 64 层调用不爆栈。krillplayer.storage 键 256 字节、值 64 KiB、
|
|
7
|
+
// 一个插件合计 1 MiB;XML 嵌套 64 层;解压后 64 MB;
|
|
8
|
+
// 交给宿主的值连同消息的信封最多嵌套 160 层(参数多 3 层,返回值多 2 层)。
|
|
9
|
+
// 时刻是 Unix 秒(1970 年以前是负数),时长与位置是秒,都可以带小数;标着「整数」的字段给小数时试跑器判错。
|
|
10
|
+
// 标着「App 尚未使用」的函数与字段契约里已经有了,这一版的 App 还没接上:导出了不会被调,给了不会被读,打包时对导出的这类函数给一条警告。
|
|
11
|
+
|
|
12
|
+
// manifest.ts 里的 interfaceLevel 与 contractRevision 写成这两个字面量,打包时比对。
|
|
13
|
+
export type InterfaceLevel = 0;
|
|
14
|
+
export type ContractRevision = 2;
|
|
15
|
+
|
|
16
|
+
// 翻页一律用游标:函数收 cursor,返回 Paged<T>,next 有值就是还有下一页,内容由插件自己定,内核原样带回。
|
|
17
|
+
export interface Paged<T> {
|
|
18
|
+
entries: T[];
|
|
19
|
+
next?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 外部 id:键是内核保留的名字(tmdb、imdb、tvdb、anidb、bangumi、musicbrainz),不认识的键忽略。
|
|
23
|
+
export type Ids = Record<string, string>;
|
|
24
|
+
|
|
25
|
+
// 能力由打包器按导出的函数生成(SLOT_RULES),插件不手写。
|
|
26
|
+
export type Capability = "browse" | "music" | "play" | "resolve" | "library" | "resources" | "subtitles" | "subtitleSearch" | "danmaku" | "danmakuMatch" | "status" | "login" | "playbackReport" | "views" | "libraryChanges" | "danmakuSend";
|
|
27
|
+
|
|
28
|
+
// 内容对象。通用域三样结构:频道、合集、条目,每个种类一个类型,只带属于它的字段。
|
|
29
|
+
// 种类的取值是内核定死的词表,插件不能自造。比插件旧的 App 遇到不认识的种类时跳过数组里的那一项、把可选字段当作没给;
|
|
30
|
+
// 试跑器直接判错。
|
|
31
|
+
// 时刻是 Unix 秒,时长与位置是秒,序号都是整数。内核不解析 id,层级只看字段。
|
|
32
|
+
export type Media = "video" | "audio";
|
|
33
|
+
|
|
34
|
+
export type ChannelKind = "creator" | "station" | "podcast";
|
|
35
|
+
|
|
36
|
+
export type CollectionKind = "series" | "season" | "boxSet" | "playlist" | "folder";
|
|
37
|
+
|
|
38
|
+
export type ItemKind = "movie" | "episode" | "podcastEpisode" | "onDemand" | "live" | "upcoming" | "file";
|
|
39
|
+
|
|
40
|
+
export interface Option {
|
|
41
|
+
value: string;
|
|
42
|
+
title: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 版本的技术属性。
|
|
46
|
+
export interface VersionInfo {
|
|
47
|
+
width?: number; // 整数
|
|
48
|
+
height?: number; // 整数
|
|
49
|
+
hdr?: VersionHDR;
|
|
50
|
+
videoCodec?: string;
|
|
51
|
+
audioCodec?: string; // App 尚未使用
|
|
52
|
+
audioChannels?: number; // 整数;App 尚未使用
|
|
53
|
+
sampleRate?: number; // 整数;App 尚未使用
|
|
54
|
+
bitDepth?: number; // 整数;App 尚未使用
|
|
55
|
+
size?: number; // 整数
|
|
56
|
+
bitrate?: number; // 整数
|
|
57
|
+
languages?: string[]; // App 尚未使用
|
|
58
|
+
label?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type VersionHDR = "sdr" | "hdr10" | "hdr10plus" | "dolbyVision" | "hlg";
|
|
62
|
+
|
|
63
|
+
// 来源把几个文件并在一个条目下时,每个文件是一个版本,起播用版本自己的 id。
|
|
64
|
+
export interface ResourceVersion {
|
|
65
|
+
id: string;
|
|
66
|
+
title?: string;
|
|
67
|
+
filename?: string;
|
|
68
|
+
version?: VersionInfo;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 引用不嵌套:上级的链条放在完整对象的 ancestors 里。
|
|
72
|
+
export interface ChannelRef {
|
|
73
|
+
id: string;
|
|
74
|
+
kind: ChannelKind; // App 尚未使用
|
|
75
|
+
title: string;
|
|
76
|
+
image?: string; // App 尚未使用
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface CollectionRef {
|
|
80
|
+
id: string;
|
|
81
|
+
kind: CollectionKind; // App 尚未使用
|
|
82
|
+
title: string;
|
|
83
|
+
index?: number; // 整数
|
|
84
|
+
ids?: Ids;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface Movie {
|
|
88
|
+
kind: "movie";
|
|
89
|
+
id: string;
|
|
90
|
+
title: string;
|
|
91
|
+
image?: string;
|
|
92
|
+
summary?: string;
|
|
93
|
+
year?: number; // 整数
|
|
94
|
+
duration?: number;
|
|
95
|
+
ids?: Ids;
|
|
96
|
+
version?: VersionInfo;
|
|
97
|
+
versions?: ResourceVersion[];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// season 是所在的季,index 是季号(特别篇是 0),不分季的剧给一个 index 为 1 的季;series 是所在的剧集,带 ids。
|
|
101
|
+
// 一个文件装了第 1 到第 2 集时 indexEnd 是 2;absolute 是绝对集号。
|
|
102
|
+
export interface Episode {
|
|
103
|
+
kind: "episode";
|
|
104
|
+
id: string;
|
|
105
|
+
title: string;
|
|
106
|
+
image?: string;
|
|
107
|
+
summary?: string;
|
|
108
|
+
season: CollectionRef;
|
|
109
|
+
series: CollectionRef;
|
|
110
|
+
index: number; // 整数
|
|
111
|
+
indexEnd?: number; // 整数
|
|
112
|
+
absolute?: number; // 整数
|
|
113
|
+
duration?: number;
|
|
114
|
+
published?: number;
|
|
115
|
+
version?: VersionInfo;
|
|
116
|
+
versions?: ResourceVersion[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface PodcastEpisode {
|
|
120
|
+
kind: "podcastEpisode";
|
|
121
|
+
id: string;
|
|
122
|
+
title: string;
|
|
123
|
+
image?: string;
|
|
124
|
+
summary?: string; // App 尚未使用
|
|
125
|
+
media: Media;
|
|
126
|
+
podcast: ChannelRef;
|
|
127
|
+
season?: number; // 整数;App 尚未使用
|
|
128
|
+
index?: number; // 整数;App 尚未使用
|
|
129
|
+
episodeType?: PodcastEpisodeType; // App 尚未使用
|
|
130
|
+
duration?: number;
|
|
131
|
+
published?: number; // App 尚未使用
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export type PodcastEpisodeType = "full" | "trailer" | "bonus";
|
|
135
|
+
|
|
136
|
+
// playlist 与 index 是所属的播放列表与其中的序号:说的是固定的归属,不是「现在从哪儿播的」。
|
|
137
|
+
export interface OnDemand {
|
|
138
|
+
kind: "onDemand";
|
|
139
|
+
id: string;
|
|
140
|
+
title: string;
|
|
141
|
+
image?: string;
|
|
142
|
+
summary?: string; // App 尚未使用
|
|
143
|
+
media: Media;
|
|
144
|
+
channels?: ChannelRef[];
|
|
145
|
+
portrait?: boolean;
|
|
146
|
+
duration?: number;
|
|
147
|
+
published?: number;
|
|
148
|
+
playlist?: CollectionRef;
|
|
149
|
+
index?: number; // 整数;App 尚未使用
|
|
150
|
+
version?: VersionInfo; // App 尚未使用
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// rerun:在放轮播或录像,不是真人直播。offAir:来源确知此刻没在播。直播条目的 id 由插件给。
|
|
154
|
+
export interface Live {
|
|
155
|
+
kind: "live";
|
|
156
|
+
id: string;
|
|
157
|
+
title: string;
|
|
158
|
+
image?: string;
|
|
159
|
+
summary?: string; // App 尚未使用
|
|
160
|
+
media: Media;
|
|
161
|
+
channels?: ChannelRef[];
|
|
162
|
+
portrait?: boolean;
|
|
163
|
+
started?: number;
|
|
164
|
+
rerun?: boolean;
|
|
165
|
+
offAir?: boolean;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface Upcoming {
|
|
169
|
+
kind: "upcoming";
|
|
170
|
+
id: string;
|
|
171
|
+
title: string;
|
|
172
|
+
image?: string;
|
|
173
|
+
summary?: string; // App 尚未使用
|
|
174
|
+
media: Media;
|
|
175
|
+
channels?: ChannelRef[];
|
|
176
|
+
portrait?: boolean;
|
|
177
|
+
start: number; // App 尚未使用
|
|
178
|
+
end?: number; // App 尚未使用
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// filename 是原始文件名,给识别与字幕匹配用。
|
|
182
|
+
export interface File {
|
|
183
|
+
kind: "file";
|
|
184
|
+
id: string;
|
|
185
|
+
title: string;
|
|
186
|
+
image?: string;
|
|
187
|
+
summary?: string; // App 尚未使用
|
|
188
|
+
media: Media;
|
|
189
|
+
filename?: string;
|
|
190
|
+
folder?: CollectionRef; // App 尚未使用
|
|
191
|
+
duration?: number;
|
|
192
|
+
size?: number; // 整数
|
|
193
|
+
modified?: number; // App 尚未使用
|
|
194
|
+
version?: VersionInfo; // App 尚未使用
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export type Item = Movie | Episode | PodcastEpisode | OnDemand | Live | Upcoming | File;
|
|
198
|
+
|
|
199
|
+
// live 是此刻在播的那一路,没在播就不给;tabs 是频道页的分栏。
|
|
200
|
+
export interface Creator {
|
|
201
|
+
kind: "creator";
|
|
202
|
+
id: string;
|
|
203
|
+
title: string;
|
|
204
|
+
image?: string;
|
|
205
|
+
summary?: string; // App 尚未使用
|
|
206
|
+
live?: Live;
|
|
207
|
+
tabs?: Option[];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// live 必填:一个台总有它那一路,停播时标 offAir。live.id 要和台的 id 一样稳定,内核把它和台一起存下来。
|
|
211
|
+
export interface Station {
|
|
212
|
+
kind: "station";
|
|
213
|
+
id: string;
|
|
214
|
+
title: string;
|
|
215
|
+
image?: string;
|
|
216
|
+
summary?: string; // App 尚未使用
|
|
217
|
+
media: Media;
|
|
218
|
+
live: Live;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// order:新的在前(episodic),还是从第一集听起(serial);不给当 episodic。
|
|
222
|
+
export type PodcastOrder = "episodic" | "serial";
|
|
223
|
+
|
|
224
|
+
export interface Podcast {
|
|
225
|
+
kind: "podcast";
|
|
226
|
+
id: string;
|
|
227
|
+
title: string;
|
|
228
|
+
image?: string;
|
|
229
|
+
summary?: string; // App 尚未使用
|
|
230
|
+
order?: PodcastOrder; // App 尚未使用
|
|
231
|
+
tabs?: Option[];
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export type Channel = Creator | Station | Podcast;
|
|
235
|
+
|
|
236
|
+
export interface Series {
|
|
237
|
+
kind: "series";
|
|
238
|
+
id: string;
|
|
239
|
+
title: string;
|
|
240
|
+
image?: string;
|
|
241
|
+
summary?: string;
|
|
242
|
+
count?: number; // 整数
|
|
243
|
+
ancestors?: CollectionRef[]; // App 尚未使用
|
|
244
|
+
year?: number; // 整数
|
|
245
|
+
ids?: Ids;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface Season {
|
|
249
|
+
kind: "season";
|
|
250
|
+
id: string;
|
|
251
|
+
title: string;
|
|
252
|
+
image?: string;
|
|
253
|
+
summary?: string;
|
|
254
|
+
count?: number; // 整数
|
|
255
|
+
ancestors?: CollectionRef[]; // App 尚未使用
|
|
256
|
+
index: number; // 整数
|
|
257
|
+
series: CollectionRef;
|
|
258
|
+
ids?: Ids;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface BoxSet {
|
|
262
|
+
kind: "boxSet";
|
|
263
|
+
id: string;
|
|
264
|
+
title: string;
|
|
265
|
+
image?: string;
|
|
266
|
+
summary?: string;
|
|
267
|
+
count?: number; // 整数
|
|
268
|
+
ancestors?: CollectionRef[]; // App 尚未使用
|
|
269
|
+
ids?: Ids;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export interface Playlist {
|
|
273
|
+
kind: "playlist";
|
|
274
|
+
id: string;
|
|
275
|
+
title: string;
|
|
276
|
+
image?: string;
|
|
277
|
+
summary?: string;
|
|
278
|
+
count?: number; // 整数
|
|
279
|
+
ancestors?: CollectionRef[]; // App 尚未使用
|
|
280
|
+
channels?: ChannelRef[]; // App 尚未使用
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface Folder {
|
|
284
|
+
kind: "folder";
|
|
285
|
+
id: string;
|
|
286
|
+
title: string;
|
|
287
|
+
image?: string;
|
|
288
|
+
summary?: string;
|
|
289
|
+
count?: number; // 整数
|
|
290
|
+
ancestors?: CollectionRef[]; // App 尚未使用
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export type Collection = Series | Season | BoxSet | Playlist | Folder;
|
|
294
|
+
|
|
295
|
+
// 列表、搜索、卡片里只有这三种东西。
|
|
296
|
+
export type Entry =
|
|
297
|
+
| { type: "item"; item: Item }
|
|
298
|
+
| { type: "channel"; channel: Channel }
|
|
299
|
+
| { type: "collection"; collection: Collection }
|
|
300
|
+
;
|
|
301
|
+
|
|
302
|
+
// 音乐曲库:歌手、专辑、歌单、歌曲四样,不是频道、合集、条目的种类。
|
|
303
|
+
// 歌曲的歌手与它所在专辑的歌手分开给:合辑的专辑歌手可以为空,compilation 为真。歌曲不记续播位置,进播放队列。
|
|
304
|
+
export interface ArtistRef {
|
|
305
|
+
id: string;
|
|
306
|
+
name: string;
|
|
307
|
+
image?: string; // App 尚未使用
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export interface AlbumRef {
|
|
311
|
+
id: string;
|
|
312
|
+
title: string;
|
|
313
|
+
image?: string; // App 尚未使用
|
|
314
|
+
year?: number; // 整数;App 尚未使用
|
|
315
|
+
artists?: ArtistRef[]; // App 尚未使用
|
|
316
|
+
compilation?: boolean; // App 尚未使用
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export interface Artist {
|
|
320
|
+
id: string;
|
|
321
|
+
name: string;
|
|
322
|
+
image?: string;
|
|
323
|
+
summary?: string; // App 尚未使用
|
|
324
|
+
ids?: Ids;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface Album {
|
|
328
|
+
id: string;
|
|
329
|
+
title: string;
|
|
330
|
+
image?: string;
|
|
331
|
+
year?: number; // 整数
|
|
332
|
+
artists?: ArtistRef[];
|
|
333
|
+
compilation?: boolean; // App 尚未使用
|
|
334
|
+
summary?: string; // App 尚未使用
|
|
335
|
+
ids?: Ids;
|
|
336
|
+
count?: number; // 整数;App 尚未使用
|
|
337
|
+
type?: AlbumType; // App 尚未使用
|
|
338
|
+
discs?: AlbumDisc[]; // App 尚未使用
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export type AlbumType = "album" | "single" | "ep" | "live";
|
|
342
|
+
|
|
343
|
+
export interface AlbumDisc {
|
|
344
|
+
index: number; // 整数;App 尚未使用
|
|
345
|
+
title?: string; // App 尚未使用
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export interface MusicPlaylist {
|
|
349
|
+
id: string;
|
|
350
|
+
title: string;
|
|
351
|
+
image?: string;
|
|
352
|
+
summary?: string; // App 尚未使用
|
|
353
|
+
count?: number; // 整数;App 尚未使用
|
|
354
|
+
owner?: string; // App 尚未使用
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// artists 是这首歌的歌手,可以与专辑歌手不同;disc 与 index 是碟号与曲目号。
|
|
358
|
+
export interface Song {
|
|
359
|
+
id: string;
|
|
360
|
+
title: string;
|
|
361
|
+
image?: string;
|
|
362
|
+
duration?: number;
|
|
363
|
+
artists: ArtistRef[];
|
|
364
|
+
album?: AlbumRef;
|
|
365
|
+
disc?: number; // 整数;App 尚未使用
|
|
366
|
+
index?: number; // 整数;App 尚未使用
|
|
367
|
+
ids?: Ids;
|
|
368
|
+
version?: VersionInfo; // App 尚未使用
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// 曲库来源自带的电台是通用域的 Station,起播与别的台一样走 play.start。
|
|
372
|
+
export type MusicKind = "artist" | "album" | "playlist" | "song" | "station";
|
|
373
|
+
|
|
374
|
+
export interface MusicSection {
|
|
375
|
+
id: string;
|
|
376
|
+
title: string;
|
|
377
|
+
kind: MusicKind; // App 尚未使用
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export type MusicEntry =
|
|
381
|
+
| { type: "artist"; artist: Artist }
|
|
382
|
+
| { type: "album"; album: Album }
|
|
383
|
+
| { type: "playlist"; playlist: MusicPlaylist }
|
|
384
|
+
| { type: "song"; song: Song }
|
|
385
|
+
| { type: "station"; station: Station }
|
|
386
|
+
;
|
|
387
|
+
|
|
388
|
+
// 歌手页的主体是专辑,热门歌曲可选;专辑页一次给全;歌单的歌按游标翻页。
|
|
389
|
+
export interface ArtistPage {
|
|
390
|
+
artist: Artist; // App 尚未使用
|
|
391
|
+
albums: Paged<Album>;
|
|
392
|
+
topSongs?: Song[];
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export interface AlbumPage {
|
|
396
|
+
album: Album; // App 尚未使用
|
|
397
|
+
songs: Song[];
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface PlaylistPage {
|
|
401
|
+
playlist: MusicPlaylist; // App 尚未使用
|
|
402
|
+
songs: Paged<Song>;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// 歌词:synced 为真时每行带 start(秒),可以带 end 与译文。
|
|
406
|
+
export interface Lyrics {
|
|
407
|
+
synced: boolean;
|
|
408
|
+
lines: LyricsLine[];
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface LyricsLine {
|
|
412
|
+
start?: number;
|
|
413
|
+
end?: number; // App 尚未使用
|
|
414
|
+
text: string;
|
|
415
|
+
translation?: string;
|
|
416
|
+
}
|
|
417
|
+
|
|
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
|
+
// krillplayer.files:内核替插件读用户填的那台服务器或选的那个文件夹,插件拿不到套接字,也走不出来源实例的根。
|
|
467
|
+
// 清单的 files 声明要哪种协议;path 相对来源实例的根,根是 "",分隔符是 /,开头不带 /,不接受 . 与 ..。
|
|
468
|
+
// modified 是 Unix 秒;目录不带 size。
|
|
469
|
+
export type FilesProtocol = "smb" | "local";
|
|
470
|
+
|
|
471
|
+
export interface FileEntry {
|
|
472
|
+
name: string;
|
|
473
|
+
path: string;
|
|
474
|
+
isDirectory: boolean;
|
|
475
|
+
size?: number; // 整数
|
|
476
|
+
modified?: number;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export interface ChannelPage {
|
|
480
|
+
channel: Channel;
|
|
481
|
+
entries: Paged<Entry>;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export interface CollectionPage {
|
|
485
|
+
collection: Collection;
|
|
486
|
+
entries: Paged<Entry>;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// 排期是频道的数据,不是条目:不能播、不进历史。id 来源有就给,内核用它给提醒去重;
|
|
490
|
+
// 这一格能回看(或正在播、能从头看)时给出 item。
|
|
491
|
+
export interface ScheduleEntry {
|
|
492
|
+
id?: string; // App 尚未使用
|
|
493
|
+
start: number;
|
|
494
|
+
end: number;
|
|
495
|
+
title: string;
|
|
496
|
+
summary?: string; // App 尚未使用
|
|
497
|
+
image?: string; // App 尚未使用
|
|
498
|
+
item?: OnDemand;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// channel() 与 collection() 的位置:tab 取自频道对象的 tabs;cursor 接着上一页往后取;
|
|
502
|
+
// around 是一个条目的 id,从这个条目开始往后取(只为连播服务)。cursor 与 around 只给一个。
|
|
503
|
+
export interface At {
|
|
504
|
+
tab?: string;
|
|
505
|
+
cursor?: string;
|
|
506
|
+
around?: string;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// 认链接的结果。曲库那一支随曲库的票加。
|
|
510
|
+
export type Resolved = ResolvedBrowse;
|
|
511
|
+
|
|
512
|
+
export interface ResolvedBrowse {
|
|
513
|
+
domain: "browse";
|
|
514
|
+
entry: Entry; // App 尚未使用
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// 参数:实例参数、浏览参数、设置项用同一个类型。值一律是字符串:toggle 是 "true" 或 "false",
|
|
518
|
+
// multiChoice 是一个 JSON 数组的文本。secret 的值按凭证存放,不进任何 id,也不进日志。不认识的种类当作 text。
|
|
519
|
+
// dynamicOptions:选项要向插件的 options(krillplayer, name, values) 要;dependsOn 里的参数变了重新要。
|
|
520
|
+
// visibleWhen 全部满足才显示;当前不显示的参数不传给插件。constant 不显示给用户,值固定为 defaultValue。
|
|
521
|
+
export interface Parameter {
|
|
522
|
+
name: string;
|
|
523
|
+
title: string;
|
|
524
|
+
kind: ParameterKind;
|
|
525
|
+
secret?: boolean;
|
|
526
|
+
defaultValue?: string;
|
|
527
|
+
optional?: boolean;
|
|
528
|
+
placeholder?: string;
|
|
529
|
+
options?: Option[];
|
|
530
|
+
dynamicOptions?: boolean;
|
|
531
|
+
dependsOn?: string[];
|
|
532
|
+
visibleWhen?: ParameterCondition[];
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// App 不认识的取值当作 "text"。
|
|
536
|
+
export type ParameterKind = "text" | "url" | "number" | "toggle" | "choice" | "multiChoice" | "constant";
|
|
537
|
+
|
|
538
|
+
export interface ParameterCondition {
|
|
539
|
+
name: string;
|
|
540
|
+
values: string[];
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// 贡献点:插件只声明往哪里加、对哪些种类的条目生效,内容在 views 槽位里给。
|
|
544
|
+
// 播放器面板经 views.panel 取,卡片操作经 views.action 执行;kinds 之外的条目上不出现,
|
|
545
|
+
// 过滤掉内核不认识的种类后一个不剩时这一项不显示。
|
|
546
|
+
// backgroundTasks:插件在后台要做的事与建议周期(秒)。只认 task 为 "status"(查订阅频道的
|
|
547
|
+
// 开播状态与最新条目);实际节拍由内核决定,建议周期只在内核允许的范围里取(开播状态首发不投入)。
|
|
548
|
+
export interface Contributions {
|
|
549
|
+
playerPanels?: PlayerPanelContribution[];
|
|
550
|
+
cardActions?: CardActionContribution[];
|
|
551
|
+
backgroundTasks?: BackgroundTaskContribution[];
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export interface PlayerPanelContribution {
|
|
555
|
+
id: string;
|
|
556
|
+
title: string;
|
|
557
|
+
kinds: ItemKind[];
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export interface CardActionContribution {
|
|
561
|
+
id: string;
|
|
562
|
+
title: string;
|
|
563
|
+
kinds: ItemKind[];
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
export interface BackgroundTaskContribution {
|
|
567
|
+
task: string;
|
|
568
|
+
period: number;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export interface PlatformCapabilities {
|
|
572
|
+
iOS?: Capability[];
|
|
573
|
+
macOS?: Capability[];
|
|
574
|
+
tvOS?: Capability[];
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// parameters 是实例参数:声明了它的插件,用户每填一组就建一个来源实例;url 参数里的主机在声明了 userProvidedURLs 时放行。
|
|
578
|
+
// settings 是设置项,值由插件用 krillplayer.settings.get() 读。
|
|
579
|
+
export interface PluginManifest {
|
|
580
|
+
id: string;
|
|
581
|
+
sourceId: string;
|
|
582
|
+
name: string;
|
|
583
|
+
author: string;
|
|
584
|
+
version: string;
|
|
585
|
+
language?: string;
|
|
586
|
+
interfaceLevel: number; // 整数
|
|
587
|
+
contractRevision: number; // 整数
|
|
588
|
+
hosts: string[];
|
|
589
|
+
userProvidedURLs?: boolean;
|
|
590
|
+
readsCredentials?: boolean;
|
|
591
|
+
imageCacheIgnoredParameters?: string[];
|
|
592
|
+
files?: FilesProtocol;
|
|
593
|
+
appKeys?: string[];
|
|
594
|
+
parameters?: Parameter[];
|
|
595
|
+
settings?: Parameter[];
|
|
596
|
+
unsupported?: PlatformCapabilities;
|
|
597
|
+
feedbackURL?: string;
|
|
598
|
+
contributes?: Contributions;
|
|
599
|
+
capabilities: Capability[];
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// muted、rateLimited、contentRejected 是发弹幕(danmaku.send)被来源拒绝的三种原因:被禁言、发得太快、内容不让发。
|
|
603
|
+
// 不认识的种类按 other(旧内核遇到这三种也是 other)。
|
|
604
|
+
// App 不认识的取值当作 "other"。
|
|
605
|
+
export type PluginErrorKind = "regionRestricted" | "loginRequired" | "verificationRequired" | "ended" | "notStarted" | "refused" | "retryable" | "notFound" | "muted" | "rateLimited" | "contentRejected" | "other";
|
|
606
|
+
|
|
607
|
+
export interface PluginError {
|
|
608
|
+
kind: PluginErrorKind;
|
|
609
|
+
message?: string;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
export type SubtitleFormat = "srt" | "webvtt" | "ass";
|
|
613
|
+
|
|
614
|
+
// 起播时已经知道地址的外挂字幕。id 在这个条目里不重复,与 subtitles.list、字幕插件 search 给的合并时同一个 id 只留一条;
|
|
615
|
+
// 地址与请求头的规则同 Subtitle。
|
|
616
|
+
export interface PlayableSubtitle {
|
|
617
|
+
id: string;
|
|
618
|
+
language: string;
|
|
619
|
+
title?: string;
|
|
620
|
+
format: SubtitleFormat;
|
|
621
|
+
url: string;
|
|
622
|
+
headers?: Record<string, string>;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// container 知道就给,视频引擎用它选播放路径;不认识的取值当作没给,引擎再看地址后缀。
|
|
626
|
+
export interface PlayableStream {
|
|
627
|
+
quality: string;
|
|
628
|
+
url: string;
|
|
629
|
+
headers?: Record<string, string>;
|
|
630
|
+
audioURL?: string;
|
|
631
|
+
container?: Container;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export type Container = "mp4" | "mov" | "mkv" | "ts" | "flv" | "hls" | "dash" | "webm" | "mp3" | "aac" | "flac" | "ogg";
|
|
635
|
+
|
|
636
|
+
export interface PlayableLine {
|
|
637
|
+
name: string;
|
|
638
|
+
streams: PlayableStream[];
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// 时间都以秒计;expiresAt 是 Unix 时间戳。resume 是来源记下的续播位置(点播,秒),
|
|
642
|
+
// 内核只在本地没有这个条目的记录时采用。
|
|
643
|
+
export interface Playable {
|
|
644
|
+
timing: PlayableTiming;
|
|
645
|
+
duration?: number;
|
|
646
|
+
resume?: number;
|
|
647
|
+
lines: PlayableLine[];
|
|
648
|
+
expiresAt?: number;
|
|
649
|
+
trial?: PlayableTrial;
|
|
650
|
+
segments?: PlayableSegment[]; // App 尚未使用
|
|
651
|
+
decryption?: PlayableDecryption;
|
|
652
|
+
subtitles?: PlayableSubtitle[];
|
|
653
|
+
filename?: string;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export type PlayableTiming = "live" | "onDemand";
|
|
657
|
+
|
|
658
|
+
export interface PlayableTrial {
|
|
659
|
+
seconds: number;
|
|
660
|
+
message?: string;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
export interface PlayableSegment {
|
|
664
|
+
kind: PlayableSegmentKind; // App 尚未使用
|
|
665
|
+
start: number; // App 尚未使用
|
|
666
|
+
end: number; // App 尚未使用
|
|
667
|
+
title?: string; // App 尚未使用
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export interface PlayableDecryption {
|
|
671
|
+
method: PlayableDecryptionMethod;
|
|
672
|
+
key: string;
|
|
673
|
+
keyId?: string;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
export type PlayableSegmentKind = "intro" | "outro" | "chapter";
|
|
677
|
+
|
|
678
|
+
export type PlayableDecryptionMethod = "cencAesCtr";
|
|
679
|
+
|
|
680
|
+
// 指向插件的一个页面:内核用 page 与 values 调 views.page;title 是推入页面时的标题。
|
|
681
|
+
export interface PageLink {
|
|
682
|
+
page: string;
|
|
683
|
+
title?: string;
|
|
684
|
+
values?: Record<string, string>;
|
|
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;
|
|
698
|
+
time?: number;
|
|
699
|
+
entry?: Entry;
|
|
700
|
+
open?: PageLink;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export type CardKind = "entry" | "link" | "banner" | "comment";
|
|
704
|
+
|
|
705
|
+
// row 横向列表,grid 网格,list 竖排的紧凑行(评论、面板里的推荐),banners 横幅轮播。more 是分区标题旁的「更多」。
|
|
706
|
+
export interface Section {
|
|
707
|
+
layout: SectionLayout;
|
|
708
|
+
title?: string;
|
|
709
|
+
cards: Card[];
|
|
710
|
+
more?: PageLink;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
export type SectionLayout = "row" | "grid" | "list" | "banners";
|
|
714
|
+
|
|
715
|
+
// 插件用组件拼出的页面。filters 里的选项参数渲染成分段筛选,选中的值按参数名放进下一次请求的 values;
|
|
716
|
+
// next 有值时内核滚到底再要下一页,把它原样放进下一次请求的 cursor:下一页的第一个分区与上一页最后一个分区布局与标题相同时接在后面。
|
|
717
|
+
// empty 是没有分区时空状态里的说明。Swift 里叫 PageContent:内核校验后的页面类型叫 ComponentPage。
|
|
718
|
+
export interface ComponentPage {
|
|
719
|
+
title?: string;
|
|
720
|
+
filters?: Parameter[];
|
|
721
|
+
sections: Section[];
|
|
722
|
+
next?: string;
|
|
723
|
+
maxAge?: number;
|
|
724
|
+
empty?: string;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// 卡片操作的结果:open 推入插件的页面,message 是给用户看的一句话。
|
|
728
|
+
export interface ActionResult {
|
|
729
|
+
open?: PageLink;
|
|
730
|
+
message?: string;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// 状态槽位的一项:一批频道 id 进,每个 id 一项出,顺序不限。
|
|
734
|
+
// offline 时 offlineReason 说明为什么不在播:notLive 未开播、rerun 在放轮播或录像、gone 频道已不存在(订阅标成失效)。
|
|
735
|
+
// unknown 时 unknownReason 说明为什么查不出:failed 来源答非所问或出错、rateLimited 被限流(retryAfter 是来源要求等待的秒数)、
|
|
736
|
+
// loginRequired 要登录才能查、verificationRequired 要先完成来源的人机验证。内核只认与 live 对应的那个原因,另一个忽略。
|
|
737
|
+
// title 是来源此刻给的直播标题;session 是场次 id,只用于开播通知去重与起播提示,不是身份。
|
|
738
|
+
// latest 是频道最新的点播条目(来源内 id、发布时间 Unix 秒、标题),内核据此判定「有新集」;与 live 无关,查不出时不给。
|
|
739
|
+
// liveId 在 live 为 online 时给:此刻在播的那个条目的 id,内核用它起播;没给时内核退回去调 browse.channel 取。
|
|
740
|
+
export interface ChannelStatus {
|
|
741
|
+
id: string;
|
|
742
|
+
live: ChannelLive;
|
|
743
|
+
offlineReason?: OfflineReason;
|
|
744
|
+
unknownReason?: UnknownReason;
|
|
745
|
+
retryAfter?: number;
|
|
746
|
+
title?: string;
|
|
747
|
+
session?: string;
|
|
748
|
+
liveId?: string;
|
|
749
|
+
latest?: LatestItemSignal; // App 尚未使用
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// App 不认识的取值当作 "unknown"。
|
|
753
|
+
export type ChannelLive = "online" | "offline" | "unknown";
|
|
754
|
+
|
|
755
|
+
// App 不认识的取值当作 "notLive"。
|
|
756
|
+
export type OfflineReason = "notLive" | "rerun" | "gone";
|
|
757
|
+
|
|
758
|
+
// App 不认识的取值当作 "failed"。
|
|
759
|
+
export type UnknownReason = "failed" | "rateLimited" | "loginRequired" | "verificationRequired";
|
|
760
|
+
|
|
761
|
+
export interface LatestItemSignal {
|
|
762
|
+
id: string; // App 尚未使用
|
|
763
|
+
published: number; // App 尚未使用
|
|
764
|
+
title?: string; // App 尚未使用
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// 状态槽位 images 的一项:频道 id 与它的头像,地址规则同卡片的 image。
|
|
768
|
+
export interface ChannelImage {
|
|
769
|
+
id: string;
|
|
770
|
+
image: string;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// 弹幕槽位的直播弹幕。一帧是文本或字节,二者只给一个;两个都给时按字节。
|
|
774
|
+
export interface DanmakuFrame {
|
|
775
|
+
text?: string;
|
|
776
|
+
data?: Uint8Array;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
export interface CommentImage {
|
|
780
|
+
url: string; // App 尚未使用
|
|
781
|
+
width: number; // App 尚未使用
|
|
782
|
+
height: number; // App 尚未使用
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
// 一条弹幕。color 是 RGB 整数,缺省为白色;time 是 Unix 秒,直播弹幕不给,按内核收到的时刻。
|
|
786
|
+
// offset 只在点播弹幕里给:它在条目里的时间点(秒),内核按播放到的位置让它上屏。
|
|
787
|
+
// paid 与 gift 至多给一个:paid 是醒目留言这类付费消息(currency 是 ISO 4217 代码),gift 是礼物,正文可以为空。
|
|
788
|
+
// emoticons 把正文里的代码(如 [dog])换成图;sticker 是整条就是一张表情包,content 是它的名字。
|
|
789
|
+
// medal 与 userLevel 只在评论列表里显示。直播与点播弹幕共用这个类型。
|
|
790
|
+
// position 是上屏方式:scroll 从右往左飞过,top 与 bottom 在画面顶部或底部居中停一会儿;缺省与不认识的值按 scroll。
|
|
791
|
+
export interface DanmakuComment {
|
|
792
|
+
content: string;
|
|
793
|
+
username: string; // App 尚未使用
|
|
794
|
+
color?: number; // 整数
|
|
795
|
+
senderId?: string; // App 尚未使用
|
|
796
|
+
messageId?: string; // App 尚未使用
|
|
797
|
+
time?: number; // App 尚未使用
|
|
798
|
+
offset?: number;
|
|
799
|
+
paid?: CommentPaid; // App 尚未使用
|
|
800
|
+
gift?: CommentGift; // App 尚未使用
|
|
801
|
+
medal?: CommentMedal; // App 尚未使用
|
|
802
|
+
userLevel?: number; // 整数;App 尚未使用
|
|
803
|
+
emoticons?: Record<string, CommentImage>; // App 尚未使用
|
|
804
|
+
sticker?: CommentImage; // App 尚未使用
|
|
805
|
+
position?: DanmakuPosition;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
export interface CommentPaid {
|
|
809
|
+
amount: number; // App 尚未使用
|
|
810
|
+
currency: string; // App 尚未使用
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
export interface CommentGift {
|
|
814
|
+
name: string; // App 尚未使用
|
|
815
|
+
count: number; // 整数;App 尚未使用
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
export interface CommentMedal {
|
|
819
|
+
name: string; // App 尚未使用
|
|
820
|
+
level: number; // 整数;App 尚未使用
|
|
821
|
+
color?: number; // 整数;App 尚未使用
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// App 不认识的取值当作 "scroll"。
|
|
825
|
+
export type DanmakuPosition = "scroll" | "top" | "bottom";
|
|
826
|
+
|
|
827
|
+
// 连接规格:内核连 url(ws 或 wss),带 headers,依次发 handshake,之后每 interval 秒发一次心跳帧;收到的每一帧交给 decode。
|
|
828
|
+
// recent 是进房时就有的最近几条弹幕,只进评论列表、不飞上屏。
|
|
829
|
+
// 规格的地址、请求头或任一帧里含本来源的凭证时,目标必须是清单声明的主机或用户参数里的主机,否则内核拒绝连接。
|
|
830
|
+
export interface LiveDanmakuConnection {
|
|
831
|
+
url: string;
|
|
832
|
+
headers?: Record<string, string>;
|
|
833
|
+
handshake: DanmakuFrame[];
|
|
834
|
+
heartbeat?: DanmakuHeartbeat;
|
|
835
|
+
recent?: DanmakuComment[];
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
export interface DanmakuHeartbeat {
|
|
839
|
+
frame: DanmakuFrame;
|
|
840
|
+
interval: number;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
// 一帧解出的结果:按顺序上屏的弹幕、要回发的帧、续接令牌。续接令牌由内核保存,重连时交给 connect。
|
|
844
|
+
export interface DanmakuBatch {
|
|
845
|
+
messages: DanmakuComment[];
|
|
846
|
+
replies?: DanmakuFrame[];
|
|
847
|
+
resume?: string;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// 点播弹幕的一段:覆盖条目里 [start, end) 秒,messages 按 offset 排或不排都行。
|
|
851
|
+
// 内核按播放位置要下一段:给 end 作为下一次的 position;end 不大于 start 的段按空段处理,内核不再往后要。
|
|
852
|
+
export interface DanmakuSegment {
|
|
853
|
+
start: number;
|
|
854
|
+
end: number;
|
|
855
|
+
messages: DanmakuComment[];
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// 内核拿来问资源插件、字幕插件与弹幕插件的一部作品:电影,或剧集里的一集。
|
|
859
|
+
// ids 是电影自己的或剧集的;title 是电影名或剧集名;season、episode、episodeTitle 只在 kind 为 episode 时给;
|
|
860
|
+
// absoluteEpisode 是不分季连续编号时的集号,内核知道就给。
|
|
861
|
+
export interface WorkQuery {
|
|
862
|
+
kind: WorkQueryKind;
|
|
863
|
+
ids: Ids;
|
|
864
|
+
title: string;
|
|
865
|
+
originalTitle?: string;
|
|
866
|
+
year?: number; // 整数
|
|
867
|
+
season?: number; // 整数
|
|
868
|
+
episode?: number; // 整数
|
|
869
|
+
episodeTitle?: string;
|
|
870
|
+
absoluteEpisode?: number; // 整数
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
export type WorkQueryKind = "movie" | "episode";
|
|
874
|
+
|
|
875
|
+
// 对任何来源的视频去问字幕插件、弹幕插件时的那个视频。内核知道哪样给哪样:认出了作品给 work;
|
|
876
|
+
// filename 是原始文件名(没有时是条目的标题),size 是字节数,duration 是秒;hashes 的键是算法名,内核能算出哪个给哪个;
|
|
877
|
+
// languages 是用户想要的语言,BCP 47,按优先顺序。
|
|
878
|
+
export interface MediaQuery {
|
|
879
|
+
work?: WorkQuery;
|
|
880
|
+
filename?: string;
|
|
881
|
+
size?: number; // 整数
|
|
882
|
+
duration?: number;
|
|
883
|
+
hashes?: Record<string, string>;
|
|
884
|
+
languages: string[];
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// 弹幕插件的一个候选:id 原样交回 danmaku.comments;title 是作品名,subtitle 是集名或别的说明,
|
|
888
|
+
// episode 是集号,count 是这一份有多少条弹幕。候选按插件给的顺序排,内核取第一个,用户可以改选。
|
|
889
|
+
export interface DanmakuMatch {
|
|
890
|
+
id: string;
|
|
891
|
+
title: string;
|
|
892
|
+
subtitle?: string;
|
|
893
|
+
episode?: number; // 整数;App 尚未使用
|
|
894
|
+
count?: number; // 整数;App 尚未使用
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// 播放回报:开始、播放中每隔一段时间、结束时内核各调一次。item 是来源内条目 id,
|
|
898
|
+
// position 与 duration 以秒计;直播条目没有 duration。
|
|
899
|
+
export interface PlaybackReport {
|
|
900
|
+
item: string;
|
|
901
|
+
event: PlaybackReportEvent;
|
|
902
|
+
position: number;
|
|
903
|
+
duration?: number;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
export type PlaybackReportEvent = "start" | "progress" | "end";
|
|
907
|
+
|
|
908
|
+
// 字幕槽位的一条外挂字幕轨。id 是插件自己定的、在这个条目里不重复的轨道 id,原样交回 fetch;
|
|
909
|
+
// language 是语言代码(BCP 47,来源自己的写法也照给),title 是给用户看的名字,不给时内核按 language 显示。
|
|
910
|
+
// attribution 是字幕出处要求的署名(#524):text 原样显示在挑字幕的地方、点开 url(https);内核不翻译、不改写。
|
|
911
|
+
// 字幕服务的条款要求署名时由插件在搜到的每条字幕上给出,内核按插件给的显示,不按插件或服务写死。
|
|
912
|
+
export interface SubtitleTrack {
|
|
913
|
+
id: string;
|
|
914
|
+
language: string;
|
|
915
|
+
title?: string;
|
|
916
|
+
attribution?: SubtitleAttribution;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
export interface SubtitleAttribution {
|
|
920
|
+
text: string;
|
|
921
|
+
url: string;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// 一条字幕:原始字节、正文或地址,三样给一样;都给时按 data、content、url 的顺序取,都不给时这条字幕取不到。
|
|
925
|
+
// data 可以是没解压的 gzip 或 zip(取里面第一个字幕文件);data 与地址取回的字节由内核判断编码(UTF-8、UTF-16、GB 18030、Big5)。
|
|
926
|
+
// 地址是 http、https 或 krillplayer.files.playable 给的地址,由内核去取,只带 headers,不带别的请求头、Cookie 与凭证。
|
|
927
|
+
// 渲染与位置由内核决定,插件不给样式。
|
|
928
|
+
export interface Subtitle {
|
|
929
|
+
format: SubtitleFormat;
|
|
930
|
+
data?: Uint8Array;
|
|
931
|
+
content?: string;
|
|
932
|
+
url?: string;
|
|
933
|
+
headers?: Record<string, string>;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// krillplayer.formats 的结果。只带出有值的字段;时间是 Unix 秒,时长是秒。
|
|
937
|
+
// M3U:attributes 是 #EXTINF 上的全部属性(键转成小写),常用的几项另外带出;headers 来自 #EXTVLCOPT。
|
|
938
|
+
export interface M3UEntry {
|
|
939
|
+
url: string;
|
|
940
|
+
title: string;
|
|
941
|
+
duration: number;
|
|
942
|
+
tvgId?: string;
|
|
943
|
+
tvgName?: string;
|
|
944
|
+
logo?: string;
|
|
945
|
+
group?: string;
|
|
946
|
+
headers?: Record<string, string>;
|
|
947
|
+
attributes: Record<string, string>;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// guideURLs 来自 #EXTM3U 的 x-tvg-url 与 url-tvg(逗号分隔)。清单是本实例经 krillplayer.http.request 取回、原样交来的字节时,
|
|
951
|
+
// 它们是派生地址:krillplayer.formats.xmltv 取它们时放行主机,但不能带凭证。
|
|
952
|
+
export interface M3UPlaylist {
|
|
953
|
+
guideURLs: string[];
|
|
954
|
+
attributes: Record<string, string>;
|
|
955
|
+
entries: M3UEntry[];
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// 节目单由内核取回、解析并留在内核(大节目单交给插件会超内存上限),插件按频道与时间窗口查询。
|
|
959
|
+
// maxAge 是内核留着这份解析结果的秒数,缺省 3600。
|
|
960
|
+
export interface XMLTVSource {
|
|
961
|
+
url: string;
|
|
962
|
+
headers?: Record<string, string>;
|
|
963
|
+
maxAge?: number;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
export interface XMLTVQuery {
|
|
967
|
+
channels: string[];
|
|
968
|
+
from: number;
|
|
969
|
+
to: number;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
export interface XMLTVChannel {
|
|
973
|
+
id: string;
|
|
974
|
+
names: string[];
|
|
975
|
+
icon?: string;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
export interface XMLTVProgramme {
|
|
979
|
+
channel: string;
|
|
980
|
+
start: number;
|
|
981
|
+
stop?: number;
|
|
982
|
+
title: string;
|
|
983
|
+
subtitle?: string;
|
|
984
|
+
description?: string;
|
|
985
|
+
categories: string[];
|
|
986
|
+
icon?: string;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
export interface RSSEnclosure {
|
|
990
|
+
url: string;
|
|
991
|
+
type?: string;
|
|
992
|
+
length?: number; // 整数
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
export interface RSSEpisode {
|
|
996
|
+
title: string;
|
|
997
|
+
guid?: string;
|
|
998
|
+
description?: string;
|
|
999
|
+
link?: string;
|
|
1000
|
+
published?: number;
|
|
1001
|
+
duration?: number;
|
|
1002
|
+
season?: number; // 整数
|
|
1003
|
+
episode?: number; // 整数
|
|
1004
|
+
episodeType?: string;
|
|
1005
|
+
image?: string;
|
|
1006
|
+
enclosure?: RSSEnclosure;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
export interface RSSFeed {
|
|
1010
|
+
title: string;
|
|
1011
|
+
description?: string;
|
|
1012
|
+
link?: string;
|
|
1013
|
+
image?: string;
|
|
1014
|
+
author?: string;
|
|
1015
|
+
language?: string;
|
|
1016
|
+
order?: PodcastOrder;
|
|
1017
|
+
episodes: RSSEpisode[];
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
// krillplayer.metadata:目录插件经它查影视资料,请求由内核发出,插件看不到背后是哪家服务,也不用在 hosts 里声明。
|
|
1021
|
+
// 名字是自己定的,不跟哪一家的接口名与类型编号走。榜单:trending 是本周的热门,popular 是一直以来的热门,topRated 是评分高的,
|
|
1022
|
+
// upcoming 只有电影,onAir 只有剧集。筛选(genre、country、year)只有 popular 与 topRated 能用,三者可以一起用。
|
|
1023
|
+
// 剧集没有 horror、history、music、romance、thriller,电影没有 kids、news、reality、soap、talk;剧集的 action 与 adventure、
|
|
1024
|
+
// scienceFiction 与 fantasy 各是同一组。组合不成立、名字写错,调用直接失败并说明原因。
|
|
1025
|
+
export type WorkKind = "movie" | "series";
|
|
1026
|
+
|
|
1027
|
+
export type ListName = "trending" | "popular" | "topRated" | "upcoming" | "onAir";
|
|
1028
|
+
|
|
1029
|
+
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
|
+
|
|
1031
|
+
// search 与 list 返回的 ids 只有 tmdb;get 返回这家知道的全部判定 id,调用方带来的别家 id 原样留着。image 是海报,经代理转发,不用声明域名。
|
|
1032
|
+
export interface Work {
|
|
1033
|
+
kind: WorkKind;
|
|
1034
|
+
ids: Ids;
|
|
1035
|
+
title: string;
|
|
1036
|
+
originalTitle?: string;
|
|
1037
|
+
year?: number; // 整数
|
|
1038
|
+
image?: string;
|
|
1039
|
+
summary?: string;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// cursor 是上一页的 next,内容由内核定,原样传回。
|
|
1043
|
+
export interface MetadataSearchOptions {
|
|
1044
|
+
year?: number; // 整数
|
|
1045
|
+
cursor?: string;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
// 筛选只有 popular 与 topRated 能用;country 是 ISO 3166-1 两位大写代码,year 是上映或首播年。
|
|
1049
|
+
export interface MetadataListOptions {
|
|
1050
|
+
genre?: Genre;
|
|
1051
|
+
country?: string;
|
|
1052
|
+
year?: number; // 整数
|
|
1053
|
+
cursor?: string;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
// 登录规格:插件只给数据,界面由内核按种类渲染,没有按来源写的登录界面。
|
|
1057
|
+
// web:内核打开 url,loggedInCookie 出现即视为登录成功,cookies 里列出的 Cookie 按名字存成凭证项。
|
|
1058
|
+
// qrCode:内核调 login.qrCode 取二维码、按 interval 秒调 login.poll;确认后插件经 krillplayer.credentials.set 写入凭证。
|
|
1059
|
+
// fields:内核按 fields 画表单,填的值按字段名存成凭证项。note 是给用户看的一句说明。
|
|
1060
|
+
export interface LoginMethod {
|
|
1061
|
+
kind: LoginMethodKind;
|
|
1062
|
+
title: string;
|
|
1063
|
+
note?: string;
|
|
1064
|
+
url?: string;
|
|
1065
|
+
loggedInCookie?: string;
|
|
1066
|
+
cookies?: string[];
|
|
1067
|
+
fields?: LoginField[];
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
export type LoginMethodKind = "web" | "qrCode" | "fields";
|
|
1071
|
+
|
|
1072
|
+
export interface LoginField {
|
|
1073
|
+
name: string;
|
|
1074
|
+
title: string;
|
|
1075
|
+
secret?: boolean;
|
|
1076
|
+
placeholder?: string;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
// content 是二维码里的文本;key 原样交回 login.poll。interval 与 expiresIn 以秒计,缺省 2 与 180。
|
|
1080
|
+
export interface LoginQRCode {
|
|
1081
|
+
content: string;
|
|
1082
|
+
key: string;
|
|
1083
|
+
interval?: number;
|
|
1084
|
+
expiresIn?: number;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
export interface LoginPoll {
|
|
1088
|
+
state: LoginPollState;
|
|
1089
|
+
message?: string; // App 尚未使用
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
export type LoginPollState = "waiting" | "scanned" | "confirmed" | "expired";
|
|
1093
|
+
|
|
1094
|
+
// 登录后的账号,登录界面与插件详情用它说明「登录的是谁」;没登录或凭证已失效时返回 null。
|
|
1095
|
+
export interface LoginAccount {
|
|
1096
|
+
name: string;
|
|
1097
|
+
avatar?: string; // App 尚未使用
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
// krillplayer.crypto.subtle:WebCrypto 的标准算法,名字与参数照 WebCrypto,作者能照搬现成的代码。
|
|
1101
|
+
// 名字不分大小写,内核与试跑器都收成这里的写法。
|
|
1102
|
+
export type CryptoAlgorithm = "RSASSA-PKCS1-v1_5" | "RSA-PSS" | "RSA-OAEP" | "ECDSA" | "Ed25519" | "HMAC" | "AES-CTR" | "AES-CBC" | "AES-GCM" | "AES-KW" | "ECDH" | "X25519" | "HKDF" | "PBKDF2";
|
|
1103
|
+
|
|
1104
|
+
export type CryptoHash = "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512";
|
|
1105
|
+
|
|
1106
|
+
export type CryptoNamedCurve = "P-256" | "P-384" | "P-521";
|
|
1107
|
+
|
|
1108
|
+
export type CryptoKeyUsage = "encrypt" | "decrypt" | "sign" | "verify" | "deriveKey" | "deriveBits" | "wrapKey" | "unwrapKey";
|
|
1109
|
+
|
|
1110
|
+
export type CryptoKeyFormat = "raw" | "spki" | "pkcs8" | "jwk";
|
|
1111
|
+
|
|
1112
|
+
// 密钥对象的 algorithm,同 WebCrypto 的 KeyAlgorithm:RSA 带 modulusLength、publicExponent 与 hash,ECDSA 与 ECDH 带 namedCurve,
|
|
1113
|
+
// HMAC 带 length(位)与 hash,AES(含 AES-KW)带 length(位),Ed25519、X25519、HKDF、PBKDF2 只有 name。
|
|
1114
|
+
export interface CryptoKeyAlgorithm {
|
|
1115
|
+
name: CryptoAlgorithm;
|
|
1116
|
+
modulusLength?: number; // 整数
|
|
1117
|
+
publicExponent?: Uint8Array;
|
|
1118
|
+
hash?: CryptoHashAlgorithm;
|
|
1119
|
+
namedCurve?: CryptoNamedCurve;
|
|
1120
|
+
length?: number; // 整数
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
export interface CryptoHashAlgorithm {
|
|
1124
|
+
name: CryptoHash;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
// 密钥本身,写法是 JWK 里装密钥的那几个字段(Base64url),由宿主定,插件不读也不改它。
|
|
1128
|
+
export interface CryptoKeyMaterial {
|
|
1129
|
+
kty: string;
|
|
1130
|
+
crv?: string;
|
|
1131
|
+
x?: string;
|
|
1132
|
+
y?: string;
|
|
1133
|
+
n?: string;
|
|
1134
|
+
e?: string;
|
|
1135
|
+
d?: string;
|
|
1136
|
+
p?: string;
|
|
1137
|
+
q?: string;
|
|
1138
|
+
dp?: string;
|
|
1139
|
+
dq?: string;
|
|
1140
|
+
qi?: string;
|
|
1141
|
+
k?: string;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
// 不是 WebCrypto 的 CryptoKey,是一个普通的对象:插件跑在 QuickJS 里,密钥要能序列化地经过宿主,所以能 JSON.stringify 后
|
|
1145
|
+
// 存进 storage、取出来照样用。type、extractable、algorithm、usages 与 WebCrypto 相同;extractable 为 false 只让 exportKey 失败。
|
|
1146
|
+
export interface CryptoKey {
|
|
1147
|
+
type: CryptoKeyType;
|
|
1148
|
+
extractable: boolean;
|
|
1149
|
+
algorithm: CryptoKeyAlgorithm;
|
|
1150
|
+
usages: CryptoKeyUsage[];
|
|
1151
|
+
material: CryptoKeyMaterial;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
export type CryptoKeyType = "secret" | "public" | "private";
|
|
1155
|
+
|
|
1156
|
+
export interface CryptoKeyPair {
|
|
1157
|
+
publicKey: CryptoKey;
|
|
1158
|
+
privateKey: CryptoKey;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// krillplayer.http.request 的请求。只允许 http 与 https;每一跳(含重定向)的主机都要在清单 hosts 里,
|
|
1162
|
+
// 或是本来源实例 url 参数里的主机(清单声明了 userProvidedURLs 时)。
|
|
1163
|
+
export interface KrillPlayerRequest {
|
|
1164
|
+
url: string;
|
|
1165
|
+
method?: string;
|
|
1166
|
+
headers?: Record<string, string>;
|
|
1167
|
+
body?: Uint8Array | string;
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
// 头名小写。set-cookie 是这次应答的全部 Set-Cookie,一条一行(Cookie 的 Expires 里有逗号,不能按逗号合并)。
|
|
1171
|
+
// 宿主不存 Cookie,插件要用就自己存进凭证。body 是原始字节,文本用 new TextDecoder().decode(body)。
|
|
1172
|
+
export interface KrillPlayerResponse {
|
|
1173
|
+
status: number;
|
|
1174
|
+
url: string;
|
|
1175
|
+
headers: Record<string, string>;
|
|
1176
|
+
body: Uint8Array;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
export type JSONValue = null | boolean | number | string | JSONValue[] | { [key: string]: JSONValue };
|
|
1180
|
+
export type LogLevel = "debug" | "info" | "warn" | "error";
|
|
1181
|
+
|
|
1182
|
+
// krillplayer.formats.xml 的结果:一个元素。name 是不带前缀的本地名,namespace 是前缀或默认命名空间指向的地址,没有绑定时不给;
|
|
1183
|
+
// attributes 照原样的名字,含 xmlns 声明;text 是这个元素自己的文本(实体已解码、CDATA 原样、不去空白),不含子元素的。
|
|
1184
|
+
export interface XMLNode {
|
|
1185
|
+
name: string;
|
|
1186
|
+
namespace?: string;
|
|
1187
|
+
attributes: Record<string, string>;
|
|
1188
|
+
text: string;
|
|
1189
|
+
children: XMLNode[];
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
// krillplayer.crypto.subtle 的参数里的字节:Uint8Array、别的 ArrayBuffer 视图、ArrayBuffer,或按 UTF-8 编码的字符串。
|
|
1193
|
+
export type CryptoBytes = Uint8Array | ArrayBufferView | ArrayBuffer | string;
|
|
1194
|
+
export type CryptoHashParameter = CryptoHash | { name: CryptoHash };
|
|
1195
|
+
|
|
1196
|
+
// 算法参数,与 WebCrypto 同名同义。名字不分大小写;只要名字的算法也可以只写名字的字符串。
|
|
1197
|
+
// RSA:generateKey 的 modulusLength 只收 1024、2048、3072、4096,publicExponent 只收 [1, 0, 1](65537)。
|
|
1198
|
+
export interface RsaHashedKeyGenParams { name: "RSASSA-PKCS1-v1_5" | "RSA-PSS" | "RSA-OAEP"; modulusLength: number; publicExponent: CryptoBytes; hash: CryptoHashParameter }
|
|
1199
|
+
export interface RsaHashedImportParams { name: "RSASSA-PKCS1-v1_5" | "RSA-PSS" | "RSA-OAEP"; hash: CryptoHashParameter }
|
|
1200
|
+
// saltLength 要等于哈希的输出长度(SHA-1 20、SHA-256 32、SHA-384 48、SHA-512 64)。
|
|
1201
|
+
export interface RsaPssParams { name: "RSA-PSS"; saltLength: number }
|
|
1202
|
+
// 不收 label(不给或给空的)。
|
|
1203
|
+
export interface RsaOaepParams { name: "RSA-OAEP"; label?: CryptoBytes }
|
|
1204
|
+
export interface EcKeyGenParams { name: "ECDSA" | "ECDH"; namedCurve: CryptoNamedCurve }
|
|
1205
|
+
export type EcKeyImportParams = EcKeyGenParams;
|
|
1206
|
+
// 签名是 r || s 定长拼接,不是 DER。
|
|
1207
|
+
export interface EcdsaParams { name: "ECDSA"; hash: CryptoHashParameter }
|
|
1208
|
+
// length 按位,不给时取哈希的块长(SHA-1 与 SHA-256 是 512,SHA-384 与 SHA-512 是 1024)。
|
|
1209
|
+
export interface HmacKeyGenParams { name: "HMAC"; hash: CryptoHashParameter; length?: number }
|
|
1210
|
+
export type HmacImportParams = HmacKeyGenParams;
|
|
1211
|
+
export interface AesKeyGenParams { name: "AES-CTR" | "AES-CBC" | "AES-GCM" | "AES-KW"; length: 128 | 192 | 256 }
|
|
1212
|
+
// counter 16 字节,length 是其中参与计数的低位数(1 到 128),计数器会绕回时失败。
|
|
1213
|
+
export interface AesCtrParams { name: "AES-CTR"; counter: CryptoBytes; length: number }
|
|
1214
|
+
// iv 16 字节,按 PKCS#7 补位。
|
|
1215
|
+
export interface AesCbcParams { name: "AES-CBC"; iv: CryptoBytes }
|
|
1216
|
+
// iv 只收 12 字节;tagLength 是 32、64、96、104、112、120、128 之一,不给是 128。密文后面接着标签。
|
|
1217
|
+
export interface AesGcmParams { name: "AES-GCM"; iv: CryptoBytes; additionalData?: CryptoBytes; tagLength?: number }
|
|
1218
|
+
export type CryptoAlgorithmName = CryptoAlgorithm | { name: CryptoAlgorithm };
|
|
1219
|
+
// ECDH 与 X25519:public 是对方的公钥,与自己的私钥同一种算法、同一条曲线。
|
|
1220
|
+
export interface EcdhKeyDeriveParams { name: "ECDH" | "X25519"; public: CryptoKey }
|
|
1221
|
+
// salt 与 info 都要给(可以是空的),各不超过 1024 字节。
|
|
1222
|
+
export interface HkdfParams { name: "HKDF"; hash: CryptoHashParameter; salt: CryptoBytes; info: CryptoBytes }
|
|
1223
|
+
// salt 不超过 1024 字节;iterations 乘输出的块数(按哈希长度算)不超过 2,000,000,这是 App 的上限,WebCrypto 没有。
|
|
1224
|
+
export interface Pbkdf2Params { name: "PBKDF2"; hash: CryptoHashParameter; salt: CryptoBytes; iterations: number }
|
|
1225
|
+
export type DeriveParams = EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params;
|
|
1226
|
+
// deriveKey 能派生出的密钥:AES(含 AES-KW)、HMAC、HKDF 与 PBKDF2。
|
|
1227
|
+
export type DerivedKeyParams = AesKeyGenParams | HmacKeyGenParams | "HKDF" | "PBKDF2" | { name: "HKDF" | "PBKDF2" };
|
|
1228
|
+
export type WrapParams = "AES-KW" | { name: "AES-KW" } | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams;
|
|
1229
|
+
|
|
1230
|
+
// exportKey("jwk") 的结果与 importKey("jwk", …) 收的 JWK(RFC 7517)。
|
|
1231
|
+
export interface JsonWebKey extends CryptoKeyMaterial {
|
|
1232
|
+
alg?: string;
|
|
1233
|
+
use?: string;
|
|
1234
|
+
ext?: boolean;
|
|
1235
|
+
key_ops?: string[];
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// 照 WebCrypto 的 SubtleCrypto,结果是 Uint8Array 而不是 ArrayBuffer(new Uint8Array(结果) 两边都能用)。
|
|
1239
|
+
// 格式:对称密钥 raw 与 jwk;RSA 公钥 spki 与 jwk、私钥 pkcs8 与 jwk;ECDSA、ECDH、Ed25519 与 X25519 的公钥另有 raw
|
|
1240
|
+
// (EC 只收不压缩的点);HKDF 与 PBKDF2 只能按 raw 导入,extractable 只能是 false。
|
|
1241
|
+
// importKey 的 spki 与 pkcs8 也收 PEM 文本(RFC 7468,WebCrypto 没有):只收一段,spki 的标签是 PUBLIC KEY、pkcs8 的是 PRIVATE KEY,
|
|
1242
|
+
// 正文可以折行,例如 importKey("spki", "-----BEGIN PUBLIC KEY-----\nMIIB…\n-----END PUBLIC KEY-----", { name: "RSA-OAEP", hash: "SHA-256" }, false, ["encrypt"])。
|
|
1243
|
+
// verify 签名对不上时返回 false,不抛错。deriveBits 的 length 是位数,ECDH 与 X25519 给 null 取整个共享密钥。
|
|
1244
|
+
// wrapKey 按 jwk 包时把 JWK 写成键排好的 JSON,AES-KW 用空格补到 8 字节的倍数;unwrapKey 照样解开。
|
|
1245
|
+
export interface KrillPlayerSubtle {
|
|
1246
|
+
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | "Ed25519" | { name: "Ed25519" } | "X25519" | { name: "X25519" }, extractable: boolean,
|
|
1247
|
+
usages: CryptoKeyUsage[]): Promise<CryptoKeyPair>;
|
|
1248
|
+
generateKey(algorithm: HmacKeyGenParams | AesKeyGenParams, extractable: boolean, usages: CryptoKeyUsage[]): Promise<CryptoKey>;
|
|
1249
|
+
importKey(format: CryptoKeyFormat, keyData: CryptoBytes | JsonWebKey,
|
|
1250
|
+
algorithm: RsaHashedImportParams | EcKeyImportParams | HmacImportParams | CryptoAlgorithmName,
|
|
1251
|
+
extractable: boolean, usages: CryptoKeyUsage[]): Promise<CryptoKey>;
|
|
1252
|
+
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
|
1253
|
+
exportKey(format: "raw" | "spki" | "pkcs8", key: CryptoKey): Promise<Uint8Array>;
|
|
1254
|
+
sign(algorithm: RsaPssParams | EcdsaParams | CryptoAlgorithmName, key: CryptoKey, data: CryptoBytes): Promise<Uint8Array>;
|
|
1255
|
+
verify(algorithm: RsaPssParams | EcdsaParams | CryptoAlgorithmName, key: CryptoKey, signature: CryptoBytes, data: CryptoBytes): Promise<boolean>;
|
|
1256
|
+
encrypt(algorithm: RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: CryptoBytes): Promise<Uint8Array>;
|
|
1257
|
+
decrypt(algorithm: RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: CryptoBytes): Promise<Uint8Array>;
|
|
1258
|
+
digest(algorithm: CryptoHashParameter, data: CryptoBytes): Promise<Uint8Array>;
|
|
1259
|
+
deriveBits(algorithm: DeriveParams, baseKey: CryptoKey, length: number | null): Promise<Uint8Array>;
|
|
1260
|
+
deriveKey(algorithm: DeriveParams, baseKey: CryptoKey, derivedKeyType: DerivedKeyParams, extractable: boolean, usages: CryptoKeyUsage[]): Promise<CryptoKey>;
|
|
1261
|
+
wrapKey(format: CryptoKeyFormat, key: CryptoKey, wrappingKey: CryptoKey, algorithm: WrapParams): Promise<Uint8Array>;
|
|
1262
|
+
unwrapKey(format: CryptoKeyFormat, wrappedKey: CryptoBytes, unwrappingKey: CryptoKey, algorithm: WrapParams,
|
|
1263
|
+
unwrappedKeyAlgorithm: RsaHashedImportParams | EcKeyImportParams | HmacImportParams | CryptoAlgorithmName,
|
|
1264
|
+
extractable: boolean, usages: CryptoKeyUsage[]): Promise<CryptoKey>;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
// 每个槽位函数的第一个参数。插件只能经它出网、存东西、读凭证与实例参数;除此之外只有 ECMAScript 的全局对象、
|
|
1268
|
+
// TextEncoder / TextDecoder(只支持 UTF-8)与 console(接到 log)。没有 fetch、setTimeout、URL、atob。
|
|
1269
|
+
export interface KrillPlayer {
|
|
1270
|
+
http: {
|
|
1271
|
+
request(request: KrillPlayerRequest): Promise<KrillPlayerResponse>;
|
|
1272
|
+
};
|
|
1273
|
+
// 解压后不超过 64 MB,超过就失败。
|
|
1274
|
+
decompress(format: "gzip" | "deflate" | "deflate-raw", data: Uint8Array): Promise<Uint8Array>;
|
|
1275
|
+
crypto: {
|
|
1276
|
+
randomBytes(length: number): Uint8Array;
|
|
1277
|
+
digest(algorithm: "sha-1" | "sha-256" | "sha-384" | "sha-512", data: Uint8Array | string): Promise<Uint8Array>;
|
|
1278
|
+
// WebCrypto 的 crypto.subtle:签名与验签、加解密、摘要,生成、导入与导出密钥,派生与包装密钥。报错文本以 krillplayer.crypto.subtle.<函数>: 开头并写明原因。
|
|
1279
|
+
subtle: KrillPlayerSubtle;
|
|
1280
|
+
};
|
|
1281
|
+
formats: {
|
|
1282
|
+
m3u(data: Uint8Array | string): Promise<M3UPlaylist>;
|
|
1283
|
+
rss(data: Uint8Array | string): RSSFeed;
|
|
1284
|
+
// 通用的 XML 解析(WebDAV 的 PROPFIND 应答这类没有专门解析器的格式):宽松地读,嵌套超过上限时抛错,没有根元素时抛错。
|
|
1285
|
+
xml(data: Uint8Array | string): XMLNode;
|
|
1286
|
+
// 节目单由宿主按 source.url 取回、解析并留着;插件只拿到所查频道在 [from, to) 里的节目。按看得到的频道分批查。
|
|
1287
|
+
xmltv: {
|
|
1288
|
+
channels(source: XMLTVSource): Promise<XMLTVChannel[]>;
|
|
1289
|
+
programmes(source: XMLTVSource, query: XMLTVQuery): Promise<XMLTVProgramme[]>;
|
|
1290
|
+
};
|
|
1291
|
+
};
|
|
1292
|
+
// 影视资料(TMDB 一类),目录插件用。试跑器不出网查资料,用例里写 metadata 列出每次查询回什么。
|
|
1293
|
+
metadata: {
|
|
1294
|
+
search(kind: WorkKind, query: string, options?: MetadataSearchOptions): Promise<Paged<Work>>;
|
|
1295
|
+
get(kind: WorkKind, ids: Ids): Promise<Work | null>;
|
|
1296
|
+
list(name: ListName, kind: WorkKind, options?: MetadataListOptions): Promise<Paged<Work>>;
|
|
1297
|
+
};
|
|
1298
|
+
// 来源实例里的文件:清单写了 files 才能用,状态槽位里调用会失败。path 相对来源实例的根,根是 "",分隔符是 /,
|
|
1299
|
+
// 开头不带 /,不接受 . 与 ..。找不到时抛出的错误是 notFound,没有权限是 loginRequired,连不上是 retryable:不接住它,内核就按这个种类处理。
|
|
1300
|
+
files: {
|
|
1301
|
+
// 一个目录下的一层。next 原样传回来取下一页。
|
|
1302
|
+
list(path: string, cursor?: string): Promise<Paged<FileEntry>>;
|
|
1303
|
+
stat(path: string): Promise<FileEntry>;
|
|
1304
|
+
// 从 offset 起读 length 字节,一次最多 4 MiB;读到文件末尾就短,过了末尾是空的。读字幕与信息文件用,不拿它读整个视频。
|
|
1305
|
+
read(path: string, offset: number, length: number): Promise<Uint8Array>;
|
|
1306
|
+
// 只有内核认识的地址,放进 PlayableStream.url 与字幕的 url。不查文件在不在。
|
|
1307
|
+
playable(path: string): string;
|
|
1308
|
+
};
|
|
1309
|
+
log(level: LogLevel, message: string): void;
|
|
1310
|
+
// 按插件与来源隔离的缓存,值是 JSON,ttlSeconds 必填。App 可能随时丢掉它。
|
|
1311
|
+
cache: {
|
|
1312
|
+
get(key: string): JSONValue;
|
|
1313
|
+
set(key: string, value: JSONValue, ttlSeconds: number): void;
|
|
1314
|
+
};
|
|
1315
|
+
// 按插件与来源实例隔离的持久存储,只存字符串:键不超过 256 字节,值不超过 64 KiB,一个插件合计不超过 1 MiB。
|
|
1316
|
+
// 状态槽位里调用会失败。
|
|
1317
|
+
storage: {
|
|
1318
|
+
get(key: string): string | null;
|
|
1319
|
+
set(key: string, value: string): void;
|
|
1320
|
+
delete(key: string): void;
|
|
1321
|
+
};
|
|
1322
|
+
// 本来源的登录凭证:凭证项名到字符串;没有或没授权时是 null。set 整组替换,expiresAt 是 Unix 秒。状态槽位不能 set。
|
|
1323
|
+
credentials: {
|
|
1324
|
+
get(): Record<string, string> | null;
|
|
1325
|
+
set(values: Record<string, string>, options?: { expiresAt?: number }): void;
|
|
1326
|
+
};
|
|
1327
|
+
// 本来源实例的参数(清单 parameters 声明的,含密钥),值都是字符串;没有实例时是 null。
|
|
1328
|
+
parameters: {
|
|
1329
|
+
get(): Record<string, string> | null;
|
|
1330
|
+
};
|
|
1331
|
+
// App 自己的密钥,按名字取:只有预装插件、只有清单 appKeys 写了的名字拿得到,没有这把密钥时是 null,
|
|
1332
|
+
// 插件跳过要它的那家服务。密钥从哪里来由内核定,插件不用管。状态槽位里调用会失败。
|
|
1333
|
+
appKeys: {
|
|
1334
|
+
get(name: string): Promise<string | null>;
|
|
1335
|
+
};
|
|
1336
|
+
// 按插件包里的词典翻自己起名的东西:词典的键是原文,同一句原文两处意思不同时给 context,键写成「原文|context」。
|
|
1337
|
+
// {名字} 是占位符,值从 values 里取,数字按界面语言格式化,缺值时原样留着;字面的花括号写成 {{ 与 }}。不做复数变形。
|
|
1338
|
+
i18n(text: string, values?: Record<string, string | number>, context?: string): string;
|
|
1339
|
+
// 当前界面语言加用户的地区,例如 zh-Hant-HK、en-GB。中文一定带文字体系。
|
|
1340
|
+
readonly locale: string;
|
|
1341
|
+
// 结构化错误:throw krillplayer.error("ended", "这个视频已被删除")。不是经它抛出的错误,宿主一律记为 { kind: "other" }。
|
|
1342
|
+
error(kind: PluginError["kind"], message?: string): Error;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
// 槽位的调用约定:导出名就是槽位名,每个函数的第一个参数是 krillplayer。槽位接口不生成,内核按名字调用。
|
|
1346
|
+
// 翻页一律用游标:函数收 cursor,返回 Paged<T>,next 有值就是还有下一页;第一页不传 cursor。翻页只往后翻。
|
|
1347
|
+
|
|
1348
|
+
// 浏览:通用域的来源实现这一组。values 是浏览参数的取值,按参数名传入,都是字符串。
|
|
1349
|
+
// channel 与 collection 返回对象本身加它下面的一页;条目必须已经按播放顺序排好,内核不重排。
|
|
1350
|
+
// schedule 一次查多个频道的节目单,返回按频道 id 分的排期。
|
|
1351
|
+
// search 是跨来源搜索里本来源的那一份:内核同时问每个导出了 search 的来源要第一页,结果按来源分组标明来源。
|
|
1352
|
+
export interface BrowseSlot {
|
|
1353
|
+
parameters?(krillplayer: KrillPlayer): Parameter[] | Promise<Parameter[]>;
|
|
1354
|
+
options?(krillplayer: KrillPlayer, name: string, values: Record<string, string>): Promise<Option[]>;
|
|
1355
|
+
list(krillplayer: KrillPlayer, values: Record<string, string>, cursor?: string): Promise<Paged<Entry>>;
|
|
1356
|
+
search?(krillplayer: KrillPlayer, query: string, cursor?: string): Promise<Paged<Entry>>;
|
|
1357
|
+
channel?(krillplayer: KrillPlayer, channelId: string, at?: At): Promise<ChannelPage>;
|
|
1358
|
+
collection?(krillplayer: KrillPlayer, collectionId: string, at?: At): Promise<CollectionPage>;
|
|
1359
|
+
schedule?(krillplayer: KrillPlayer, channelIds: string[], range: { start: number; end: number }): Promise<Record<string, ScheduleEntry[]>>;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
// 音乐曲库:曲库来源实现这一组。sections 是曲库首页的几块,每块一个种类;list 取一块的内容,
|
|
1363
|
+
// parameters 与 options 是这一块的排序与筛选。search 按种类分开问、分开翻页。歌手页的主体是专辑,热门歌曲可选;
|
|
1364
|
+
// 专辑页一次给全,歌已经按碟号与曲目号排好;歌单的歌按游标翻页。能起播的 id(歌曲)与 browse 给的不能重复。
|
|
1365
|
+
// 没有音乐内容的实例 sections 返回空数组。
|
|
1366
|
+
export interface MusicSlot {
|
|
1367
|
+
sections(krillplayer: KrillPlayer): MusicSection[] | Promise<MusicSection[]>;
|
|
1368
|
+
parameters?(krillplayer: KrillPlayer, section: string): Parameter[] | Promise<Parameter[]>;
|
|
1369
|
+
options?(krillplayer: KrillPlayer, section: string, name: string, values: Record<string, string>): Promise<Option[]>;
|
|
1370
|
+
list(krillplayer: KrillPlayer, section: string, values: Record<string, string>, cursor?: string): Promise<Paged<MusicEntry>>;
|
|
1371
|
+
search?(krillplayer: KrillPlayer, query: string, kind: MusicKind, cursor?: string): Promise<Paged<MusicEntry>>;
|
|
1372
|
+
artist?(krillplayer: KrillPlayer, artistId: string, cursor?: string): Promise<ArtistPage>;
|
|
1373
|
+
album?(krillplayer: KrillPlayer, albumId: string): Promise<AlbumPage>;
|
|
1374
|
+
playlist?(krillplayer: KrillPlayer, playlistId: string, cursor?: string): Promise<PlaylistPage>;
|
|
1375
|
+
lyrics?(krillplayer: KrillPlayer, songId: string): Promise<Lyrics | null>;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
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
|
+
// 资源插件:用户要看某部作品时内核同时问每个资源插件,返回的每一项是一个版本,之后用它的 id 调 play.start;
|
|
1393
|
+
// 不用造出季和剧集。没有就返回空数组,不抛错。内核给 find 的时限比别的调用短,超时当作没有。
|
|
1394
|
+
// 实现了 library 的来源不实现 find,否则同一份内容会出现两次。
|
|
1395
|
+
export interface ResourcesSlot {
|
|
1396
|
+
find(krillplayer: KrillPlayer, work: WorkQuery): Promise<ResourceVersion[]>;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
// 条目、版本都用自己的 id 起播;同一个来源实例里能起播的 id 不重复。
|
|
1400
|
+
export interface PlaySlot {
|
|
1401
|
+
start(krillplayer: KrillPlayer, itemId: string): Promise<Playable>;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
// 认链接:顶层导出的一个函数,不属于哪个槽位。链接属于本来源时返回它指向的东西,不属于时返回 null。
|
|
1405
|
+
export type ResolveFunction = (krillplayer: KrillPlayer, url: string) => Promise<Resolved | null>; // App 尚未使用
|
|
1406
|
+
|
|
1407
|
+
// 顶层导出的 parameters:实例参数与设置项里 dynamicOptions 的选项向它要。不算能力。
|
|
1408
|
+
export interface ParametersExport {
|
|
1409
|
+
options(krillplayer: KrillPlayer, name: string, values: Record<string, string>): Promise<Option[]>;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
// 一批频道一次调用;节拍、限流退避与分批由宿主负责,插件只报信号。内核只对创作者做开播轮询,台不轮询。
|
|
1413
|
+
// images 可选:一批频道的头像,查不到的频道不列。内核只为订阅里还没有头像的频道调它,与 check 分开、单独计时,
|
|
1414
|
+
// 这一批 check 有频道被限流时不调,后台刷新不调。头像能从 check 已有的应答里顺带拿到的来源也走这里。
|
|
1415
|
+
export interface StatusSlot {
|
|
1416
|
+
check(krillplayer: KrillPlayer, channelIds: string[]): Promise<ChannelStatus[]>;
|
|
1417
|
+
images?(krillplayer: KrillPlayer, channelIds: string[]): Promise<ChannelImage[]>;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
// 登录槽位。凭证一律经 krillplayer.credentials.set 写入,过期时间随写入一起报;
|
|
1421
|
+
// 报了过期时间又导出 renew 的,内核在过期前调 renew。qrCode 与 poll 只在声明了扫码时需要,要一起导出。
|
|
1422
|
+
export interface LoginSlot {
|
|
1423
|
+
methods(krillplayer: KrillPlayer): LoginMethod[] | Promise<LoginMethod[]>;
|
|
1424
|
+
qrCode?(krillplayer: KrillPlayer): Promise<LoginQRCode>;
|
|
1425
|
+
poll?(krillplayer: KrillPlayer, key: string): Promise<LoginPoll>;
|
|
1426
|
+
account?(krillplayer: KrillPlayer): Promise<LoginAccount | null>;
|
|
1427
|
+
renew?(krillplayer: KrillPlayer): Promise<void>;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
// 弹幕槽位。connect 给直播弹幕的连接规格,resume 是上一次 decode 给的续接令牌(没有时为 null);
|
|
1431
|
+
// decode 一次解一帧,插件不持有连接、不计时、不重连。connect 与 decode 要一起导出。itemId 是直播条目 id。
|
|
1432
|
+
// segment 是点播弹幕:给出覆盖条目里 position 秒的那一段;内核按播放位置决定何时要哪一段、何时上屏。
|
|
1433
|
+
// match 与 comments 是弹幕插件,对任何来源的视频:match 按 media 给候选(没有时给空数组),内核取第一个、用户可以改选;
|
|
1434
|
+
// comments 按候选的 id 给覆盖 position 秒的那一段,规则同 segment。match 与 comments 要一起导出。
|
|
1435
|
+
// send 在直播间 itemId 里用本来源的登录凭证发一条弹幕 text,发出去了就正常返回,没有返回值;自己发的那条内核已经上屏,
|
|
1436
|
+
// 之后连接里推回来的同一条由内核去掉。被拒绝时抛 krillplayer.error:没登录或登录失效 loginRequired、被禁言 muted、
|
|
1437
|
+
// 发得太快 rateLimited、内容不让发 contentRejected,别的原因 other,message 是来源给的说明(内核原样显示)。
|
|
1438
|
+
// 内核不自动重发,同一条内容不连发,两次发送之间留几秒;插件也不要替用户重发。
|
|
1439
|
+
export interface DanmakuSlot {
|
|
1440
|
+
connect?(krillplayer: KrillPlayer, itemId: string, resume: string | null): Promise<LiveDanmakuConnection>;
|
|
1441
|
+
decode?(krillplayer: KrillPlayer, frame: DanmakuFrame): DanmakuBatch | Promise<DanmakuBatch>;
|
|
1442
|
+
segment?(krillplayer: KrillPlayer, itemId: string, position: number): Promise<DanmakuSegment>;
|
|
1443
|
+
match?(krillplayer: KrillPlayer, media: MediaQuery): Promise<DanmakuMatch[]>;
|
|
1444
|
+
comments?(krillplayer: KrillPlayer, matchId: string, position: number): Promise<DanmakuSegment>;
|
|
1445
|
+
send?(krillplayer: KrillPlayer, itemId: string, text: string): Promise<void>;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
// 播放回报槽位(可选):插件把这次播放报给来源。失败不影响播放,内核不重试。
|
|
1449
|
+
export interface PlaybackReportSlot {
|
|
1450
|
+
report(krillplayer: KrillPlayer, report: PlaybackReport): Promise<void>;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
// 字幕槽位。list 是来源自带的外挂字幕:给这个条目可选的字幕轨(没有时给空数组),fetch 取其中一条时
|
|
1454
|
+
// 内核同时给回那个条目的 id。search 是字幕插件,对任何来源的视频:按 media 给候选(没有时给空数组),fetch 取其中一条时
|
|
1455
|
+
// 不给条目 id。list 与 search 至少导出一个;只导出 search 的打出 subtitleSearch,不当成自带字幕的来源。
|
|
1456
|
+
// 内核在用户选中一条时才调 fetch;音轨与媒体里内嵌的字幕由内核从播放器读,不经插件。
|
|
1457
|
+
export interface SubtitlesSlot {
|
|
1458
|
+
list?(krillplayer: KrillPlayer, itemId: string): Promise<SubtitleTrack[]>;
|
|
1459
|
+
search?(krillplayer: KrillPlayer, media: MediaQuery): Promise<SubtitleTrack[]>;
|
|
1460
|
+
fetch(krillplayer: KrillPlayer, trackId: string, itemId?: string): Promise<Subtitle>;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
// views 槽位。values 里的值都是字符串;cursor 是上一页给的 next,第一页不给;
|
|
1464
|
+
// components 是内核的组件库版本(COMPONENT_LIBRARY.version)。
|
|
1465
|
+
// page 的 "home" 是来源首页,其余页面 id 由插件自己定、经 PageLink 引用。panel 与 action 的 id 来自清单的贡献点声明,
|
|
1466
|
+
// item 与 channel 是来源内 id。
|
|
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 }
|
|
1470
|
+
|
|
1471
|
+
export interface ViewsSlot {
|
|
1472
|
+
page(krillplayer: KrillPlayer, request: PageRequest): Promise<ComponentPage>;
|
|
1473
|
+
panel?(krillplayer: KrillPlayer, request: PanelRequest): Promise<ComponentPage>;
|
|
1474
|
+
action?(krillplayer: KrillPlayer, request: ActionRequest): Promise<ActionResult>;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
// 插件里除 ECMAScript 的全局对象以外只有这几样;没有 fetch、setTimeout、URL、atob。
|
|
1478
|
+
declare global {
|
|
1479
|
+
interface TextEncoder { readonly encoding: "utf-8"; encode(input?: string): Uint8Array }
|
|
1480
|
+
var TextEncoder: { new (): TextEncoder };
|
|
1481
|
+
// App 里只支持 UTF-8。
|
|
1482
|
+
interface TextDecoder { readonly encoding: string; decode(input?: Uint8Array | ArrayBuffer, options?: { stream?: boolean }): string }
|
|
1483
|
+
var TextDecoder: { new (label?: "utf-8" | "utf8", options?: { fatal?: boolean; ignoreBOM?: boolean }): TextDecoder };
|
|
1484
|
+
// 接到 krillplayer.log:log 与 info 记为 info,trace 与 debug 记为 debug。
|
|
1485
|
+
var console: { [level in "debug" | "trace" | "log" | "info" | "warn" | "error"]: (...data: unknown[]) => void };
|
|
1486
|
+
}
|