修复本地歌曲同名歌词文件调整偏移时间后,下次再播放时调整的设置未被应用的问题(#2139)

pull/2166/head
lyswhut 2024-12-07 16:59:48 +08:00
parent 08da7a37e6
commit 63b2c2fb2f
3 changed files with 29 additions and 24 deletions

View File

@ -27,6 +27,7 @@ Linux 系统至少需要 GLIBC_2.29 版本才能运行,
- 修复获取自定义环境音效预设列表逻辑问题 - 修复获取自定义环境音效预设列表逻辑问题
- 修复 m4a 文件歌曲内嵌歌词无法读取的问题(#2090 - 修复 m4a 文件歌曲内嵌歌词无法读取的问题(#2090
- 修复 windows 任务管理器中的进程名显示为描述的问题(#2147 - 修复 windows 任务管理器中的进程名显示为描述的问题(#2147
- 修复本地歌曲同名歌词文件调整偏移时间后,下次再播放时调整的设置未被应用的问题(#2139
### 变更 ### 变更

View File

@ -137,7 +137,8 @@ export const getLyricInfo = async({ musicInfo, isRefresh, onToggleSource = () =>
}): Promise<LX.Player.LyricInfo> => { }): Promise<LX.Player.LyricInfo> => {
if (!isRefresh) { if (!isRefresh) {
const [lyricInfo, fileLyricInfo] = await Promise.all([getCachedLyricInfo(musicInfo), window.lx.worker.main.getMusicFileLyric(musicInfo.meta.filePath)]) 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 }) return buildLyricInfo({ ...lyricInfo, rawlrcInfo: fileLyricInfo ?? lyricInfo.rawlrcInfo })
} }

View File

@ -125,30 +125,33 @@ 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 = {} as unknown as LX.Player.LyricInfo // lrcInfo = {} as unknown as LX.Player.LyricInfo
if (existTimeExp.test(lrcInfo.lyric) && lrcInfo.tlyric != null) { if (existTimeExp.test(lrcInfo.lyric)) {
// if (musicInfo.lrc.startsWith('\ufeff[id:$00000000]')) { if (lrcInfo.tlyric != null) {
// let str = musicInfo.lrc.replace('\ufeff[id:$00000000]\n', '') // if (musicInfo.lrc.startsWith('\ufeff[id:$00000000]')) {
// commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc, lxlyric: musicInfo.tlrc }) // let str = musicInfo.lrc.replace('\ufeff[id:$00000000]\n', '')
// } else if (musicInfo.lrc.startsWith('[id:$00000000]')) { // commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc, lxlyric: musicInfo.tlrc })
// let str = musicInfo.lrc.replace('[id:$00000000]\n', '') // } else if (musicInfo.lrc.startsWith('[id:$00000000]')) {
// commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc, lxlyric: musicInfo.tlrc }) // let str = musicInfo.lrc.replace('[id:$00000000]\n', '')
// } // commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc, lxlyric: musicInfo.tlrc })
// }
if (lrcInfo.lxlyric == null) { if (lrcInfo.lxlyric == null) {
switch (musicInfo.source) { // 以下源支持lxlyric 重新获取 switch (musicInfo.source) { // 以下源支持lxlyric 重新获取
case 'kg': case 'kg':
case 'kw': case 'kw':
case 'mg': case 'mg':
case 'wy': case 'wy':
case 'tx': case 'tx':
break break
default: default:
return lrcInfo return lrcInfo
} }
} else if (lrcInfo.rlyric == null) { } else if (lrcInfo.rlyric == null) {
// 以下源支持 rlyric 重新获取 // 以下源支持 rlyric 重新获取
if (!['wy', 'kg', 'tx'].includes(musicInfo.source)) return lrcInfo if (!['wy', 'kg', 'tx'].includes(musicInfo.source)) return lrcInfo
} else return lrcInfo } else return lrcInfo
}
if (musicInfo.source == 'local') return lrcInfo
} }
return null return null
} }