From d257a441c2a02c9b7f54c324a59c8465ef3c1b17 Mon Sep 17 00:00:00 2001 From: MoYingJi Date: Wed, 22 Oct 2025 23:10:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=90=AF=E7=94=A8=20?= =?UTF-8?q?TTML=20=E9=80=89=E9=A1=B9=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原先的逻辑不太统一,一边受选项控制,一边不受选项控制 现在将所有的本地 TTML 加载都改为不受选项控制,只要本地文件存在则始终启用,且将设置项「启用 TTML 歌词」更名为「启用在线 TTML 歌词」 --- src/components/Setting/LyricsSetting.vue | 4 ++-- src/stores/setting.ts | 2 +- src/utils/player-utils/lyric.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Setting/LyricsSetting.vue b/src/components/Setting/LyricsSetting.vue index 39267a6a5..5ec918302 100644 --- a/src/components/Setting/LyricsSetting.vue +++ b/src/components/Setting/LyricsSetting.vue @@ -262,9 +262,9 @@
- 启用 TTML 歌词 + 启用在线 TTML 歌词 - 是否启用 TTML 歌词(如有),TTML 歌词支持逐字、翻译、音译等功能, 将会在下一首歌生效 + 是否从 AMLL TTML DB 获取歌词(如有),TTML 歌词支持逐字、翻译、音译等功能,将会在下一首歌生效
diff --git a/src/stores/setting.ts b/src/stores/setting.ts index 8b4a91a11..db31962fa 100644 --- a/src/stores/setting.ts +++ b/src/stores/setting.ts @@ -127,7 +127,7 @@ interface SettingState { useAMLyrics: boolean; /** 是否使用 AM 歌词弹簧效果 */ useAMSpring: boolean; - /** 是否启用 TTML 歌词 */ + /** 是否启用在线 TTML 歌词 */ enableTTMLLyric: boolean; /** 菜单显示封面 */ menuShowCover: boolean; diff --git a/src/utils/player-utils/lyric.ts b/src/utils/player-utils/lyric.ts index 99dc494cc..fff296f1d 100644 --- a/src/utils/player-utils/lyric.ts +++ b/src/utils/player-utils/lyric.ts @@ -22,7 +22,7 @@ export const getLyricData = async (id: number) => { const getLyric = getLyricFun(settingStore.localLyricPath, id); const [lyricRes, ttmlContent] = await Promise.all([ getLyric("lrc", songLyric), - settingStore.enableTTMLLyric && getLyric("ttml", songLyricTTML), + settingStore.enableTTMLLyric ? getLyric("ttml", songLyricTTML) : getLyric("ttml"), ]); parsedLyricsData(lyricRes); if (ttmlContent) { @@ -64,11 +64,11 @@ const getLyricFun = (paths: string[], id: number) => async ( ext: string, - getOnline: (id: number) => Promise, + getOnline?: (id: number) => Promise, ): Promise => { for (const path of paths) { const lyric = await window.electron.ipcRenderer.invoke("read-local-lyric", path, id, ext); if (lyric) return lyric; } - return await getOnline(id); + return getOnline ? await getOnline(id) : null; };