music列表增加封面图

This commit is contained in:
mtvpls
2026-05-27 11:42:01 +08:00
parent c08a5974b4
commit 84e74231d4
3 changed files with 72 additions and 4 deletions
+28 -2
View File
@@ -91,7 +91,23 @@ export interface LxServerSong {
interval?: string;
albumName?: string;
img?: string;
image?: string;
imageUrl?: string;
albumPicUrl?: string;
pic?: string;
cover?: string;
songmid?: string;
meta?: {
picUrl?: string;
albumName?: string;
};
album?: {
picUrl?: string;
pic?: string;
};
al?: {
picUrl?: string;
};
}
export function isMusicSource(source: string | null | undefined): source is MusicSource {
@@ -163,8 +179,18 @@ export function normalizeLxSong(song: LxServerSong): MusicV2Song {
songmid: song.songmid,
name: song.name,
artist: song.singer,
album: song.albumName,
cover: song.img,
album: song.albumName || song.meta?.albumName,
cover:
song.img ||
song.pic ||
song.cover ||
song.image ||
song.imageUrl ||
song.albumPicUrl ||
song.meta?.picUrl ||
song.album?.picUrl ||
song.album?.pic ||
song.al?.picUrl,
durationText: song.interval,
});
}
+13 -1
View File
@@ -19,12 +19,24 @@ export function normalizeSource(source: string | undefined | null): MusicSource
export function mapSong(song: any): Song {
const rawSource = song.source || song.platform || song.vendor || song.origin;
const pic =
song.pic ||
song.cover ||
song.img ||
song.image ||
song.imageUrl ||
song.albumPicUrl ||
song.meta?.picUrl ||
song.album?.picUrl ||
song.album?.pic ||
song.al?.picUrl;
return {
id: String(song.id ?? song.songId ?? song.rid ?? song.mid ?? ''),
name: song.name || song.title || '未知歌曲',
artist: song.artist || song.singer || song.artists || '未知艺术家',
album: song.album || song.albumName,
pic: song.pic || song.cover || song.img,
pic,
platform: normalizeSource(rawSource),
duration: song.durationSec || song.duration,
durationText: song.durationText || song.interval,