From 0628d3533f1e411964fd90421e82fe47f254d6f4 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sat, 10 Aug 2024 14:31:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=AE=BE=E7=BD=AE-=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E8=AE=BE=E7=BD=AE-=E5=90=8C=E6=97=B6=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E4=BB=BB=E5=8A=A1=E6=95=B0=E8=AE=BE=E7=BD=AE=EF=BC=88?= =?UTF-8?q?#1498=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- publish/changeLog.md | 1 + src/lang/en-us.json | 2 ++ src/lang/zh-cn.json | 2 ++ src/lang/zh-tw.json | 2 ++ .../Setting/components/SettingDownload.vue | 21 +++++++++++++++++++ 5 files changed, 28 insertions(+) diff --git a/publish/changeLog.md b/publish/changeLog.md index ccc75078..02ef5fef 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -3,6 +3,7 @@ - 新增 是否将歌词显示在状态栏 设置,默认关闭,该功能只在 MacOS 下可用(#1940) - 新增设置-播放详情页设置-延迟歌词滚动设置(#1985) - 新增鼠标在音量按钮使用滚轮时可以调整音量大小的功能(#2000) +- 新增设置-下载设置-同时下载任务数设置(#1498) ### 优化 diff --git a/src/lang/en-us.json b/src/lang/en-us.json index 3e4b1e4f..dd02def8 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -406,6 +406,8 @@ "setting__download_lyric_format_gbk": "GBK (Try to select this format when Chinese garbled characters appear on some devices)", "setting__download_lyric_format_utf8": "UTF-8", "setting__download_lyric_title": "Select whether to download the lyrics file", + "setting__download_max_num": "Number of simultaneous download tasks (setting too high may result in IP being blocked, depending on the audio source)", + "setting__download_max_num_tip": "Excessively large number of simultaneous downloads may cause your IP to be blocked by the audio source. Do you confirm the modification?", "setting__download_name": "Music file naming", "setting__download_name1": "Title - Artist", "setting__download_name2": "Artist - Title", diff --git a/src/lang/zh-cn.json b/src/lang/zh-cn.json index c4a9f43d..2f0cc8e3 100644 --- a/src/lang/zh-cn.json +++ b/src/lang/zh-cn.json @@ -406,6 +406,8 @@ "setting__download_lyric_format_gbk": "GBK(在某些设备上出现中文乱码时可尝试选择此格式)", "setting__download_lyric_format_utf8": "UTF-8", "setting__download_lyric_title": "是否同时下载歌词文件", + "setting__download_max_num": "同时下载任务数(设置过大可能会导致 IP 被封,这取决于音源)", + "setting__download_max_num_tip": "过大的同时下载数量可能会导致你的 IP 被音源封禁,是否确认修改?", "setting__download_name": "文件命名方式", "setting__download_name1": "歌名 - 歌手", "setting__download_name2": "歌手 - 歌名", diff --git a/src/lang/zh-tw.json b/src/lang/zh-tw.json index 0b8cef77..91ff22e8 100644 --- a/src/lang/zh-tw.json +++ b/src/lang/zh-tw.json @@ -406,6 +406,8 @@ "setting__download_lyric_format_gbk": "GBK(在某些裝置上出現中文亂碼時可嘗試選擇此格式)", "setting__download_lyric_format_utf8": "UTF-8", "setting__download_lyric_title": "是否同時下載歌詞文件", + "setting__download_max_num": "同時下載任務數(設定過大可能會導致 IP 被封,這取決於音源)", + "setting__download_max_num_tip": "過大的同時下載數量可能會導致你的 IP 被音源封禁,是否確認修改?", "setting__download_name": "文件命名方式", "setting__download_name1": "歌名 - 歌手", "setting__download_name2": "歌手 - 歌名", diff --git a/src/renderer/views/Setting/components/SettingDownload.vue b/src/renderer/views/Setting/components/SettingDownload.vue index c5e3a7c7..88d8437e 100644 --- a/src/renderer/views/Setting/components/SettingDownload.vue +++ b/src/renderer/views/Setting/components/SettingDownload.vue @@ -13,6 +13,13 @@ dd(:aria-label="$t('setting__download_path_title')") span.auto-hidden.hover(:class="$style.savePath" :aria-label="$t('setting__download_path_open_label')" @click="openDirInExplorer(appSetting['download.savePath'])") {{ appSetting['download.savePath'] }} .p base-btn.btn(min @click="handleChangeSavePath") {{ $t('setting__download_path_change_btn') }} + +dd + h3#download_max_num {{ $t('setting__download_max_num') }} + div + p + base-selection.gap-left(:class="$style.selectWidth" :model-value="appSetting['download.maxDownloadNum']" :list="maxNums" item-key="id" item-name="id" @change="handleUpdateMaxNum") + dd h3#download_use_other_source | {{ $t('setting__download_use_other_source') }} @@ -59,6 +66,7 @@ import { computed } from '@common/utils/vueTools' import { showSelectDialog, openDirInExplorer } from '@renderer/utils/ipc' import { useI18n } from '@renderer/plugins/i18n' import { appSetting, updateSetting } from '@renderer/store/setting' +import { dialog } from '@renderer/plugins/Dialog' export default { name: 'SettingDownload', @@ -76,6 +84,14 @@ export default { }) } + const maxNums = new Array(6).fill(null).map((_, i) => ({ id: i + 1 })) + const handleUpdateMaxNum = async({ id }) => { + if (id > 3) { + if (!await dialog.confirm(window.i18n.t('setting__download_max_num_tip'))) return + } + updateSetting({ 'download.maxDownloadNum': id }) + } + const musicNames = computed(() => { return [ { value: '歌名 - 歌手', name: t('setting__download_name1') }, @@ -98,6 +114,8 @@ export default { handleChangeSavePath, musicNames, lrcFormatList, + maxNums, + handleUpdateMaxNum, } }, } @@ -107,4 +125,7 @@ export default { // .savePath { // font-size: 12px; // } +.selectWidth { + width: 60px; +}