diff --git a/src/renderer/store/modules/download.js b/src/renderer/store/modules/download.js index 00c64d3f..e7a96a89 100644 --- a/src/renderer/store/modules/download.js +++ b/src/renderer/store/modules/download.js @@ -161,7 +161,10 @@ const handleGetLyric = function(musicInfo, retryedSource = [], originMusic) { } catch (err) { reqPromise = Promise.reject(err) } - return reqPromise.catch(err => { + return reqPromise.then(lyricInfo => { + if (!lyricInfo.lyric.trim()) return Promise.reject(new Error('failed')) + return lyricInfo + }).catch(err => { // console.log(err) if (!retryedSource.includes(musicInfo.source)) retryedSource.push(musicInfo.source) return this.dispatch('list/getOtherSource', originMusic).then(otherSource => { @@ -181,7 +184,7 @@ const handleGetLyric = function(musicInfo, retryedSource = [], originMusic) { const getLyric = function(musicInfo, isUseOtherSource, isS2t) { return getLyricFromStorage(musicInfo).then(lrcInfo => { return ( - lrcInfo.lyric + lrcInfo.lyric && lrcInfo.lyric.trim() ? Promise.resolve({ lyric: lrcInfo.lyric, tlyric: lrcInfo.tlyric || '' }) : ( isUseOtherSource diff --git a/src/renderer/store/modules/player.js b/src/renderer/store/modules/player.js index 86d3418e..f90ab7e4 100644 --- a/src/renderer/store/modules/player.js +++ b/src/renderer/store/modules/player.js @@ -158,7 +158,10 @@ const getLyric = function(musicInfo, retryedSource = [], originMusic) { } catch (err) { reqPromise = Promise.reject(err) } - return reqPromise.catch(err => { + return reqPromise.then(lyricInfo => { + if (!lyricInfo.lyric.trim()) return Promise.reject(new Error('failed')) + return lyricInfo + }).catch(err => { if (!retryedSource.includes(musicInfo.source)) retryedSource.push(musicInfo.source) return this.dispatch('list/getOtherSource', originMusic).then(otherSource => { console.log('find otherSource', otherSource) @@ -213,7 +216,7 @@ const actions = { const lrcInfo = await getStoreLyric(musicInfo) // lrcInfo = {} // if (lrcRequest && lrcRequest.cancelHttp) lrcRequest.cancelHttp() - if (lrcInfo.lyric && lrcInfo.tlyric != null) { + if (lrcInfo.lyric && lrcInfo.lyric.trim() && lrcInfo.tlyric != null) { // if (musicInfo.lrc.startsWith('\ufeff[id:$00000000]')) { // let str = musicInfo.lrc.replace('\ufeff[id:$00000000]\n', '') // commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc, lxlyric: musicInfo.tlrc }) diff --git a/src/renderer/utils/music/kw/lyric.js b/src/renderer/utils/music/kw/lyric.js index a663fc3e..8e508f68 100644 --- a/src/renderer/utils/music/kw/lyric.js +++ b/src/renderer/utils/music/kw/lyric.js @@ -201,6 +201,7 @@ export default { lrcInfo.lxlyric = '' } lrcInfo.lyric = lrcInfo.lyric.replace(lrcTools.rxps.wordTimeAll, '') + if (!lrcInfo.lyric.trim()) return Promise.reject(new Error('Get lyric failed')) // console.log(lrcInfo) return lrcInfo })