@@ -122,6 +122,31 @@ export interface SongDownloadResult {
122122 error ?: string ;
123123}
124124
125+ /** 创建远程歌曲的输入 */
126+ export interface CreateSongInput {
127+ url ?: string ;
128+ title : string ;
129+ artist ?: string ;
130+ album ?: string ;
131+ coverUrl ?: string ;
132+ duration ?: number ;
133+ sourceData ?: string ;
134+ dedupKey ?: string ;
135+ lyric ?: string ;
136+ lyricSource ?: string ;
137+ lyricRemoteUrl ?: string ;
138+ }
139+
140+ /** 更新歌曲的可选字段 */
141+ export interface UpdateSongFields {
142+ title ?: string ;
143+ artist ?: string ;
144+ album ?: string ;
145+ url ?: string ;
146+ coverUrl ?: string ;
147+ duration ?: number ;
148+ }
149+
125150export interface SongloftSongs {
126151 list ( options ?: { limit ?: number ; offset ?: number } ) : Promise < Song [ ] > ;
127152 getById ( id : number ) : Promise < Song | null > ;
@@ -131,6 +156,33 @@ export interface SongloftSongs {
131156 path_template ?: string ;
132157 embed_metadata ?: boolean ;
133158 } ) : Promise < SongDownloadResult > ;
159+ /** 批量创建远程歌曲(自动关联到当前插件) */
160+ create ( songs : CreateSongInput [ ] ) : Promise < Song [ ] > ;
161+ /** 更新歌曲元数据(仅更新传入的字段) */
162+ update ( id : number , fields : UpdateSongFields ) : Promise < Song > ;
163+ /** 删除歌曲(含封面和缓存清理) */
164+ delete ( id : number ) : Promise < void > ;
165+ }
166+
167+ /** 创建歌单的输入 */
168+ export interface CreatePlaylistInput {
169+ name : string ;
170+ type ?: 'normal' | 'radio' ;
171+ description ?: string ;
172+ coverUrl ?: string ;
173+ }
174+
175+ /** 更新歌单的可选字段 */
176+ export interface UpdatePlaylistFields {
177+ name ?: string ;
178+ description ?: string ;
179+ coverUrl ?: string ;
180+ }
181+
182+ /** addSongs 的返回结果 */
183+ export interface AddSongsResult {
184+ added : number ;
185+ skipped : number ;
134186}
135187
136188export interface SongloftPlaylists {
@@ -141,6 +193,20 @@ export interface SongloftPlaylists {
141193 * 不传 options 时返回最多 100000 条。
142194 */
143195 getSongs ( playlistId : number , options ?: { limit ?: number ; offset ?: number } ) : Promise < Song [ ] > ;
196+ /** 搜索歌单(按名称关键词) */
197+ search ( query : string , options ?: { limit ?: number ; offset ?: number } ) : Promise < Playlist [ ] > ;
198+ /** 创建歌单 */
199+ create ( playlist : CreatePlaylistInput ) : Promise < Playlist > ;
200+ /** 更新歌单(仅更新传入的字段;内置歌单只允许更新封面) */
201+ update ( id : number , fields : UpdatePlaylistFields ) : Promise < Playlist > ;
202+ /** 删除歌单(内置歌单不可删除) */
203+ delete ( id : number ) : Promise < void > ;
204+ /** 批量添加歌曲到歌单(类型不兼容或已存在的歌曲计入 skipped) */
205+ addSongs ( playlistId : number , songIds : number [ ] ) : Promise < AddSongsResult > ;
206+ /** 批量移除歌单中的歌曲 */
207+ removeSongs ( playlistId : number , songIds : number [ ] ) : Promise < void > ;
208+ /** 重排序歌单中的歌曲(songIds 长度必须等于歌单内现有歌曲数) */
209+ reorder ( playlistId : number , songIds : number [ ] ) : Promise < void > ;
144210}
145211
146212export interface SongloftComm {
0 commit comments