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 /** 别名 */ 40 alias?: string; 41 /** 时长(s) */ 42 duration: number; 43 /** 专辑名 */ 44 album: string; 45 /** 专辑封面图 */ 46 artwork: string; 47 /** 默认音源 */ 48 url?: string; 49 /** 音源 */ 50 source?: Partial<Record<IQualityKey, IMediaSource>>; 51 /** 歌词 */ 52 lyric?: ILyric.ILyricSource; 53 /** @deprecated 歌词URL */ 54 lrc?: string; 55 /** @deprecated 歌词(原始文本 有时间戳) */ 56 rawLrc?: string; 57 /** 音质信息 */ 58 qualities?: IQuality; 59 /** 其他可以被序列化的信息 */ 60 [k: string]: any; 61 /** 内部信息 */ 62 [k: symbol]: any; 63 } 64 65 export interface IMusicItemCache extends IMusicItem { 66 $localLyric?: ILyric.ILyricSource; 67 } 68} 69