跳过空白歌词
parent
729ac5a0d7
commit
1c542a9b17
|
@ -161,7 +161,10 @@ const handleGetLyric = function(musicInfo, retryedSource = [], originMusic) {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reqPromise = Promise.reject(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)
|
// console.log(err)
|
||||||
if (!retryedSource.includes(musicInfo.source)) retryedSource.push(musicInfo.source)
|
if (!retryedSource.includes(musicInfo.source)) retryedSource.push(musicInfo.source)
|
||||||
return this.dispatch('list/getOtherSource', originMusic).then(otherSource => {
|
return this.dispatch('list/getOtherSource', originMusic).then(otherSource => {
|
||||||
|
@ -181,7 +184,7 @@ const handleGetLyric = function(musicInfo, retryedSource = [], originMusic) {
|
||||||
const getLyric = function(musicInfo, isUseOtherSource, isS2t) {
|
const getLyric = function(musicInfo, isUseOtherSource, isS2t) {
|
||||||
return getLyricFromStorage(musicInfo).then(lrcInfo => {
|
return getLyricFromStorage(musicInfo).then(lrcInfo => {
|
||||||
return (
|
return (
|
||||||
lrcInfo.lyric
|
lrcInfo.lyric && lrcInfo.lyric.trim()
|
||||||
? Promise.resolve({ lyric: lrcInfo.lyric, tlyric: lrcInfo.tlyric || '' })
|
? Promise.resolve({ lyric: lrcInfo.lyric, tlyric: lrcInfo.tlyric || '' })
|
||||||
: (
|
: (
|
||||||
isUseOtherSource
|
isUseOtherSource
|
||||||
|
|
|
@ -158,7 +158,10 @@ const getLyric = function(musicInfo, retryedSource = [], originMusic) {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reqPromise = Promise.reject(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)
|
if (!retryedSource.includes(musicInfo.source)) retryedSource.push(musicInfo.source)
|
||||||
return this.dispatch('list/getOtherSource', originMusic).then(otherSource => {
|
return this.dispatch('list/getOtherSource', originMusic).then(otherSource => {
|
||||||
console.log('find otherSource', otherSource)
|
console.log('find otherSource', otherSource)
|
||||||
|
@ -213,7 +216,7 @@ const actions = {
|
||||||
const lrcInfo = await getStoreLyric(musicInfo)
|
const lrcInfo = await getStoreLyric(musicInfo)
|
||||||
// lrcInfo = {}
|
// lrcInfo = {}
|
||||||
// if (lrcRequest && lrcRequest.cancelHttp) lrcRequest.cancelHttp()
|
// 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]')) {
|
// if (musicInfo.lrc.startsWith('\ufeff[id:$00000000]')) {
|
||||||
// let str = musicInfo.lrc.replace('\ufeff[id:$00000000]\n', '')
|
// let str = musicInfo.lrc.replace('\ufeff[id:$00000000]\n', '')
|
||||||
// commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc, lxlyric: musicInfo.tlrc })
|
// commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc, lxlyric: musicInfo.tlrc })
|
||||||
|
|
|
@ -201,6 +201,7 @@ export default {
|
||||||
lrcInfo.lxlyric = ''
|
lrcInfo.lxlyric = ''
|
||||||
}
|
}
|
||||||
lrcInfo.lyric = lrcInfo.lyric.replace(lrcTools.rxps.wordTimeAll, '')
|
lrcInfo.lyric = lrcInfo.lyric.replace(lrcTools.rxps.wordTimeAll, '')
|
||||||
|
if (!lrcInfo.lyric.trim()) return Promise.reject(new Error('Get lyric failed'))
|
||||||
// console.log(lrcInfo)
|
// console.log(lrcInfo)
|
||||||
return lrcInfo
|
return lrcInfo
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue