添加对wy源某些歌曲有问题的歌词进行修复
parent
6fc5a47970
commit
e9539b5c5c
|
@ -19,6 +19,7 @@
|
||||||
- 自定义源列显示源版本号、作者名字
|
- 自定义源列显示源版本号、作者名字
|
||||||
- 优化列表全选机制,修复列表未获得焦点时仍然可以全选的问题
|
- 优化列表全选机制,修复列表未获得焦点时仍然可以全选的问题
|
||||||
- 优化搜索框交互逻辑,防止鼠标操作时意外搜索候选列表的内容
|
- 优化搜索框交互逻辑,防止鼠标操作时意外搜索候选列表的内容
|
||||||
|
- 添加对wy源某些歌曲有问题的歌词进行修复
|
||||||
|
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ export const buildLyricInfo = async(lyricInfo: MakeOptional<LX.Player.LyricInfo,
|
||||||
|
|
||||||
export const getCachedLyricInfo = async(musicInfo: LX.Music.MusicInfo): Promise<LX.Player.LyricInfo | null> => {
|
export const getCachedLyricInfo = async(musicInfo: LX.Music.MusicInfo): Promise<LX.Player.LyricInfo | null> => {
|
||||||
let lrcInfo = await getStoreLyric(musicInfo)
|
let lrcInfo = await getStoreLyric(musicInfo)
|
||||||
// lrcInfo = {}
|
lrcInfo = {} as unknown as LX.Player.LyricInfo
|
||||||
if (existTimeExp.test(lrcInfo.lyric) && lrcInfo.tlyric != null) {
|
if (existTimeExp.test(lrcInfo.lyric) && 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', '')
|
||||||
|
|
|
@ -246,6 +246,20 @@ const parseTools = {
|
||||||
// return requestObj
|
// return requestObj
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// https://github.com/lyswhut/lx-music-mobile/issues/370
|
||||||
|
const fixTimeLabel = (lrc, tlrc, romalrc) => {
|
||||||
|
if (lrc) {
|
||||||
|
let newLrc = lrc.replace(/\[(\d{2}:\d{2}):(\d{2})]/g, '[$1.$2]')
|
||||||
|
let newTlrc = tlrc?.replace(/\[(\d{2}:\d{2}):(\d{2})]/g, '[$1.$2]') ?? tlrc
|
||||||
|
if (newLrc != lrc || newTlrc != tlrc) {
|
||||||
|
lrc = newLrc
|
||||||
|
tlrc = newTlrc
|
||||||
|
if (romalrc) romalrc = romalrc.replace(/\[(\d{2}:\d{2}):(\d{2,3})]/g, '[$1.$2]').replace(/\[(\d{2}:\d{2}\.\d{2})0]/g, '[$1]')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { lrc, tlrc, romalrc }
|
||||||
|
}
|
||||||
|
|
||||||
// https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/module/lyric_new.js
|
// https://github.com/Binaryify/NeteaseCloudMusicApi/blob/master/module/lyric_new.js
|
||||||
export default songmid => {
|
export default songmid => {
|
||||||
|
@ -261,10 +275,11 @@ export default songmid => {
|
||||||
yrv: 0,
|
yrv: 0,
|
||||||
})
|
})
|
||||||
requestObj.promise = requestObj.promise.then(({ body }) => {
|
requestObj.promise = requestObj.promise.then(({ body }) => {
|
||||||
// console.log(body)
|
console.log(body)
|
||||||
if (body.code !== 200 || !body?.lrc?.lyric) return Promise.reject(new Error('Get lyric failed'))
|
if (body.code !== 200 || !body?.lrc?.lyric) return Promise.reject(new Error('Get lyric failed'))
|
||||||
const info = parseTools.parse(body.yrc?.lyric, body.ytlrc?.lyric, body.yromalrc?.lyric, body.lrc.lyric, body.tlyric?.lyric, body.romalrc?.lyric)
|
const fixTimeLabelLrc = fixTimeLabel(body.lrc.lyric, body.tlyric?.lyric, body.romalrc?.lyric)
|
||||||
// console.log(info)
|
const info = parseTools.parse(body.yrc?.lyric, body.ytlrc?.lyric, body.yromalrc?.lyric, fixTimeLabelLrc.lrc, fixTimeLabelLrc.tlrc, fixTimeLabelLrc.romalrc)
|
||||||
|
console.log(info)
|
||||||
if (!info.lyric) return Promise.reject(new Error('Get lyric failed'))
|
if (!info.lyric) return Promise.reject(new Error('Get lyric failed'))
|
||||||
return info
|
return info
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue