@shiqianjiang/ceru-plugin-sdk 0.3.13 → 0.3.14

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +35 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -130,10 +130,45 @@ export type ResolveResult = {
130
130
  ok: false;
131
131
  error: MusicFault;
132
132
  };
133
+ /**
134
+ * 高清封面协议(可选)。
135
+ *
136
+ * 存在的意义:系统媒体控件(Windows SMTC / Linux MPRIS / macOS NowPlaying)
137
+ * 按整卡尺寸(约 1000px)显示封面,而平台音源在搜索/歌单阶段给出的
138
+ * `artworkUrl` 往往是缩略图(如 QQ 500、酷狗 240、酷我 500、网易云默认)。
139
+ * 把这层「按歌曲拿到尽可能高清封面」的能力开放给插件——插件最清楚自家
140
+ * CDN 的尺寸参数规则,可据此直接改写 URL 或另行请求,而宿主无需了解各平台差异。
141
+ *
142
+ * 可选性:插件**不实现**本方法即为不支持,宿主必须静默回落到原有 `artwork`
143
+ * 封面。实现时若无法给出更清晰的图,返回 `undefined` 或原样返回入参即可,
144
+ * 宿主会自行判定是否采纳(不会因为返回低清/相同地址而报错)。
145
+ */
146
+ export interface ArtworkHiresRequest {
147
+ /**
148
+ * 完整歌曲信息(宿主透传,字段随平台而异,常见 `img`/`albumId`/`songmid`/
149
+ * `hash` 等)。插件可直接用它已有的 `img` 做尺寸转换,也可据此发起新请求。
150
+ */
151
+ song: JsonObject;
152
+ /**
153
+ * 宿主当前已持有的封面地址(多为平台缩略图,也可能是 blob:/data: URL)。
154
+ * 插件可据此改写尺寸参数;若它不可用则由 `song` 重新生成更合适的地址。
155
+ */
156
+ artworkUrl?: string;
157
+ /**
158
+ * 期望的长边像素提示。**不限定画质**——插件可按平台能力自由上调/下调或忽略,
159
+ * 最终以插件返回的地址为准。
160
+ */
161
+ targetSize?: number;
162
+ }
133
163
  export interface TrackProvider {
134
164
  search?(request: SearchRequest, operation: OperationContext): Promise<Page<ContentEntity>>;
135
165
  resolve?(resource: ResourceRef, quality: string | undefined, operation: OperationContext): Promise<ResolveResult>;
136
166
  lyrics?(resource: ResourceRef, operation: OperationContext): Promise<LyricsDocument>;
167
+ /**
168
+ * 高清封面协议(可选)。返回一张尽可能高清的封面 URL;
169
+ * 无法提供时返回 `undefined`(宿主回落原封面)。
170
+ */
171
+ artworkHires?(resource: ResourceRef, request: ArtworkHiresRequest, operation: OperationContext): Promise<string | undefined>;
137
172
  }
138
173
  export interface PlaylistProvider {
139
174
  search?(request: SearchRequest, operation: OperationContext): Promise<Page<ContentEntity>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shiqianjiang/ceru-plugin-sdk",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "description": "Typed authoring contracts for Ceru Music v2 single-file plugins",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",