diff --git a/publish/changeLog.md b/publish/changeLog.md index 7b7185d4..8a42e65d 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -4,6 +4,7 @@ - 播放详情页新增桌面歌词切换按钮 - 新增将我的列表保存为TXT、CSV格式,可以去设置-备份与恢复中使用(注意:此类格式的备份目前不支持恢复到LX Music中) - 新增根据歌曲名、歌手名等字段对列表自动排序的功能,可以在我的列表右击列表名弹出的菜单中使用 +- 新增将播放与下载的歌词转换为繁体中文选项,默认关闭,可在设置-播放设置中开启 ### 优化 @@ -13,6 +14,10 @@ - 修复kw源某些歌曲的歌词提取异常的问题 +### 变更 + +- 现在使用繁体中文语言时将不再自动转换歌词,转换行为将由上面新增的转换开关控制 + ### 其他 - 升级vue到 3.x diff --git a/src/common/defaultSetting.js b/src/common/defaultSetting.js index 4e31bd59..87827123 100644 --- a/src/common/defaultSetting.js +++ b/src/common/defaultSetting.js @@ -2,7 +2,7 @@ const path = require('path') const os = require('os') const defaultSetting = { - version: '1.0.45', + version: '1.0.46', player: { togglePlayMethod: 'listLoop', highQuality: false, @@ -12,6 +12,7 @@ const defaultSetting = { mediaDeviceId: 'default', isMediaDeviceRemovedStopPlay: false, isShowLyricTranslation: false, + isS2t: false, // 是否将歌词从简体转换为繁体 isPlayLxlrc: true, isSavePlayTime: false, }, diff --git a/src/lang/en-us.json b/src/lang/en-us.json index cce9ea10..2f9c7007 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -305,6 +305,7 @@ "setting__other_tray_theme_origin": "Primary Color", "setting__play": "Play", "setting__play_lyric_lxlrc": "Use Karaoke-style lyrics playback (if supported)", + "setting__play_lyric_s2t": "Convert the playing and downloading lyrics to Traditional Chinese", "setting__play_lyric_transition": "Show lyrics translation", "setting__play_mediaDevice": "Audio output", "setting__play_mediaDevice_remove_stop_play": "Pause the song when the current sound output device is changed", diff --git a/src/lang/zh-cn.json b/src/lang/zh-cn.json index 50013594..97b2ea9a 100644 --- a/src/lang/zh-cn.json +++ b/src/lang/zh-cn.json @@ -305,6 +305,7 @@ "setting__other_tray_theme_origin": "原色", "setting__play": "播放设置", "setting__play_lyric_lxlrc": "使用卡拉OK式歌词播放(如果支持)", + "setting__play_lyric_s2t": "将播放与下载的歌词转换为繁体中文", "setting__play_lyric_transition": "显示歌词翻译", "setting__play_mediaDevice": "音频输出", "setting__play_mediaDevice_remove_stop_play": "当前的声音输出设备被改变时暂停播放歌曲", diff --git a/src/lang/zh-tw.json b/src/lang/zh-tw.json index b8febb69..bac00931 100644 --- a/src/lang/zh-tw.json +++ b/src/lang/zh-tw.json @@ -305,6 +305,7 @@ "setting__other_tray_theme_origin": "原色", "setting__play": "播放設置", "setting__play_lyric_lxlrc": "使用卡拉OK式歌詞播放(如果支持)", + "setting__play_lyric_s2t": "將播放與下載的歌詞轉換為繁體中文", "setting__play_lyric_transition": "顯示歌詞翻譯", "setting__play_mediaDevice": "音頻輸出", "setting__play_mediaDevice_remove_stop_play": "當前的聲音輸出設備被改變時暫停播放歌曲", diff --git a/src/renderer/core/useApp/usePlayer/usePlayer.js b/src/renderer/core/useApp/usePlayer/usePlayer.js index d0e71468..f16e6b4d 100644 --- a/src/renderer/core/useApp/usePlayer/usePlayer.js +++ b/src/renderer/core/useApp/usePlayer/usePlayer.js @@ -130,7 +130,7 @@ export default ({ setting }) => { getLrc(targetSong).then(({ lyric, tlyric, lxlyric }) => { if (targetSong.songmid !== musicInfo.songmid) return return ( - global.i18n.locale == 'zh-tw' + setting.value.player.isS2t ? Promise.all([ lyric ? langS2T(lyric) : Promise.resolve(''), tlyric ? langS2T(tlyric) : Promise.resolve(''), diff --git a/src/renderer/store/modules/download.js b/src/renderer/store/modules/download.js index b43c7128..19f701e0 100644 --- a/src/renderer/store/modules/download.js +++ b/src/renderer/store/modules/download.js @@ -177,7 +177,7 @@ const handleGetLyric = function(musicInfo, retryedSource = [], originMusic) { }) } -const getLyric = function(musicInfo, isUseOtherSource) { +const getLyric = function(musicInfo, isUseOtherSource, isS2t) { return getLyricFromStorage(musicInfo).then(lrcInfo => { return ( lrcInfo.lyric @@ -194,8 +194,7 @@ const getLyric = function(musicInfo, isUseOtherSource) { return null }) ).then(lrcs => { - if (!lrcs) return lrcs - if (global.i18n.locale != 'zh-tw') return lrcs + if (!lrcs || !isS2t) return lrcs return rendererInvoke(NAMES.mainWindow.lang_s2t, Buffer.from(lrcs.lyric).toString('base64')).then(b64 => Buffer.from(b64, 'base64').toString()).then(lyric => { lrcs.lyric = lyric return lrcs @@ -213,7 +212,7 @@ const fixKgLyric = lrc => /\[00:\d\d:\d\d.\d+\]/.test(lrc) ? lrc.replace(/(?:\[0 * @param {*} filePath * @param {*} isEmbedPic // 是否嵌入图片 */ -const saveMeta = function(downloadInfo, filePath, isUseOtherSource, isEmbedPic, isEmbedLyric) { +const saveMeta = function({ downloadInfo, filePath, isUseOtherSource, isEmbedPic, isEmbedLyric, isS2t }) { if (downloadInfo.metadata.type === 'ape') return const tasks = [ isEmbedPic @@ -229,7 +228,7 @@ const saveMeta = function(downloadInfo, filePath, isUseOtherSource, isEmbedPic, }) : Promise.resolve(), isEmbedLyric - ? getLyric.call(this, downloadInfo.metadata.musicInfo, isUseOtherSource) + ? getLyric.call(this, downloadInfo.metadata.musicInfo, isUseOtherSource, isS2t) : Promise.resolve(), ] Promise.all(tasks).then(([imgUrl, lyrics = {}]) => { @@ -249,8 +248,8 @@ const saveMeta = function(downloadInfo, filePath, isUseOtherSource, isEmbedPic, * @param {*} downloadInfo * @param {*} filePath */ -const downloadLyric = function(downloadInfo, isUseOtherSource, filePath, lrcFormat) { - getLyric.call(this, downloadInfo.metadata.musicInfo, isUseOtherSource).then(lrcs => { +const downloadLyric = function({ downloadInfo, isUseOtherSource, filePath, lrcFormat, isS2t }) { + getLyric.call(this, downloadInfo.metadata.musicInfo, isUseOtherSource, isS2t).then(lrcs => { if (lrcs?.lyric) { lrcs.lyric = fixKgLyric(lrcs.lyric) saveLrc(filePath.replace(/(mp3|flac|ape|wav)$/, 'lrc'), lrcs.lyric, lrcFormat) @@ -408,8 +407,23 @@ const actions = { commit('onCompleted', downloadInfo) dispatch('startTask') - saveMeta.call(_this, downloadInfo, downloadInfo.metadata.filePath, rootState.setting.download.isUseOtherSource, rootState.setting.download.isEmbedPic, rootState.setting.download.isEmbedLyric) - if (rootState.setting.download.isDownloadLrc) downloadLyric.call(_this, downloadInfo, rootState.setting.download.isUseOtherSource, downloadInfo.metadata.filePath, rootState.setting.download.lrcFormat) + saveMeta.call(_this, { + downloadInfo, + filePath: downloadInfo.metadata.filePath, + isUseOtherSource: rootState.setting.download.isUseOtherSource, + isEmbedPic: rootState.setting.download.isEmbedPic, + isEmbedLyric: rootState.setting.download.isEmbedLyric, + isS2t: rootState.setting.player.isS2t, + }) + if (rootState.setting.download.isDownloadLrc) { + downloadLyric.call(_this, { + downloadInfo, + isUseOtherSource: rootState.setting.download.isUseOtherSource, + filePath: downloadInfo.metadata.filePath, + lrcFormat: rootState.setting.download.lrcFormat, + isS2t: rootState.setting.player.isS2t, + }) + } console.log('on complate') }, onError(err) { diff --git a/src/renderer/views/setting/components/SettingPlay.vue b/src/renderer/views/setting/components/SettingPlay.vue index 9f1c795a..c6dc28e4 100644 --- a/src/renderer/views/setting/components/SettingPlay.vue +++ b/src/renderer/views/setting/components/SettingPlay.vue @@ -5,6 +5,8 @@ dd base-checkbox(id="setting_player_save_play_time" v-model="currentStting.player.isSavePlayTime" :label="$t('setting__play_save_play_time')") .gap-top base-checkbox(id="setting_player_lyric_transition" v-model="currentStting.player.isShowLyricTranslation" :label="$t('setting__play_lyric_transition')") + .gap-top + base-checkbox(id="setting_player_lyric_s2t" v-model="currentStting.player.isS2t" :label="$t('setting__play_lyric_s2t')") .gap-top base-checkbox(id="setting_player_lyric_play_lxlrc" v-model="currentStting.player.isPlayLxlrc" :label="$t('setting__play_lyric_lxlrc')") .gap-top