fix: search results use pic/mPic/sPic/qualities (QZv2 format) instead of img/types/_types
This commit is contained in:
@@ -83,23 +83,24 @@ function fetchAllGitMusic() {
|
||||
}
|
||||
|
||||
function formatGitItem(item) {
|
||||
var types = [];
|
||||
var _types = {};
|
||||
var qualities = {};
|
||||
var fmt = (item.format || '').toLowerCase();
|
||||
if (fmt === 'flac') { types.push({ type: 'flac', size: item.filesize || '' }); _types.flac = { size: item.filesize || '' }; }
|
||||
else if (fmt === 'mp3') { types.push({ type: '320k', size: item.filesize || '' }); _types['320k'] = { size: item.filesize || '' }; }
|
||||
else { types.push({ type: '128k', size: item.filesize || '' }); _types['128k'] = { size: item.filesize || '' }; }
|
||||
if (fmt === 'flac' && item.filesize) qualities.lossless = String(item.filesize);
|
||||
else if (fmt === 'mp3' && item.filesize) qualities.exhigh = String(item.filesize);
|
||||
else if (item.filesize) qualities.standard = String(item.filesize);
|
||||
var picUrl = item.img || '';
|
||||
return {
|
||||
artists: item.artist || '未知歌手',
|
||||
id: item.relative_path || '',
|
||||
name: item.title || item.filename || '',
|
||||
artists: item.artist || '未知歌手',
|
||||
source: 'git',
|
||||
pic: picUrl,
|
||||
mPic: picUrl,
|
||||
sPic: picUrl,
|
||||
albumName: item.album || '未知专辑',
|
||||
albumId: '',
|
||||
id: item.relative_path || '',
|
||||
source: 'git',
|
||||
interval: '',
|
||||
img: item.img || '',
|
||||
lrc: item.lyrics || null,
|
||||
types: types, _types: _types, typeUrl: {},
|
||||
qualities: qualities,
|
||||
_gitcodeData: item
|
||||
};
|
||||
}
|
||||
@@ -152,13 +153,13 @@ function getUrl(songInfo, type) {
|
||||
|
||||
// ===== 封面图 =====
|
||||
function getPic(songInfo) {
|
||||
if (songInfo.img) return Promise.resolve(songInfo.img);
|
||||
if (songInfo.pic) return Promise.resolve(songInfo.pic);
|
||||
return Promise.resolve('');
|
||||
}
|
||||
|
||||
// ===== 歌词 =====
|
||||
function getLyric(songInfo) {
|
||||
if (songInfo.lrc) return Promise.resolve(songInfo.lrc);
|
||||
if (songInfo._gitcodeData && songInfo._gitcodeData.lyrics) return Promise.resolve(songInfo._gitcodeData.lyrics);
|
||||
return Promise.resolve('');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user