fix: search results use pic/mPic/sPic/qualities (QZv2 format) instead of img/types/_types
This commit is contained in:
@@ -77,30 +77,29 @@ function handleSearchResult(rawList) {
|
||||
var list = [];
|
||||
for (var i = 0; i < rawList.length; i++) {
|
||||
var item = rawList[i];
|
||||
var types = [];
|
||||
var _types = {};
|
||||
types.push({ type: '128k', size: '' }); _types['128k'] = { size: '' };
|
||||
var qualities = {};
|
||||
if (item.newRateFormats) {
|
||||
for (var j = 0; j < item.newRateFormats.length; j++) {
|
||||
var fmt = item.newRateFormats[j];
|
||||
if (fmt.formatType === 'SQ') { types.push({ type: 'flac', size: '' }); _types.flac = { size: '' }; }
|
||||
if (fmt.formatType === 'HQ') { types.push({ type: '320k', size: '' }); _types['320k'] = { size: '' }; }
|
||||
if (fmt.formatType === 'SQ' && fmt.size) qualities.lossless = String(fmt.size);
|
||||
if (fmt.formatType === 'HQ' && fmt.size) qualities.exhigh = String(fmt.size);
|
||||
if (fmt.formatType === 'LQ' && fmt.size) qualities.standard = String(fmt.size);
|
||||
}
|
||||
}
|
||||
var img = item.img || (item.albumImgs && item.albumImgs.length ? item.albumImgs[0].img : '');
|
||||
if (img && img.startsWith('/')) img = 'https://d.musicapp.migu.cn' + img;
|
||||
var picUrl = item.img || (item.albumImgs && item.albumImgs.length ? item.albumImgs[0].img : '');
|
||||
if (picUrl && picUrl.startsWith('/')) picUrl = 'https://d.musicapp.migu.cn' + picUrl;
|
||||
list.push({
|
||||
artists: item.artist || item.singerName || '',
|
||||
id: item.copyrightId || item.id || '',
|
||||
name: item.title || item.songName || '',
|
||||
artists: item.artist || item.singerName || '',
|
||||
source: 'mg',
|
||||
pic: picUrl,
|
||||
mPic: picUrl,
|
||||
sPic: picUrl,
|
||||
albumName: item.album || item.albumName || '',
|
||||
albumId: item.albumId || '',
|
||||
source: 'mg',
|
||||
interval: item.length ? item.length.replace(/.*(\d\d:\d\d)$/, '$1') : '',
|
||||
id: item.copyrightId || item.id || '',
|
||||
songId: item.copyrightId || item.id || '',
|
||||
img: img,
|
||||
lrc: null,
|
||||
types: types, _types: _types, typeUrl: {}
|
||||
qualities: qualities
|
||||
});
|
||||
}
|
||||
return list;
|
||||
@@ -134,7 +133,7 @@ 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('');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user