1declare namespace IMusic { 2 export interface IMusicItemBase extends ICommon.IMediaBase { 3 /** 其他属性 */ 4 [k: keyof IMusicItem]: IMusicItem[k]; 5 } 6 7 /** 音质 */ 8 export type IQualityKey = 'low' | 'standard' | 'high' | 'super'; 9 export type IQuality = Record< 10 IQualityKey, 11 { 12 url?: string; 13 size?: string | number; 14 } 15 >; 16 17 // 音源定义 18 export interface IMediaSource { 19 headers?: Record<string, string>; 20 /** 兜底播放 */ 21 url?: string; 22 /** UA */ 23 userAgent?: string; 24 /** 音质 */ 25 quality?: IMusic.IQualityKey; 26 /** 大小 */ 27 size?: number; 28 } 29 30 export interface IMusicItem { 31 /** 歌曲在平台的唯一编号 */ 32 id: string; 33 /** 平台 */ 34 platform: string; 35 /** 作者 */ 36 artist: string; 37 /** 标题 */ 38 title: string; 39 /** 时长(s) */ 40 duration: number; 41 /** 专辑名 */ 42 album: string; 43 /** 专辑封面图 */ 44 artwork: string; 45 /** 默认音源 */ 46 url?: string; 47 /** 音源 */ 48 source?: Partial<Record<IQualityKey, IMediaSource>>; 49 /** 歌词 */ 50 lyric?: ILyric.ILyricSource; 51 /** 歌词URL */ 52 lrc?: string; 53 /** 歌词(有时间戳) */ 54 rawLrc?: string; 55 /** 音质信息 */ 56 qualities?: IQuality; 57 /** 其他可以被序列化的信息 */ 58 [k: string]: any; 59 /** 内部信息 */ 60 [k: symbol]: any; 61 } 62 63 export interface IMusicItemCache extends IMusicItem { 64 $localLyric?: ILyric.ILyricSource; 65 } 66} 67