diff --git a/src/api/types.ts b/src/api/types.ts index e9dd2908..7a2fe72b 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -1445,4 +1445,18 @@ export interface ApiResponse { success: boolean message?: string data: T -} \ No newline at end of file +} +// 分类规则 +export interface CategoryRule { + genre_ids?: string + original_language?: string + production_countries?: string + origin_country?: string + release_year?: string +} + +// 分类配置 +export interface CategoryConfig { + movie?: { [key: string]: CategoryRule } + tv?: { [key: string]: CategoryRule } +} diff --git a/src/components/dialog/CategoryEditDialog.vue b/src/components/dialog/CategoryEditDialog.vue new file mode 100644 index 00000000..65fb398b --- /dev/null +++ b/src/components/dialog/CategoryEditDialog.vue @@ -0,0 +1,659 @@ + + + + + diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index bfed863a..9f39853d 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -1700,6 +1700,25 @@ export default { storageSaveSuccess: 'Storage settings saved successfully', storageSaveFailed: 'Failed to save storage settings!', }, + category: { + title: 'Category Policy', + subtitle: 'Configure media auto-categorization rules by type, language, region, etc.', + movie: 'Movies', + tv: 'TV Shows', + name: 'Category Name (Directory)', + genre: 'Genre', + language: 'Language', + languagePlaceholder: 'e.g., en,fr,zh (comma separated)', + country: 'Country/Region', + countryPlaceholder: 'e.g., US,CN,JP', + year: 'Year', + yearPlaceholder: 'e.g., 2023, 2020-2024', + addMovie: 'Add Movie Category', + addTv: 'Add TV Category', + saveSuccess: 'Category policy saved successfully', + loadFailed: 'Failed to load category configuration', + saveFailed: 'Save failed: {message}', + }, rule: { customRules: 'Custom Rules', customRulesDesc: 'Custom priority rule items', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 61185930..f6cd2347 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -1677,6 +1677,25 @@ export default { storageSaveSuccess: '存储设置保存成功', storageSaveFailed: '存储设置保存失败!', }, + category: { + title: '分类策略', + subtitle: '配置媒体自动分类规则,按类型、语言、地区等条件自动归类', + movie: '电影 (Movie)', + tv: '电视剧 (TV)', + name: '分类名称 (目录名)', + genre: '内容类型 (Genre)', + language: '语种 (Language)', + languagePlaceholder: '如: zh,cn,en (使用逗号分隔)', + country: '国家/地区 (Country)', + countryPlaceholder: '如: US,CN,JP', + year: '年份 (Year)', + yearPlaceholder: '如: 2023, 2020-2024', + addMovie: '添加电影分类', + addTv: '添加电视剧分类', + saveSuccess: '分类策略保存成功', + loadFailed: '加载分类配置失败', + saveFailed: '保存失败: {message}', + }, rule: { customRules: '自定义规则', customRulesDesc: '自定义优先级规则项', @@ -3169,3 +3188,7 @@ export default { }, }, } + +// Apply patch to add category strings +// This is a temporary placeholder command to show intent. +// I will use replace_file_content to actually edit the file safely. diff --git a/src/locales/zh-TW.ts b/src/locales/zh-TW.ts index d338702c..26d8fd0b 100644 --- a/src/locales/zh-TW.ts +++ b/src/locales/zh-TW.ts @@ -1678,6 +1678,25 @@ export default { storageSaveSuccess: '存儲設置保存成功', storageSaveFailed: '存儲設置保存失敗!', }, + category: { + title: '分類策略', + subtitle: '配置媒體自動分類規則,按類型、語言、地區等條件自動歸類', + movie: '電影 (Movie)', + tv: '電視劇 (TV)', + name: '分類名稱 (目錄名)', + genre: '內容類型 (Genre)', + language: '語種 (Language)', + languagePlaceholder: '如: zh,cn,en (使用逗號分隔)', + country: '國家/地區 (Country)', + countryPlaceholder: '如: US,CN,JP', + year: '年份 (Year)', + yearPlaceholder: '如: 2023, 2020-2024', + addMovie: '添加電影分類', + addTv: '添加電視劇分類', + saveSuccess: '分類策略保存成功', + loadFailed: '加載分類配置失敗', + saveFailed: '保存失敗: {message}', + }, rule: { customRules: '自定義規則', customRulesDesc: '自定義優先級規則項', diff --git a/src/views/setting/AccountSettingDirectory.vue b/src/views/setting/AccountSettingDirectory.vue index d61755b8..e08b88bc 100644 --- a/src/views/setting/AccountSettingDirectory.vue +++ b/src/views/setting/AccountSettingDirectory.vue @@ -8,6 +8,7 @@ import { TransferDirectoryConf, StorageConf } from '@/api/types' import DirectoryCard from '@/components/cards/DirectoryCard.vue' import StorageCard from '@/components/cards/StorageCard.vue' import ProgressDialog from '@/components/dialog/ProgressDialog.vue' +import CategoryEditDialog from '@/components/dialog/CategoryEditDialog.vue' import { useI18n } from 'vue-i18n' import { storageAttributes } from '@/api/constants' @@ -28,6 +29,9 @@ const $toast = useToast() // 进度框 const progressDialog = ref(false) +// 分类编辑对话框 +const categoryDialog = ref(false) + // 数据源 const sourceItems = [ { 'title': 'TheMovieDb', 'value': 'themoviedb' }, @@ -292,7 +296,12 @@ onMounted(() => { :directory="element" :categories="mediaCategories" :storages="storages" - @update:modelValue="(value: any) => {element.download_path = value?.download; element.library_path = value?.library}" + @update:modelValue=" + (value: any) => { + element.download_path = value?.download + element.library_path = value?.library + } + " @close="removeDirectory(element)" /> @@ -304,9 +313,13 @@ onMounted(() => { {{ t('common.save') }} - + + + + {{ t('setting.category.title') }} + @@ -370,4 +383,12 @@ onMounted(() => { + +