操作权限速查
适用读者 编写操作 Hook 或调用工具的作者。前置条件 已运行播放规则模板。学习目标 查清拦截、观察和主动调用各自的权限。预计 6 分钟。
在插件的 manifest.uses.permissions 声明表中的权限,用户授权后才可使用相应接口。拦截使用 ctx.hooks.on,完成事件使用 ctx.events.on(在操作名末尾加 :done)。可主动调用的操作见最后一列,传给 ctx.app.call 的 permissionKey 是项目给权限声明选的键。表中「宿主入口」表示该项由宿主场景触发。
时限是每个处理器的执行预算。对能调用 next 的处理器,等待下游执行的时间另计。输入满足 TypeScript 类型后,仍需满足每项操作的限制,例如删除歌单不能把目标换成其他歌单,歌词不能改变所属歌曲。
| 操作 | 拦截权限 | 完成事件权限 | 可取消 | 处理器时限 | 主动调用权限 |
|---|---|---|---|---|---|
player.play | player.intercept | player.read | 是 | 800 ms | player.control |
queue.add | player.intercept | player.read | 是 | 800 ms | player.control |
queue.remove | player.intercept | player.read | 是 | 800 ms | player.control |
queue.clear | player.intercept | player.read | 是 | 800 ms | player.control |
queue.shuffle | player.intercept | player.read | 否 | 800 ms | 宿主入口 |
player.pause | player.intercept | player.read | 是 | 800 ms | player.control |
player.resume | player.intercept | player.read | 是 | 800 ms | player.control |
player.previous | player.intercept | player.read | 是 | 800 ms | player.control |
player.next | player.intercept | player.read | 是 | 800 ms | player.control |
player.error | player.intercept | player.read | 是 | 800 ms | 宿主入口 |
player.queueEnded | player.intercept | player.read | 是 | 800 ms | 宿主入口 |
player.setMode | player.intercept | player.read | 是 | 800 ms | player.control |
player.seek | player.intercept | player.read | 否 | 800 ms | player.control |
player.setVolume | player.intercept | player.read | 否 | 800 ms | player.control |
player.resolve | player.intercept | player.read | 否 | 800 ms | 宿主入口 |
account.switch | account.intercept | account.profile | 是 | 3000 ms | 宿主入口 |
search.query | search.intercept | search.read | 是 | 800 ms | 宿主入口 |
search.suggest | search.intercept | search.read | 否 | 800 ms | 宿主入口 |
search.results | search.intercept | search.read | 否 | 800 ms | 宿主入口 |
track.like | library.intercept | library.read | 是 | 800 ms | library.write |
playlist.create | library.intercept | library.read | 是 | 3000 ms | library.write |
playlist.delete | library.intercept | library.read | 是 | 3000 ms | library.delete |
playlist.addTracks | library.intercept | library.read | 是 | 3000 ms | library.write |
playlist.removeTracks | library.intercept | library.read | 是 | 3000 ms | library.delete |
playlist.export | library.intercept | library.read | 是 | 3000 ms | library.read |
playlist.import | library.intercept | library.read | 是 | 3000 ms | library.write |
window.close | window.intercept | window.read | 是 | 800 ms | window.control |
lyrics.load | lyrics.intercept | player.read | 否 | 3000 ms | 宿主入口 |
lyrics.transform | lyrics.intercept | player.read | 否 | 3000 ms | 宿主入口 |
download.create | downloads.intercept | downloads.manage | 是 | 3000 ms | downloads.create |
download.filename | downloads.intercept | downloads.manage | 否 | 3000 ms | 宿主入口 |
share.create | sharing.intercept | music.read | 是 | 3000 ms | sharing.publish |
link.open | links.intercept | links.read | 是 | 3000 ms | external.open |
notification.show | notifications.intercept | notifications.read | 是 | 3000 ms | 无需额外权限 |
输入和结果的完整 JSON Schema 见 3.0.0 操作目录。实际宿主是否触发还取决于版本和具体调用入口。第一次写处理器按实战教程练习。
查询每个操作的输入与结果
展开操作名,查看当前版本对应的输入和返回约束。required 中的字段必填,enum 列出允许值,minimum、maximum 等字段给出边界。输入属于本次操作;涉及私有曲目时请保留本轮句柄。只由宿主触发的操作也可以用下面的 schema 编写 Hook 测试。
player.play 播放指定歌曲
输入
{
"type": "object",
"properties": {
"track": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"queueIndex": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"track"
],
"additionalProperties": false
}返回
{
"type": "null"
}queue.add 添加歌曲到播放队列
输入
{
"type": "object",
"properties": {
"tracks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"maxItems": 1000,
"minItems": 1
},
"position": {
"type": "string",
"enum": [
"next",
"end"
]
}
},
"required": [
"tracks",
"position"
],
"additionalProperties": false
}返回
{
"type": "null"
}queue.remove 从播放队列移除歌曲
输入
{
"type": "object",
"properties": {
"tracks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"maxItems": 1000
}
},
"required": [
"tracks"
],
"additionalProperties": false
}返回
{
"type": "null"
}queue.clear 清空播放队列
输入
{
"type": "object",
"properties": {
"tracks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"maxItems": 1000
}
},
"required": [],
"additionalProperties": false
}返回
{
"type": "null"
}queue.shuffle
输入
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"maxItems": 1000
}
},
"required": [
"items"
],
"additionalProperties": false
}返回
{
"type": "null"
}player.pause 暂停播放
输入
{
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}返回
{
"type": "null"
}player.resume 继续播放
输入
{
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}返回
{
"type": "null"
}player.previous 播放上一首
输入
{
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}返回
{
"type": "null"
}player.next 播放下一首
输入
{
"type": "object",
"properties": {
"reason": {
"type": "string",
"enum": [
"user",
"ended",
"error"
]
},
"track": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
}
},
"required": [
"reason"
],
"additionalProperties": false
}返回
{
"type": "null"
}player.error
输入
{
"type": "object",
"properties": {
"track": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"error": {
"type": "string",
"enum": [
"resolve",
"start",
"media",
"playback"
]
}
},
"required": [
"track",
"error"
],
"additionalProperties": false
}返回
{
"type": "null"
}player.queueEnded
输入
{
"type": "object",
"properties": {
"tracks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"maxItems": 1000
}
},
"required": [],
"additionalProperties": false
}返回
{
"type": "null"
}player.setMode 设置播放模式
输入
{
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"sequence",
"single",
"random"
]
}
},
"required": [
"mode"
],
"additionalProperties": false
}返回
{
"type": "null"
}player.seek 跳转到指定毫秒位置
输入
{
"type": "object",
"properties": {
"positionMs": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"positionMs"
],
"additionalProperties": false
}返回
{
"type": "null"
}player.setVolume 设置音量
输入
{
"type": "object",
"properties": {
"volume": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"volume"
],
"additionalProperties": false
}返回
{
"type": "null"
}player.resolve
输入
{
"type": "object",
"properties": {
"track": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"quality": {
"type": "string",
"minLength": 0,
"maxLength": 64,
"pattern": "^[\\w.-]*$"
}
},
"required": [
"track",
"quality"
],
"additionalProperties": false
}返回
{
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
},
"required": [
"ok"
],
"additionalProperties": false
}account.switch
输入
{
"type": "object",
"properties": {
"pluginId": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"accountId": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"fromConnectionId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 128
},
{
"type": "null"
}
]
},
"connectionId": {
"type": "string",
"minLength": 1,
"maxLength": 128
}
},
"required": [
"pluginId",
"accountId",
"fromConnectionId",
"connectionId"
],
"additionalProperties": false
}返回
{
"type": "null"
}search.query
输入
{
"type": "object",
"properties": {
"query": {
"type": "string",
"minLength": 1,
"maxLength": 4096
},
"sourceId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[\\w.-]+$"
},
"kinds": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 64
},
"maxItems": 32,
"minItems": 1
}
},
"required": [
"query",
"sourceId",
"kinds"
],
"additionalProperties": false
}返回
{
"type": "null"
}search.suggest
输入
{
"type": "object",
"properties": {
"query": {
"type": "string",
"minLength": 1,
"maxLength": 4096
},
"items": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"maxItems": 100
}
},
"required": [
"query",
"items"
],
"additionalProperties": false
}返回
{
"type": "null"
}search.results
输入
{
"type": "object",
"properties": {
"query": {
"type": "string",
"minLength": 1,
"maxLength": 4096
},
"sourceId": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"page": {
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"track",
"playlist"
]
},
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": [
"track",
"playlist"
]
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 256
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"subtitle": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title"
],
"additionalProperties": false
},
"maxItems": 500
}
},
"required": [
"kind",
"items"
],
"additionalProperties": false
}
},
"required": [
"query",
"sourceId",
"page"
],
"additionalProperties": false
}返回
{
"type": "null"
}track.like 设置歌曲的收藏状态
输入
{
"type": "object",
"properties": {
"track": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"liked": {
"type": "boolean"
}
},
"required": [
"track",
"liked"
],
"additionalProperties": false
}返回
{
"type": "null"
}playlist.create 创建歌单
输入
{
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"location": {
"type": "string",
"enum": [
"local",
"cloud"
]
}
},
"required": [
"name",
"location"
],
"additionalProperties": false
}返回
{
"type": "null"
}playlist.delete 删除歌单
输入
{
"type": "object",
"properties": {
"playlist": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"location": {
"type": "string",
"enum": [
"local",
"cloud",
"both"
]
}
},
"required": [
"id",
"name",
"location"
],
"additionalProperties": false
}
},
"required": [
"playlist"
],
"additionalProperties": false
}返回
{
"type": "null"
}playlist.addTracks 添加歌曲到歌单
输入
{
"type": "object",
"properties": {
"playlist": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"location": {
"type": "string",
"enum": [
"local",
"cloud",
"both"
]
}
},
"required": [
"id",
"name",
"location"
],
"additionalProperties": false
},
"tracks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"maxItems": 1000
}
},
"required": [
"playlist",
"tracks"
],
"additionalProperties": false
}返回
{
"type": "null"
}playlist.removeTracks 从歌单移除歌曲
输入
{
"type": "object",
"properties": {
"playlist": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"location": {
"type": "string",
"enum": [
"local",
"cloud",
"both"
]
}
},
"required": [
"id",
"name",
"location"
],
"additionalProperties": false
},
"tracks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"maxItems": 1000
}
},
"required": [
"playlist",
"tracks"
],
"additionalProperties": false
}返回
{
"type": "null"
}playlist.export 导出歌单
输入
{
"type": "object",
"properties": {
"playlist": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 256
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 512
},
"location": {
"type": "string",
"enum": [
"local",
"cloud",
"both"
]
}
},
"required": [
"id",
"name",
"location"
],
"additionalProperties": false
},
"format": {
"type": "string",
"enum": [
"cmpl",
"cpl"
]
}
},
"required": [
"playlist",
"format"
],
"additionalProperties": false
}返回
{
"type": "null"
}playlist.import 导入歌单
输入
{
"type": "object",
"properties": {
"value": {
"type": "string",
"minLength": 1,
"maxLength": 4096
},
"importerId": {
"type": "string",
"minLength": 3,
"maxLength": 257,
"pattern": "^[\\w.-]{1,128}:[\\w.-]{1,128}$"
}
},
"required": [
"value"
],
"additionalProperties": false
}返回
{
"type": "null"
}window.close 按用户设置关闭主窗口
输入
{
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
}返回
{
"type": "null"
}lyrics.load
输入
{
"type": "object",
"properties": {
"track": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
}
},
"required": [
"track"
],
"additionalProperties": false
}返回
{
"anyOf": [
{
"type": "object",
"properties": {
"format": {
"const": "crlyric"
},
"version": {
"const": 1
},
"track": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"offsetMs": {
"type": "number"
},
"plainText": {
"type": "string",
"minLength": 0,
"maxLength": 1048576
},
"lines": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"language": {
"type": "string",
"minLength": 0,
"maxLength": 128
},
"words": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
}
},
"required": [
"startTimeMs",
"endTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 10000
}
},
"required": [
"text"
],
"additionalProperties": false
},
"maxItems": 16
},
"romanizations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"language": {
"type": "string",
"minLength": 0,
"maxLength": 128
},
"words": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
}
},
"required": [
"startTimeMs",
"endTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 10000
}
},
"required": [
"text"
],
"additionalProperties": false
},
"maxItems": 16
},
"words": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
}
},
"required": [
"startTimeMs",
"endTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 10000
},
"isBackground": {
"type": "boolean"
},
"isDuet": {
"type": "boolean"
}
},
"required": [
"startTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 20000
}
},
"required": [
"format",
"version",
"track",
"offsetMs",
"lines"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}lyrics.transform
输入
{
"type": "object",
"properties": {
"track": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"lyric": {
"anyOf": [
{
"type": "object",
"properties": {
"format": {
"const": "crlyric"
},
"version": {
"const": 1
},
"track": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"offsetMs": {
"type": "number"
},
"plainText": {
"type": "string",
"minLength": 0,
"maxLength": 1048576
},
"lines": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"language": {
"type": "string",
"minLength": 0,
"maxLength": 128
},
"words": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
}
},
"required": [
"startTimeMs",
"endTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 10000
}
},
"required": [
"text"
],
"additionalProperties": false
},
"maxItems": 16
},
"romanizations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"language": {
"type": "string",
"minLength": 0,
"maxLength": 128
},
"words": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
}
},
"required": [
"startTimeMs",
"endTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 10000
}
},
"required": [
"text"
],
"additionalProperties": false
},
"maxItems": 16
},
"words": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
}
},
"required": [
"startTimeMs",
"endTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 10000
},
"isBackground": {
"type": "boolean"
},
"isDuet": {
"type": "boolean"
}
},
"required": [
"startTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 20000
}
},
"required": [
"format",
"version",
"track",
"offsetMs",
"lines"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"track",
"lyric"
],
"additionalProperties": false
}返回
{
"anyOf": [
{
"type": "object",
"properties": {
"format": {
"const": "crlyric"
},
"version": {
"const": 1
},
"track": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"offsetMs": {
"type": "number"
},
"plainText": {
"type": "string",
"minLength": 0,
"maxLength": 1048576
},
"lines": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"language": {
"type": "string",
"minLength": 0,
"maxLength": 128
},
"words": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
}
},
"required": [
"startTimeMs",
"endTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 10000
}
},
"required": [
"text"
],
"additionalProperties": false
},
"maxItems": 16
},
"romanizations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"language": {
"type": "string",
"minLength": 0,
"maxLength": 128
},
"words": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
}
},
"required": [
"startTimeMs",
"endTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 10000
}
},
"required": [
"text"
],
"additionalProperties": false
},
"maxItems": 16
},
"words": {
"type": "array",
"items": {
"type": "object",
"properties": {
"startTimeMs": {
"type": "number",
"minimum": 0
},
"endTimeMs": {
"type": "number",
"minimum": 0
},
"text": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"translation": {
"type": "string",
"minLength": 0,
"maxLength": 65536
},
"romanization": {
"type": "string",
"minLength": 0,
"maxLength": 65536
}
},
"required": [
"startTimeMs",
"endTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 10000
},
"isBackground": {
"type": "boolean"
},
"isDuet": {
"type": "boolean"
}
},
"required": [
"startTimeMs",
"text"
],
"additionalProperties": false
},
"maxItems": 20000
}
},
"required": [
"format",
"version",
"track",
"offsetMs",
"lines"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}download.create 创建歌曲下载任务
输入
{
"type": "object",
"properties": {
"tracks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"maxItems": 1000
},
"quality": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"pattern": "^[\\w.-]+$"
},
"directory": {
"type": "string",
"pattern": "^[a-f0-9-]{36}$"
}
},
"required": [
"tracks",
"quality"
],
"additionalProperties": false
}返回
{
"type": "null"
}download.filename
输入
{
"type": "object",
"properties": {
"track": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 255
}
},
"required": [
"track",
"name"
],
"additionalProperties": false
}返回
{
"type": "null"
}share.create 生成歌曲分享链接
输入
{
"type": "object",
"properties": {
"track": {
"type": "object",
"properties": {
"ref": {
"type": "object",
"properties": {
"kind": {
"const": "track"
},
"providerId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9._-]+$"
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 512
}
},
"required": [
"kind",
"providerId",
"id"
],
"additionalProperties": false
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"metadata": {
"type": "object",
"properties": {
"artists": {
"type": "array",
"items": {
"type": "string",
"minLength": 0,
"maxLength": 256
},
"maxItems": 32
}
},
"required": [
"artists"
],
"additionalProperties": false
}
},
"required": [
"ref",
"title",
"metadata"
],
"additionalProperties": false
}
},
"required": [
"track"
],
"additionalProperties": false
}返回
{
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 4096
},
"url": {
"type": "string",
"minLength": 1,
"maxLength": 8192,
"format": "uri"
},
"template": {
"type": "string",
"minLength": 0,
"maxLength": 16384
}
},
"required": [
"id",
"url"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}link.open 处理公开链接
输入
{
"type": "object",
"properties": {
"url": {
"type": "string",
"minLength": 1,
"maxLength": 8192,
"format": "uri"
},
"from": {
"type": "string",
"enum": [
"paste",
"drop",
"deeplink"
]
}
},
"required": [
"url",
"from"
],
"additionalProperties": false
}返回
{
"type": "null"
}notification.show 显示软件内文字提示
输入
{
"type": "object",
"properties": {
"title": {
"type": "string",
"minLength": 0,
"maxLength": 512
},
"body": {
"type": "string",
"minLength": 0,
"maxLength": 8192
},
"level": {
"type": "string",
"enum": [
"info",
"success",
"warning",
"error"
]
}
},
"required": [
"title",
"body",
"level"
],
"additionalProperties": false
}返回
{
"type": "null"
}实际读一行:拖动播放进度
在表中找到 player.seek。拦截权限决定能否处理用户拖动,完成事件权限决定能否观察最终结果,主动调用权限决定按钮能否发起一次跳转。“可取消”列为“否”,作者可以校正输入中的 positionMs,不能用取消点播的办法阻止拖动。800 ms 是该处理器的预算,把网络查询放到拖动发生以前。
若只想让用户按按钮跳到第十秒,在API 教程按 player.control 实现;若要处理用户从其他入口发起的拖动,先在Hook 模板写授权与撤权场景。两条路径用同一首长于十秒的本地音频复验。