mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-04 16:18:56 +08:00
优化kw源英文与翻译歌词的匹配
This commit is contained in:
parent
ca417c8b38
commit
5615c706a9
@ -1,7 +1,3 @@
|
|||||||
### 修复
|
### 优化
|
||||||
|
|
||||||
- 修复某些系统下的虚拟导航栏会导致播放栏隐藏的问题(react-native v0.67.x导致的)
|
- 优化kw源英文与翻译歌词的匹配
|
||||||
|
|
||||||
### 其他
|
|
||||||
|
|
||||||
- 降级react-native到 v0.66.4
|
|
||||||
|
@ -14,22 +14,20 @@ export default {
|
|||||||
|
|
||||||
for (const item of arr) {
|
for (const item of arr) {
|
||||||
if (lrcSet.has(item.time)) {
|
if (lrcSet.has(item.time)) {
|
||||||
|
const tItem = lrc.pop()
|
||||||
|
tItem.time = lrc[lrc.length - 1].time
|
||||||
|
lrcT.push(tItem)
|
||||||
lrc.push(item)
|
lrc.push(item)
|
||||||
} else {
|
} else {
|
||||||
lrcT.push(item)
|
lrc.push(item)
|
||||||
lrcSet.add(item.time)
|
lrcSet.add(item.time)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lrc.length) {
|
|
||||||
if ((lrcT.length - lrc.length) > (lrcT.length * 0.1)) { // 翻译比正文多则证明翻译可能有问题,直接将其丢弃
|
if (lrcT.length && lrc.length > lrcT.length) {
|
||||||
lrc = lrcT
|
const tItem = lrc.pop()
|
||||||
lrcT = []
|
tItem.time = lrc[lrc.length - 1].time
|
||||||
} else {
|
lrcT.push(tItem)
|
||||||
lrc.unshift(lrcT.shift())
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lrc = lrcT
|
|
||||||
lrcT = []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -45,16 +43,22 @@ export default {
|
|||||||
requestObj.promise = requestObj.promise.then(({ body }) => {
|
requestObj.promise = requestObj.promise.then(({ body }) => {
|
||||||
// console.log(body)
|
// console.log(body)
|
||||||
if (!body.data?.lrclist?.length) return Promise.reject(new Error('Get lyric failed'))
|
if (!body.data?.lrclist?.length) return Promise.reject(new Error('Get lyric failed'))
|
||||||
const { lrc, lrcT } = this.sortLrcArr(body.data.lrclist)
|
let lrcInfo
|
||||||
|
try {
|
||||||
|
lrcInfo = this.sortLrcArr(body.data.lrclist)
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
return Promise.reject(new Error('Get lyric failed'))
|
||||||
|
}
|
||||||
// console.log(body.data.lrclist)
|
// console.log(body.data.lrclist)
|
||||||
// console.log(lrc, lrcT)
|
// console.log(lrcInfo.lrc, lrcInfo.lrcT)
|
||||||
// console.log({
|
// console.log({
|
||||||
// lyric: decodeName(this.transformLrc(body.data.songinfo, lrc)),
|
// lyric: decodeName(this.transformLrc(body.data.songinfo, lrc)),
|
||||||
// tlyric: decodeName(this.transformLrc(body.data.songinfo, lrcT)),
|
// tlyric: decodeName(this.transformLrc(body.data.songinfo, lrcT)),
|
||||||
// })
|
// })
|
||||||
return {
|
return {
|
||||||
lyric: decodeName(this.transformLrc(body.data.songinfo, lrc)),
|
lyric: decodeName(this.transformLrc(body.data.songinfo, lrcInfo.lrc)),
|
||||||
tlyric: lrcT.length ? decodeName(this.transformLrc(body.data.songinfo, lrcT)) : '',
|
tlyric: lrcInfo.lrcT.length ? decodeName(this.transformLrc(body.data.songinfo, lrcInfo.lrcT)) : '',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return requestObj
|
return requestObj
|
||||||
|
Loading…
x
Reference in New Issue
Block a user