优化歌词自动换源机制
parent
63141c4ac9
commit
b6f885b250
|
@ -1,6 +1,3 @@
|
||||||
### 修复
|
### 优化
|
||||||
|
|
||||||
- 修复设置-控制按钮位置选项与下载歌词编码格式选项命名冲突导致选项显示异常的问题
|
- 优化歌词自动换源机制
|
||||||
- 修复播放下载列表时存在失效的歌曲会导致切歌不准确的问题
|
|
||||||
- 修复潜在的音乐加载超时不会切歌的问题
|
|
||||||
- 修复因kw源歌词接口停用导致该源歌词获取失败的问题
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ export default {
|
||||||
let requestObj = this.searchLyric(songInfo.name, songInfo.hash, songInfo._interval || this.getIntv(songInfo.interval))
|
let requestObj = this.searchLyric(songInfo.name, songInfo.hash, songInfo._interval || this.getIntv(songInfo.interval))
|
||||||
|
|
||||||
requestObj.promise = requestObj.promise.then(result => {
|
requestObj.promise = requestObj.promise.then(result => {
|
||||||
if (!result) return { lyric: null, tlyric: null, lxlyric: null }
|
if (!result) return Promise.reject(new Error('Get lyric failed'))
|
||||||
|
|
||||||
let requestObj2 = this.getLyricDownload(result.id, result.accessKey)
|
let requestObj2 = this.getLyricDownload(result.id, result.accessKey)
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ export default {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
requestObj.promise = requestObj.promise.then(({ body }) => {
|
requestObj.promise = requestObj.promise.then(({ body }) => {
|
||||||
if (body.returnCode !== '000000') {
|
if (body.returnCode !== '000000' || !body.lyric) {
|
||||||
if (tryNum > 5) return Promise.reject('歌词获取失败')
|
if (tryNum > 5) return Promise.reject(new Error('Get lyric failed'))
|
||||||
let tryRequestObj = this.getLyric(songInfo, ++tryNum)
|
let tryRequestObj = this.getLyric(songInfo, ++tryNum)
|
||||||
requestObj.cancelHttp = tryRequestObj.cancelHttp.bind(tryRequestObj)
|
requestObj.cancelHttp = tryRequestObj.cancelHttp.bind(tryRequestObj)
|
||||||
return tryRequestObj.promise
|
return tryRequestObj.promise
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
requestObj.promise = requestObj.promise.then(({ body }) => {
|
requestObj.promise = requestObj.promise.then(({ body }) => {
|
||||||
if (body.code != 0) return Promise.reject(new Error('获取歌词失败'))
|
if (body.code != 0 || !body.lyric) return Promise.reject(new Error('Get lyric failed'))
|
||||||
return {
|
return {
|
||||||
lyric: decodeName(b64DecodeUnicode(body.lyric)),
|
lyric: decodeName(b64DecodeUnicode(body.lyric)),
|
||||||
tlyric: decodeName(b64DecodeUnicode(body.trans)),
|
tlyric: decodeName(b64DecodeUnicode(body.trans)),
|
||||||
|
|
|
@ -50,7 +50,7 @@ export default songmid => {
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
requestObj.promise = requestObj.promise.then(({ body }) => {
|
requestObj.promise = requestObj.promise.then(({ body }) => {
|
||||||
if (body.code !== 200) return Promise.reject('获取歌词失败')
|
if (body.code !== 200 || !body?.lrc?.lyric) return Promise.reject(new Error('Get lyric failed'))
|
||||||
return {
|
return {
|
||||||
lyric: body.lrc.lyric,
|
lyric: body.lrc.lyric,
|
||||||
tlyric: body.tlyric.lyric,
|
tlyric: body.tlyric.lyric,
|
||||||
|
|
Loading…
Reference in New Issue