From b772e2d9ef48a986e89b9f0ccab81ce2b2a9dc3c Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 29 Apr 2025 13:24:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E6=94=AF=E6=8C=81=EF=BC=9A=E4=B8=BA=E5=AD=98=E5=82=A8=E3=80=81?= =?UTF-8?q?=E5=AA=92=E4=BD=93=E7=B1=BB=E5=9E=8B=E3=80=81=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=BC=80=E5=85=B3=E5=8F=8A=E6=93=8D=E4=BD=9C=E6=AD=A5=E9=AA=A4?= =?UTF-8?q?=E7=AD=89=E7=BB=84=E4=BB=B6=E6=B7=BB=E5=8A=A0=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E6=96=87=E6=9C=AC=EF=BC=8C=E6=8F=90=E5=8D=87=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/constants.ts | 321 +++++++++++++++--- src/components/cards/CustomRuleCard.vue | 2 +- src/components/cards/FilterRuleGroupCard.vue | 6 +- src/components/cards/MediaCard.vue | 26 +- src/components/cards/MediaServerCard.vue | 2 +- .../cards/NotificationChannelCard.vue | 2 +- src/components/cards/StorageCard.vue | 8 +- src/components/dialog/ImportCodeDialog.vue | 2 +- src/components/dialog/SearchBarDialog.vue | 2 +- src/components/dialog/SubscribeEditDialog.vue | 86 +---- .../dialog/SubscribeHistoryDialog.vue | 8 +- .../workflow/FilterTorrentsAction.vue | 85 +---- src/layouts/components/WorkflowSidebar.vue | 8 +- src/locales/en-US.ts | 104 ++++-- src/locales/zh-CN.ts | 103 ++++-- src/locales/zh-TW.ts | 104 ++++-- src/plugins/vuetify/defaults.ts | 1 + src/types/i18n-type.ts | 70 ---- .../setting/AccountSettingNotification.vue | 8 +- src/views/setting/AccountSettingRule.vue | 2 + src/views/setting/AccountSettingSystem.vue | 2 +- 21 files changed, 566 insertions(+), 386 deletions(-) delete mode 100644 src/types/i18n-type.ts diff --git a/src/api/constants.ts b/src/api/constants.ts index 007cbc8b..cfa74818 100644 --- a/src/api/constants.ts +++ b/src/api/constants.ts @@ -1,85 +1,304 @@ +import i18n from '@/plugins/i18n' + export const storageOptions = [ { - title: '本地', + title: i18n.global.t('storage.local'), value: 'local', icon: 'mdi-folder-multiple-outline', remote: false, }, { - title: '阿里云盘', + title: i18n.global.t('storage.alipan'), value: 'alipan', icon: 'mdi-cloud-outline', remote: true, }, { - title: '115网盘', + title: i18n.global.t('storage.u115'), value: 'u115', icon: 'mdi-cloud-outline', remote: true, }, { - title: 'RClone', + title: i18n.global.t('storage.rclone'), value: 'rclone', icon: 'mdi-server-network-outline', remote: true, }, { - title: 'AList', + title: i18n.global.t('storage.alist'), value: 'alist', icon: 'mdi-server-network-outline', remote: true, }, ] -export const innerFilterRules = [ - { title: '特效字幕', value: ' SPECSUB ' }, - { title: '中文字幕', value: ' CNSUB ' }, - { title: '国语配音', value: ' CNVOI ' }, - { title: '官种', value: ' GZ ' }, - { title: '排除: 国语配音', value: ' !CNVOI ' }, - { title: '粤语配音', value: ' HKVOI ' }, - { title: '排除: 粤语配音', value: ' !HKVOI ' }, - { title: '促销: 免费', value: ' FREE ' }, - { title: '分辨率: 4K', value: ' 4K ' }, - { title: '分辨率: 1080P', value: ' 1080P ' }, - { title: '分辨率: 720P', value: ' 720P ' }, - { title: '排除: 720P', value: ' !720P ' }, - { title: '质量: 蓝光原盘', value: ' BLU ' }, - { title: '排除: 蓝光原盘', value: ' !BLU ' }, - { title: '质量: BLURAY', value: ' BLURAY ' }, - { title: '排除: BLURAY', value: ' !BLURAY ' }, - { title: '质量: UHD', value: ' UHD ' }, - { title: '排除: UHD', value: ' !UHD ' }, - { title: '质量: REMUX', value: ' REMUX ' }, - { title: '排除: REMUX', value: ' !REMUX ' }, - { title: '质量: WEB-DL', value: ' WEBDL ' }, - { title: '排除: WEB-DL', value: ' !WEBDL ' }, - { title: '质量: 60fps', value: ' 60FPS ' }, - { title: '排除: 60fps', value: ' !60FPS ' }, - { title: '编码: H265', value: ' H265 ' }, - { title: '排除: H265', value: ' !H265 ' }, - { title: '编码: H264', value: ' H264 ' }, - { title: '排除: H264', value: ' !H264 ' }, - { title: '效果: 杜比视界', value: ' DOLBY ' }, - { title: '排除: 杜比视界', value: ' !DOLBY ' }, - { title: '效果: 杜比全景声', value: ' ATMOS ' }, - { title: '排除: 杜比全景声', value: ' !ATMOS ' }, - { title: '效果: HDR', value: ' HDR ' }, - { title: '排除: HDR', value: ' !HDR ' }, - { title: '效果: SDR', value: ' SDR ' }, - { title: '排除: SDR', value: ' !SDR ' }, - { title: '效果: 3D', value: ' 3D ' }, - { title: '排除: 3D', value: ' !3D ' }, -] - export const storageDict = storageOptions.reduce((dict, item) => { dict[item.value] = item.title return dict }, {} as Record) -export const transferTypeOptions = [ - { title: '复制', value: 'copy' }, - { title: '移动', value: 'move' }, - { title: '硬链接', value: 'link' }, - { title: '软链接', value: 'softlink' }, +export const innerFilterRules = [ + { title: i18n.global.t('filterRules.specSub'), value: ' SPECSUB ' }, + { title: i18n.global.t('filterRules.cnSub'), value: ' CNSUB ' }, + { title: i18n.global.t('filterRules.cnVoi'), value: ' CNVOI ' }, + { title: i18n.global.t('filterRules.gz'), value: ' GZ ' }, + { title: i18n.global.t('filterRules.notCnVoi'), value: ' !CNVOI ' }, + { title: i18n.global.t('filterRules.hkVoi'), value: ' HKVOI ' }, + { title: i18n.global.t('filterRules.notHkVoi'), value: ' !HKVOI ' }, + { title: i18n.global.t('filterRules.free'), value: ' FREE ' }, + { title: i18n.global.t('filterRules.resolution4k'), value: ' 4K ' }, + { title: i18n.global.t('filterRules.resolution1080p'), value: ' 1080P ' }, + { title: i18n.global.t('filterRules.resolution720p'), value: ' 720P ' }, + { title: i18n.global.t('filterRules.not720p'), value: ' !720P ' }, + { title: i18n.global.t('filterRules.qualityBlu'), value: ' BLU ' }, + { title: i18n.global.t('filterRules.notBlu'), value: ' !BLU ' }, + { title: i18n.global.t('filterRules.qualityBluray'), value: ' BLURAY ' }, + { title: i18n.global.t('filterRules.notBluray'), value: ' !BLURAY ' }, + { title: i18n.global.t('filterRules.qualityUhd'), value: ' UHD ' }, + { title: i18n.global.t('filterRules.notUhd'), value: ' !UHD ' }, + { title: i18n.global.t('filterRules.qualityRemux'), value: ' REMUX ' }, + { title: i18n.global.t('filterRules.notRemux'), value: ' !REMUX ' }, + { title: i18n.global.t('filterRules.qualityWebdl'), value: ' WEBDL ' }, + { title: i18n.global.t('filterRules.notWebdl'), value: ' !WEBDL ' }, + { title: i18n.global.t('filterRules.quality60fps'), value: ' 60FPS ' }, + { title: i18n.global.t('filterRules.not60fps'), value: ' !60FPS ' }, + { title: i18n.global.t('filterRules.codecH265'), value: ' H265 ' }, + { title: i18n.global.t('filterRules.notH265'), value: ' !H265 ' }, + { title: i18n.global.t('filterRules.codecH264'), value: ' H264 ' }, + { title: i18n.global.t('filterRules.notH264'), value: ' !H264 ' }, + { title: i18n.global.t('filterRules.effectDolby'), value: ' DOLBY ' }, + { title: i18n.global.t('filterRules.notDolby'), value: ' !DOLBY ' }, + { title: i18n.global.t('filterRules.effectAtmos'), value: ' ATMOS ' }, + { title: i18n.global.t('filterRules.notAtmos'), value: ' !ATMOS ' }, + { title: i18n.global.t('filterRules.effectHdr'), value: ' HDR ' }, + { title: i18n.global.t('filterRules.notHdr'), value: ' !HDR ' }, + { title: i18n.global.t('filterRules.effectSdr'), value: ' SDR ' }, + { title: i18n.global.t('filterRules.notSdr'), value: ' !SDR ' }, + { title: i18n.global.t('filterRules.effect3d'), value: ' 3D ' }, + { title: i18n.global.t('filterRules.not3d'), value: ' !3D ' }, ] + +export const transferTypeOptions = [ + { title: i18n.global.t('transferType.copy'), value: 'copy' }, + { title: i18n.global.t('transferType.move'), value: 'move' }, + { title: i18n.global.t('transferType.link'), value: 'link' }, + { title: i18n.global.t('transferType.softlink'), value: 'softlink' }, +] + +export const qualityOptions = ref([ + { + title: i18n.global.t('qualityOptions.all'), + value: '', + }, + { + title: i18n.global.t('qualityOptions.blurayOriginal'), + value: 'Blu-?Ray.+VC-?1|Blu-?Ray.+AVC|UHD.+blu-?ray.+HEVC|MiniBD', + }, + { + title: i18n.global.t('qualityOptions.remux'), + value: 'Remux', + }, + { + title: i18n.global.t('qualityOptions.bluray'), + value: 'Blu-?Ray', + }, + { + title: i18n.global.t('qualityOptions.uhd'), + value: 'UHD|UltraHD', + }, + { + title: i18n.global.t('qualityOptions.webdl'), + value: 'WEB-?DL|WEB-?RIP', + }, + { + title: i18n.global.t('qualityOptions.hdtv'), + value: 'HDTV', + }, + { + title: i18n.global.t('qualityOptions.h265'), + value: '[Hx].?265|HEVC', + }, + { + title: i18n.global.t('qualityOptions.h264'), + value: '[Hx].?264|AVC', + }, +]) + +// 分辨率选择框数据 +export const resolutionOptions = ref([ + { + title: i18n.global.t('resolutionOptions.all'), + value: '', + }, + { + title: i18n.global.t('resolutionOptions.4k'), + value: '4K|2160p|x2160', + }, + { + title: i18n.global.t('resolutionOptions.1080p'), + value: '1080[pi]|x1080', + }, + { + title: i18n.global.t('resolutionOptions.720p'), + value: '720[pi]|x720', + }, +]) + +// 特效选择框数据 +export const effectOptions = ref([ + { + title: i18n.global.t('effectOptions.all'), + value: '', + }, + { + title: i18n.global.t('effectOptions.dolbyVision'), + value: 'Dolby[\\s.]+Vision|DOVI|[\\s.]+DV[\\s.]+', + }, + { + title: i18n.global.t('effectOptions.dolbyAtmos'), + value: 'Dolby[\\s.]*\\+?Atmos|Atmos', + }, + { + title: i18n.global.t('effectOptions.hdr'), + value: '[\\s.]+HDR[\\s.]+|HDR10|HDR10\\+', + }, + { + title: i18n.global.t('effectOptions.sdr'), + value: '[\\s.]+SDR[\\s.]+', + }, +]) + +// 媒体类型选项 +export const mediaTypeOptions = [ + { + title: i18n.global.t('mediaType.movie'), + value: '电影', + }, + { + title: i18n.global.t('mediaType.tv'), + value: '电视剧', + }, + { + title: i18n.global.t('mediaType.anime'), + value: '动漫', + }, + { + title: i18n.global.t('mediaType.collection'), + value: '合集', + }, + { + title: i18n.global.t('mediaType.unknown'), + value: '未知', + }, +] + +// 媒体类型字典 +export const mediaTypeDict = mediaTypeOptions.reduce((dict, item) => { + dict[item.value] = item.title + return dict +}, {} as Record) + +// 通知开关选项 +export const notificationSwitchOptions = [ + { + title: i18n.global.t('notificationSwitch.resourceDownload'), + value: '资源下载', + }, + { + title: i18n.global.t('notificationSwitch.organize'), + value: '整理入库', + }, + { + title: i18n.global.t('notificationSwitch.subscribe'), + value: '订阅', + }, + { + title: i18n.global.t('notificationSwitch.site'), + value: '站点', + }, + { + title: i18n.global.t('notificationSwitch.mediaServer'), + value: '媒体服务器', + }, + { + title: i18n.global.t('notificationSwitch.manual'), + value: '手动处理', + }, + { + title: i18n.global.t('notificationSwitch.plugin'), + value: '插件', + }, + { + title: i18n.global.t('notificationSwitch.other'), + value: '其它', + }, +] + +// 通知开关字典 +export const notificationSwitchDict = notificationSwitchOptions.reduce((dict, item) => { + dict[item.value] = item.title + return dict +}, {} as Record) + +// 操作步骤选项 +export const actionStepOptions = [ + { + title: i18n.global.t('actionStep.addDownload'), + value: '添加下载', + }, + { + title: i18n.global.t('actionStep.addSubscribe'), + value: '添加订阅', + }, + { + title: i18n.global.t('actionStep.fetchDownloads'), + value: '获取下载任务', + }, + { + title: i18n.global.t('actionStep.fetchMedias'), + value: '获取媒体数据', + }, + { + title: i18n.global.t('actionStep.fetchRss'), + value: '获取RSS资源', + }, + { + title: i18n.global.t('actionStep.fetchTorrents'), + value: '搜索站点资源', + }, + { + title: i18n.global.t('actionStep.filterMedias'), + value: '过滤媒体数据', + }, + { + title: i18n.global.t('actionStep.filterTorrents'), + value: '过滤资源', + }, + { + title: i18n.global.t('actionStep.scanFile'), + value: '扫描目录', + }, + { + title: i18n.global.t('actionStep.scrapeFile'), + value: '刮削文件', + }, + { + title: i18n.global.t('actionStep.sendEvent'), + value: '发送事件', + }, + { + title: i18n.global.t('actionStep.sendMessage'), + value: '发送消息', + }, + { + title: i18n.global.t('actionStep.transferFile'), + value: '整理文件', + }, +] + +// 操作步骤字典 +export const actionStepDict = actionStepOptions.reduce((dict, item) => { + dict[item.value] = item.title + return dict +}, {} as Record) diff --git a/src/components/cards/CustomRuleCard.vue b/src/components/cards/CustomRuleCard.vue index f0029911..90467aa9 100644 --- a/src/components/cards/CustomRuleCard.vue +++ b/src/components/cards/CustomRuleCard.vue @@ -106,7 +106,7 @@ function onClose() { - + diff --git a/src/components/cards/FilterRuleGroupCard.vue b/src/components/cards/FilterRuleGroupCard.vue index 06d99ed6..58198c5e 100644 --- a/src/components/cards/FilterRuleGroupCard.vue +++ b/src/components/cards/FilterRuleGroupCard.vue @@ -219,7 +219,7 @@ function onClose() { - + @@ -228,9 +228,9 @@ function onClose() { diff --git a/src/components/cards/MediaCard.vue b/src/components/cards/MediaCard.vue index f7e80b93..20568121 100644 --- a/src/components/cards/MediaCard.vue +++ b/src/components/cards/MediaCard.vue @@ -14,7 +14,7 @@ import SubscribeEditDialog from '../dialog/SubscribeEditDialog.vue' import SearchSiteDialog from '@/components/dialog/SearchSiteDialog.vue' import SubscribeSeasonDialog from '../dialog/SubscribeSeasonDialog.vue' import { useI18n } from 'vue-i18n' -import { getMediaTypeText } from '@/types/i18n-type' +import { mediaTypeDict } from '@/api/constants' // 国际化 const { t } = useI18n() @@ -402,15 +402,6 @@ function setupIntersectionObserver() { } } -onMounted(() => { - setupIntersectionObserver() -}) - -onBeforeUnmount(() => { - observer.value?.disconnect() - observer.value = null -}) - // 计算图片地址 const getImgUrl: Ref = computed(() => { if (imageLoadError.value) return noImage @@ -428,6 +419,21 @@ const getImgUrl: Ref = computed(() => { function onRemoveSubscribe() { subscribeEditDialog.value = false } + +// 获取媒体类型文本 +function getMediaTypeText(type: string | undefined) { + if (!type) return '' + return mediaTypeDict[type] +} + +onMounted(() => { + setupIntersectionObserver() +}) + +onBeforeUnmount(() => { + observer.value?.disconnect() + observer.value = null +})