From e539f29f6d92daafe2001f73f63cb5c9f40ed463 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Wed, 16 Oct 2019 21:00:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9F=B3=E8=B4=A8=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=AF=BC=E8=87=B4=E7=9A=84=E6=AD=8C=E5=8D=95=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 ----- src/renderer/utils/music/wy/musicSearch.js | 20 +++++++++++-------- src/renderer/utils/music/wy/songList.js | 23 +++++++++++++--------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 261bcff7..c84632fa 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,6 @@ 或者到网盘下载(网盘内有MAC、windows版):`https://www.lanzous.com/b906260/` 密码:`glqw`
使用常见问题请转至:[常见问题](https://github.com/lyswhut/lx-music-desktop#常见问题) -#### TODO - -- [ ] 新增拉取各大平台歌单 -- [ ] 新增聚合搜索 - ### 源码使用方法 环境要求:Node.js 12.x diff --git a/src/renderer/utils/music/wy/musicSearch.js b/src/renderer/utils/music/wy/musicSearch.js index a7b6c487..0de96087 100644 --- a/src/renderer/utils/music/wy/musicSearch.js +++ b/src/renderer/utils/music/wy/musicSearch.js @@ -42,16 +42,20 @@ export default { size, } case 320000: - size = sizeFormate(item.h.size) - types.push({ type: '320k', size }) - _types['320k'] = { - size, + if (item.h) { + size = sizeFormate(item.h.size) + types.push({ type: '320k', size }) + _types['320k'] = { + size, + } } case 128000: - size = sizeFormate(item.l.size) - types.push({ type: '128k', size }) - _types['128k'] = { - size, + if (item.l) { + size = sizeFormate(item.l.size) + types.push({ type: '128k', size }) + _types['128k'] = { + size, + } } } diff --git a/src/renderer/utils/music/wy/songList.js b/src/renderer/utils/music/wy/songList.js index a70f4bf9..8e45c721 100644 --- a/src/renderer/utils/music/wy/songList.js +++ b/src/renderer/utils/music/wy/songList.js @@ -78,7 +78,8 @@ export default { let privilege = privileges[index] if (privilege.id !== item.id) privilege = privileges.find(p => p.id === item.id) if (!privilege) return - switch (privileges[index].maxbr) { + + switch (privilege.maxbr) { case 999000: size = null types.push({ type: 'flac', size }) @@ -86,16 +87,20 @@ export default { size, } case 320000: - size = sizeFormate(item.h.size) - types.push({ type: '320k', size }) - _types['320k'] = { - size, + if (item.h) { + size = sizeFormate(item.h.size) + types.push({ type: '320k', size }) + _types['320k'] = { + size, + } } case 128000: - size = sizeFormate(item.l.size) - types.push({ type: '128k', size }) - _types['128k'] = { - size, + if (item.l) { + size = sizeFormate(item.l.size) + types.push({ type: '128k', size }) + _types['128k'] = { + size, + } } }