xref: /MusicFree/src/types/common.d.ts (revision 410a159129b1f6a7a1f44fde7bfad9a46f91e161)
1declare namespace ICommon {
2    /** 支持搜索的媒体类型 */
3    export type SupportMediaType =
4        | 'music'
5        | 'album'
6        | 'artist'
7        | 'sheet'
8        | 'lyric';
9
10    /** 媒体定义 */
11    export type SupportMediaItemBase = {
12        music: IMusic.IMusicItemBase;
13        album: IAlbum.IAlbumItemBase;
14        artist: IArtist.IArtistItemBase;
15        sheet: IMusic.IMusicSheetItemBase;
16        lyric: ILyric.ILyricItem;
17    };
18
19    export type IUnique = {
20        id: string;
21        [k: string | symbol]: any;
22    };
23
24    export type IMediaBase = {
25        id: string;
26        platform: string;
27        $?: any;
28        [k: symbol]: any;
29        [k: string]: any;
30    };
31
32    /** 一些额外信息 */
33    export type IMediaMeta = {
34        /** 关联歌词信息 */
35        associatedLrc?: IMediaBase;
36        /** 是否下载过 TODO: 删去 */
37        downloaded?: boolean;
38        /** 本地下载路径 */
39        localPath?: string;
40        /** 补充的音乐信息 */
41        mediaItem?: Partial<IMediaBase>;
42        /** 歌词偏移 */
43        lyricOffset?: number;
44
45        lrc?: string;
46        associatedLrc?: IMediaBase;
47        headers?: Record<string, any>;
48        url?: string;
49        id?: string;
50        platform?: string;
51        qualities?: IMusic.IQuality;
52        $?: {
53            local?: {
54                localLrc?: string;
55                [k: string]: any;
56            };
57            [k: string]: any;
58        };
59        [k: string]: any;
60        [k: symbol]: any;
61    };
62
63    export type WithMusicList<T> = T & {
64        musicList?: IMusic.IMusicItem[];
65    };
66
67    export type PaginationResponse<T> = {
68        isEnd?: boolean;
69        data?: T[];
70    };
71
72    export interface IPoint {
73        x: number;
74        y: number;
75    }
76}
77