diff --git a/publish/changeLog.md b/publish/changeLog.md index 09459a79..eb26514d 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -9,6 +9,7 @@ - 新增是否在更新版本的首次启动时显示更新日志弹窗设置,默认开启,可以去设置-软件更新更改 - 新增播放速率调整功能,可以去播放详情页的控制按钮调整,范围限制为x0.5至x2之间(#13) - 添加wy、tx源逐字歌词的支持 +- 新增设置-下载设置-是否嵌入翻译歌词、罗马音歌词设置,默认关闭 - 添加启动时的数据库表及表结构完整性校验,若未通过校验,则会显示弹窗提示后将该数据库重命名添加`.bak`后缀后重建数据库启动。对于某些人遇到更新到v2.0.0后出现之前收藏的歌曲全部丢失或者歌曲无法添加到列表的问题,可以通过此特性自动重建数据库并重新迁移数据,不再需要手动去数据目录删除数据库 ### 优化 diff --git a/src/common/defaultSetting.ts b/src/common/defaultSetting.ts index ede12c58..ae084d1d 100644 --- a/src/common/defaultSetting.ts +++ b/src/common/defaultSetting.ts @@ -89,6 +89,8 @@ const defaultSetting: LX.AppSetting = { 'download.lrcFormat': 'utf8', 'download.isEmbedPic': true, 'download.isEmbedLyric': false, + 'download.isEmbedLyricT': false, + 'download.isEmbedLyricR': false, 'download.isUseOtherSource': false, 'search.isShowHotSearch': false, diff --git a/src/common/types/app_setting.d.ts b/src/common/types/app_setting.d.ts index 0a05e326..1e0f2203 100644 --- a/src/common/types/app_setting.d.ts +++ b/src/common/types/app_setting.d.ts @@ -409,6 +409,16 @@ declare global { */ 'download.isEmbedLyric': boolean + /** + * 是否在音频文件中嵌入翻译歌词 + */ + 'download.isEmbedLyricT': boolean + + /** + * 是否在音频文件中嵌入罗马音歌词 + */ + 'download.isEmbedLyricR': boolean + /** * 歌曲源不可用时,是否启用换源下载 */ diff --git a/src/lang/en-us.json b/src/lang/en-us.json index 2847d89b..5fee1aba 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -335,6 +335,7 @@ "setting__download_data_embed": "Whether to embed the following content in the audio file", "setting__download_embed_lyric": "Embedding lyric", "setting__download_embed_pic": "Embedding cover", + "setting__download_embed_tlyric": "Also embed translated lyrics (if available)", "setting__download_enable": "Whether to enable download function", "setting__download_lyric": "Lyrics download", "setting__download_lyric_format": "Downloaded lyrics file encoding format", diff --git a/src/lang/zh-cn.json b/src/lang/zh-cn.json index cf7b2603..e773a044 100644 --- a/src/lang/zh-cn.json +++ b/src/lang/zh-cn.json @@ -337,6 +337,8 @@ "setting__download_data_embed": "是否将以下内容嵌入到音频文件中", "setting__download_embed_lyric": "歌词嵌入", "setting__download_embed_pic": "封面嵌入", + "setting__download_embed_rlyric": "同时嵌入罗马音歌词(如果有)", + "setting__download_embed_tlyric": "同时嵌入翻译歌词(如果有)", "setting__download_enable": "是否启用下载功能", "setting__download_lyric": "歌词下载", "setting__download_lyric_format": "下载的歌词文件编码格式", diff --git a/src/lang/zh-tw.json b/src/lang/zh-tw.json index 154a473f..5ad4fdd1 100644 --- a/src/lang/zh-tw.json +++ b/src/lang/zh-tw.json @@ -336,6 +336,7 @@ "setting__download_data_embed": "是否將以下內容嵌入到音頻文件中", "setting__download_embed_lyric": "歌詞嵌入", "setting__download_embed_pic": "封面嵌入", + "setting__download_embed_tlyric": "同時嵌入翻譯歌詞(如果有)", "setting__download_enable": "是否啟用下載功能", "setting__download_lyric": "歌詞下載", "setting__download_lyric_format": "下載的歌詞文件編碼格式", diff --git a/src/renderer/store/download/action.ts b/src/renderer/store/download/action.ts index 663190c0..eb5cbb8b 100644 --- a/src/renderer/store/download/action.ts +++ b/src/renderer/store/download/action.ts @@ -148,13 +148,18 @@ const saveMeta = (downloadInfo: LX.Download.ListItem) => { : Promise.resolve(null), ] void Promise.all(tasks).then(([imgUrl, lyrics]) => { - if (lyrics?.lyric) lyrics.lyric = fixKgLyric(lyrics.lyric) + let lyric: null | string = null + if (lyrics?.lyric) { + lyric = fixKgLyric(lyrics.lyric) + if (appSetting['download.isEmbedLyricT'] && lyrics.tlyric) lyric += '\n' + lyrics.tlyric + '\n' + if (appSetting['download.isEmbedLyricR'] && lyrics.rlyric) lyric += '\n' + lyrics.rlyric + '\n' + } void window.lx.worker.download.writeMeta(downloadInfo.metadata.filePath, { title: downloadInfo.metadata.musicInfo.name, artist: downloadInfo.metadata.musicInfo.singer, album: downloadInfo.metadata.musicInfo.meta.albumName, APIC: imgUrl, - lyrics: lyrics?.lyric ?? null, + lyrics: lyric, }) }) } diff --git a/src/renderer/views/Setting/components/SettingDownload.vue b/src/renderer/views/Setting/components/SettingDownload.vue index f5a6bae3..6f76c2f3 100644 --- a/src/renderer/views/Setting/components/SettingDownload.vue +++ b/src/renderer/views/Setting/components/SettingDownload.vue @@ -31,6 +31,10 @@ dd base-checkbox(id="setting_download_isEmbedPic" :modelValue="appSetting['download.isEmbedPic']" @update:modelValue="updateSetting({'download.isEmbedPic': $event})" :label="$t('setting__download_embed_pic')") .gap-top base-checkbox(id="setting_download_isEmbedLyric" :modelValue="appSetting['download.isEmbedLyric']" @update:modelValue="updateSetting({'download.isEmbedLyric': $event})" :label="$t('setting__download_embed_lyric')") + .gap-top + base-checkbox(id="setting_download_isEmbedLyricT" :disabled="!appSetting['download.isEmbedLyric']" :modelValue="appSetting['download.isEmbedLyricT']" @update:modelValue="updateSetting({'download.isEmbedLyricT': $event})" :label="$t('setting__download_embed_tlyric')") + .gap-top + base-checkbox(id="setting_download_isEmbedLyricR" :disabled="!appSetting['download.isEmbedLyric']" :modelValue="appSetting['download.isEmbedLyricR']" @update:modelValue="updateSetting({'download.isEmbedLyricR': $event})" :label="$t('setting__download_embed_rlyric')") dd(:aria-label="$t('setting__download_lyric_title')") h3#download_lyric {{$t('setting__download_lyric')}} .gap-top