fix: search results use pic/mPic/sPic/qualities (QZv2 format) instead of img/types/_types
This commit is contained in:
@@ -126,13 +126,11 @@ function handleSearchResult(rawList) {
|
||||
for (var i = 0; i < rawList.length; i++) {
|
||||
var item = rawList[i];
|
||||
if (!item.file || !item.file.media_mid) continue;
|
||||
var types = [];
|
||||
var _types = {};
|
||||
var file = item.file;
|
||||
if (file.size_128mp3 !== 0) { types.push({ type: '128k', size: '' }); _types['128k'] = { size: '' }; }
|
||||
if (file.size_320mp3 !== 0) { types.push({ type: '320k', size: '' }); _types['320k'] = { size: '' }; }
|
||||
if (file.size_flac !== 0) { types.push({ type: 'flac', size: '' }); _types.flac = { size: '' }; }
|
||||
if (file.size_hires !== 0) { types.push({ type: 'hires', size: '' }); _types.hires = { size: '' }; }
|
||||
var qualities = {};
|
||||
if (item.file.size_128mp3) qualities.standard = String(item.file.size_128mp3);
|
||||
if (item.file.size_320mp3) qualities.exhigh = String(item.file.size_320mp3);
|
||||
if (item.file.size_flac) qualities.lossless = String(item.file.size_flac);
|
||||
if (item.file.size_hires) qualities.hires = String(item.file.size_hires);
|
||||
var albumId = '';
|
||||
var albumName = '';
|
||||
if (item.album) { albumName = item.album.name; albumId = item.album.mid; }
|
||||
@@ -142,18 +140,19 @@ function handleSearchResult(rawList) {
|
||||
for (var j = 0; j < item.singer.length; j++) ns.push(item.singer[j].name);
|
||||
singerName = ns.join('、');
|
||||
}
|
||||
var picUrl = albumId ? 'https://y.gtimg.cn/music/photo_new/T002R500x500M000' + albumId + '.jpg' : (item.singer && item.singer.length ? 'https://y.gtimg.cn/music/photo_new/T001R500x500M000' + item.singer[0].mid + '.jpg' : '');
|
||||
list.push({
|
||||
artists: singerName,
|
||||
id: item.mid,
|
||||
name: item.name + (item.title_extra || ''),
|
||||
artists: singerName,
|
||||
source: 'tx',
|
||||
pic: picUrl,
|
||||
mPic: picUrl,
|
||||
sPic: picUrl,
|
||||
albumName: albumName,
|
||||
albumId: albumId,
|
||||
source: 'tx',
|
||||
interval: formatPlayTime(item.interval),
|
||||
id: item.mid,
|
||||
songId: item.id,
|
||||
img: albumId ? 'https://y.gtimg.cn/music/photo_new/T002R500x500M000' + albumId + '.jpg' : (item.singer && item.singer.length ? 'https://y.gtimg.cn/music/photo_new/T001R500x500M000' + item.singer[0].mid + '.jpg' : ''),
|
||||
lrc: null,
|
||||
types: types, _types: _types, typeUrl: {}
|
||||
qualities: qualities
|
||||
});
|
||||
}
|
||||
return list;
|
||||
@@ -190,7 +189,7 @@ function getUrl(songInfo, type) {
|
||||
|
||||
// ===== 封面图 =====
|
||||
function getPic(songInfo) {
|
||||
if (songInfo.img) return Promise.resolve(songInfo.img);
|
||||
if (songInfo.pic) return Promise.resolve(songInfo.pic);
|
||||
var albumId = songInfo.albumId || '';
|
||||
if (albumId) return Promise.resolve('https://y.gtimg.cn/music/photo_new/T002R500x500M000' + albumId + '.jpg');
|
||||
return Promise.resolve('');
|
||||
@@ -223,13 +222,19 @@ function musicDetail(songmid) {
|
||||
var albumId = t.album ? t.album.mid : '';
|
||||
var singerName = '';
|
||||
if (t.singer && t.singer.length) { var ns = []; for (var j = 0; j < t.singer.length; j++) ns.push(t.singer[j].name); singerName = ns.join('、'); }
|
||||
var picUrl = albumId ? 'https://y.gtimg.cn/music/photo_new/T002R500x500M000' + albumId + '.jpg' : '';
|
||||
return {
|
||||
artists: singerName, name: t.name,
|
||||
albumName: t.album ? t.album.name : '', albumId: albumId,
|
||||
source: 'tx', interval: formatPlayTime(t.interval),
|
||||
id: t.mid, songId: t.id,
|
||||
img: albumId ? 'https://y.gtimg.cn/music/photo_new/T002R500x500M000' + albumId + '.jpg' : '',
|
||||
lrc: null, types: [], _types: {}, typeUrl: {}
|
||||
id: t.mid,
|
||||
name: t.name,
|
||||
artists: singerName,
|
||||
source: 'tx',
|
||||
pic: picUrl,
|
||||
mPic: picUrl,
|
||||
sPic: picUrl,
|
||||
albumName: t.album ? t.album.name : '',
|
||||
albumId: albumId,
|
||||
interval: formatPlayTime(t.interval),
|
||||
qualities: {}
|
||||
};
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user