From 63b2c2fb2f4fdf29e6b6bff5e695ed786c1a6ddd Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sat, 7 Dec 2024 16:59:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0=E6=AD=8C?= =?UTF-8?q?=E6=9B=B2=E5=90=8C=E5=90=8D=E6=AD=8C=E8=AF=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=81=8F=E7=A7=BB=E6=97=B6=E9=97=B4=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E4=B8=8B=E6=AC=A1=E5=86=8D=E6=92=AD=E6=94=BE=E6=97=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=9A=84=E8=AE=BE=E7=BD=AE=E6=9C=AA=E8=A2=AB?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=88#2139?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 1 + src/renderer/core/music/local.ts | 3 +- src/renderer/core/music/utils.ts | 49 +++++++++++++++++--------------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/publish/changeLog.md b/publish/changeLog.md index 760fbcca..9034a368 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -27,6 +27,7 @@ Linux 系统至少需要 GLIBC_2.29 版本才能运行, - 修复获取自定义环境音效预设列表逻辑问题 - 修复 m4a 文件歌曲内嵌歌词无法读取的问题(#2090) - 修复 windows 任务管理器中的进程名显示为描述的问题(#2147) +- 修复本地歌曲同名歌词文件调整偏移时间后,下次再播放时调整的设置未被应用的问题(#2139) ### 变更 diff --git a/src/renderer/core/music/local.ts b/src/renderer/core/music/local.ts index 4f38f1b2..76113f65 100644 --- a/src/renderer/core/music/local.ts +++ b/src/renderer/core/music/local.ts @@ -137,7 +137,8 @@ export const getLyricInfo = async({ musicInfo, isRefresh, onToggleSource = () => }): Promise => { if (!isRefresh) { const [lyricInfo, fileLyricInfo] = await Promise.all([getCachedLyricInfo(musicInfo), window.lx.worker.main.getMusicFileLyric(musicInfo.meta.filePath)]) - if (lyricInfo?.lyric && lyricInfo.lyric != lyricInfo.rawlrcInfo.lyric) { + // console.log(lyricInfo, fileLyricInfo) + if (lyricInfo?.lyric && lyricInfo.lyric != fileLyricInfo?.lyric) { // 存在已编辑歌词 return buildLyricInfo({ ...lyricInfo, rawlrcInfo: fileLyricInfo ?? lyricInfo.rawlrcInfo }) } diff --git a/src/renderer/core/music/utils.ts b/src/renderer/core/music/utils.ts index 9e2b9b3d..561ab26e 100644 --- a/src/renderer/core/music/utils.ts +++ b/src/renderer/core/music/utils.ts @@ -125,30 +125,33 @@ export const buildLyricInfo = async(lyricInfo: MakeOptional => { let lrcInfo = await getStoreLyric(musicInfo) // lrcInfo = {} as unknown as LX.Player.LyricInfo - if (existTimeExp.test(lrcInfo.lyric) && 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 }) - // } else if (musicInfo.lrc.startsWith('[id:$00000000]')) { - // let str = musicInfo.lrc.replace('[id:$00000000]\n', '') - // commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc, lxlyric: musicInfo.tlrc }) - // } + if (existTimeExp.test(lrcInfo.lyric)) { + if (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 }) + // } else if (musicInfo.lrc.startsWith('[id:$00000000]')) { + // let str = musicInfo.lrc.replace('[id:$00000000]\n', '') + // commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc, lxlyric: musicInfo.tlrc }) + // } - if (lrcInfo.lxlyric == null) { - switch (musicInfo.source) { // 以下源支持lxlyric 重新获取 - case 'kg': - case 'kw': - case 'mg': - case 'wy': - case 'tx': - break - default: - return lrcInfo - } - } else if (lrcInfo.rlyric == null) { - // 以下源支持 rlyric 重新获取 - if (!['wy', 'kg', 'tx'].includes(musicInfo.source)) return lrcInfo - } else return lrcInfo + if (lrcInfo.lxlyric == null) { + switch (musicInfo.source) { // 以下源支持lxlyric 重新获取 + case 'kg': + case 'kw': + case 'mg': + case 'wy': + case 'tx': + break + default: + return lrcInfo + } + } else if (lrcInfo.rlyric == null) { + // 以下源支持 rlyric 重新获取 + if (!['wy', 'kg', 'tx'].includes(musicInfo.source)) return lrcInfo + } else return lrcInfo + } + if (musicInfo.source == 'local') return lrcInfo } return null }