feat: 歌曲右键菜单添加下载歌词功能及下载设置中保存歌词文件选项

- 右键菜单新增"下载歌词"选项,支持获取歌词并保存为 .lrc 文件
- 如有翻译歌词会自动合并到 LRC 文件中
- 下载设置面板新增"单独保存歌词文件"开关
- 开启后下载歌曲时自动在同目录生成同名 .lrc 歌词文件
- 主进程新增 save-lyric-file IPC handler
- 完成 5 种语言的国际化翻译
This commit is contained in:
alger
2026-03-16 23:22:17 +08:00
parent b86661ca11
commit 68b3700f3f
17 changed files with 203 additions and 11 deletions
+28 -2
View File
@@ -316,6 +316,21 @@
</div>
</div>
<!-- Save Lyric File -->
<div class="setting-group">
<div class="flex items-center justify-between">
<div>
<h3 class="text-sm font-bold text-neutral-900 dark:text-white">
{{ t('download.settingsPanel.saveLyric') }}
</h3>
<p class="text-xs text-neutral-500 mt-1">
{{ t('download.settingsPanel.saveLyricDesc') }}
</p>
</div>
<n-switch v-model:value="downloadSettings.saveLyric" />
</div>
</div>
<!-- Format Section -->
<div class="setting-group">
<h3 class="text-sm font-bold text-neutral-900 dark:text-white mb-2">
@@ -875,7 +890,8 @@ const showSettingsDrawer = ref(false);
const downloadSettings = ref({
path: '',
nameFormat: '{songName} - {artistName}',
separator: ' - '
separator: ' - ',
saveLyric: false
});
// 格式组件(用于拖拽排序)
@@ -992,6 +1008,11 @@ const saveDownloadSettings = () => {
'set.downloadSeparator',
downloadSettings.value.separator
);
window.electron.ipcRenderer.send(
'set-store-value',
'set.downloadSaveLyric',
downloadSettings.value.saveLyric
);
// 如果是在已下载页面,刷新列表以更新显示
if (tabName.value === 'downloaded') {
@@ -1014,11 +1035,16 @@ const initDownloadSettings = async () => {
'get-store-value',
'set.downloadSeparator'
);
const saveLyric = await window.electron.ipcRenderer.invoke(
'get-store-value',
'set.downloadSaveLyric'
);
downloadSettings.value = {
path: path || (await window.electron.ipcRenderer.invoke('get-downloads-path')),
nameFormat: nameFormat || '{songName} - {artistName}',
separator: separator || ' - '
separator: separator || ' - ',
saveLyric: saveLyric || false
};
// 初始化排序组件