diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index bed4dfe3..7b749c7a 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -1528,6 +1528,11 @@ export default { episodeThumb: 'Thumb', scrapingSwitchSaveFailed: 'Scraping switch settings save failed: {message}', scrapingSwitchSaveError: 'Scraping switch settings save failed', + policy: { + skipDesc: 'Skip scraping, this file will not be generated', + missingOnlyDesc: 'Scrape only if missing, existing file remains unchanged', + overwriteDesc: 'Always scrape, existing file will be overwritten', + } }, site: { siteSync: 'Site Synchronization', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 225c8fb1..e14477ec 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -1515,6 +1515,11 @@ export default { episodeThumb: '缩略图', scrapingSwitchSaveFailed: '刮削开关设置保存失败:{message}', scrapingSwitchSaveError: '刮削开关设置保存失败', + policy: { + skipDesc: '跳过刮削,不生成该文件', + missingOnlyDesc: '仅在缺失时刮削,已存在则保持不变', + overwriteDesc: '始终刮削,已存在则覆盖', + } }, site: { siteSync: '站点同步', diff --git a/src/locales/zh-TW.ts b/src/locales/zh-TW.ts index 127b4c95..699282a2 100644 --- a/src/locales/zh-TW.ts +++ b/src/locales/zh-TW.ts @@ -1516,6 +1516,11 @@ export default { episodeThumb: '縮略圖', scrapingSwitchSaveFailed: '刮削開關設定保存失敗:{message}', scrapingSwitchSaveError: '刮削開關設定保存失敗', + policy: { + skipDesc: '跳過刮削,不生成該文件', + missingOnlyDesc: '僅在缺失時刮削,已存在則保持不變', + overwriteDesc: '始終刮削,已存在則覆蓋', + } }, site: { siteSync: '站點同步', diff --git a/src/views/setting/AccountSettingSystem.vue b/src/views/setting/AccountSettingSystem.vue index 31fa6d2b..29b811b4 100644 --- a/src/views/setting/AccountSettingSystem.vue +++ b/src/views/setting/AccountSettingSystem.vue @@ -85,28 +85,57 @@ const SystemSettings = ref({ }, }) -// 刮削开关设置 -const ScrapingSwitchs = ref({ - movie_nfo: true, // 电影NFO - movie_poster: true, // 电影海报 - movie_backdrop: true, // 电影背景图 - movie_logo: true, // 电影Logo - movie_disc: true, // 电影光盘图 - movie_banner: true, // 电影横幅图 - movie_thumb: true, // 电影缩略图 - tv_nfo: true, // 电视剧NFO - tv_poster: true, // 电视剧海报 - tv_backdrop: true, // 电视剧背景图 - tv_banner: true, // 电视剧横幅图 - tv_logo: true, // 电视剧Logo - tv_thumb: true, // 电视剧缩略图 - season_nfo: true, // 季NFO - season_poster: true, // 季海报 - season_banner: true, // 季横幅图 - season_thumb: true, // 季缩略图 - episode_nfo: true, // 集NFO - episode_thumb: true, // 集缩略图 -}) +// 刮削配置 +const scrapingConfig = [ + { + section: 'movie', + items: [ + { key: 'movie_nfo', label: 'setting.system.movieNfo' }, + { key: 'movie_poster', label: 'setting.system.moviePoster' }, + { key: 'movie_backdrop', label: 'setting.system.movieBackdrop' }, + { key: 'movie_logo', label: 'setting.system.movieLogo' }, + { key: 'movie_disc', label: 'setting.system.movieDisc' }, + { key: 'movie_banner', label: 'setting.system.movieBanner' }, + { key: 'movie_thumb', label: 'setting.system.movieThumb' }, + ], + }, + { + section: 'tv', + items: [ + { key: 'tv_nfo', label: 'setting.system.tvNfo' }, + { key: 'tv_poster', label: 'setting.system.tvPoster' }, + { key: 'tv_backdrop', label: 'setting.system.tvBackdrop' }, + { key: 'tv_banner', label: 'setting.system.tvBanner' }, + { key: 'tv_logo', label: 'setting.system.tvLogo' }, + { key: 'tv_thumb', label: 'setting.system.tvThumb' }, + ], + }, + { + section: 'season', + items: [ + { key: 'season_nfo', label: 'setting.system.seasonNfo' }, + { key: 'season_poster', label: 'setting.system.seasonPoster' }, + { key: 'season_banner', label: 'setting.system.seasonBanner' }, + { key: 'season_thumb', label: 'setting.system.seasonThumb' }, + ], + }, + { + section: 'episode', + items: [ + { key: 'episode_nfo', label: 'setting.system.episodeNfo' }, + { key: 'episode_thumb', label: 'setting.system.episodeThumb' }, + ], + }, +] + +// 刮削策略设置 +const ScrapingPolicies = ref>( + Object.fromEntries( + scrapingConfig.flatMap(section => + section.items.map(item => [item.key, 'missingOnly']) + ) + ) +) // 是否发送请求的总开关 const isRequest = ref(true) @@ -481,7 +510,13 @@ async function loadScrapingSwitchs() { try { const result: { [key: string]: any } = await api.get('system/setting/ScrapingSwitchs') if (result.success && result.data?.value) { - ScrapingSwitchs.value = { ...ScrapingSwitchs.value, ...result.data.value } + const loadedSwitches = result.data.value + for (const key in loadedSwitches) { + if (typeof loadedSwitches[key] === 'boolean') { // 兼容旧数据 + loadedSwitches[key] = loadedSwitches[key] ? 'missingOnly' : 'skip' + } + } + ScrapingPolicies.value = { ...ScrapingPolicies.value, ...loadedSwitches } } } catch (error) { console.log(error) @@ -491,7 +526,7 @@ async function loadScrapingSwitchs() { // 保存刮削开关设置 async function saveScrapingSwitchs() { try { - const result: { [key: string]: any } = await api.post('system/setting/ScrapingSwitchs', ScrapingSwitchs.value) + const result: { [key: string]: any } = await api.post('system/setting/ScrapingSwitchs', ScrapingPolicies.value) if (result.success) { return true } else { @@ -1120,173 +1155,64 @@ onDeactivated(() => { - + + {{ t('setting.system.scrapingSwitchSettings') }} + + + +
+
+ + {{ t('setting.system.policy.skipDesc') }} +
+
+ + {{ t('setting.system.policy.missingOnlyDesc') }} +
+
+ + {{ t('setting.system.policy.overwriteDesc') }} +
+
+
- + - {{ t('setting.system.movie') }} + {{ t(`setting.system.${section.section}`) }} - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{ t('setting.system.tv') }} - - - - - - - - - - - - - - - - - - - - - - - - - - {{ t('setting.system.season') }} - - - - - - - - - - - - - - - - - - - - {{ t('setting.system.episode') }} - - - - - - + +
+ + + + + + {{ t(item.label) }} +
+