From 6cee308894015cb3949059f764a30f275f83a0e1 Mon Sep 17 00:00:00 2001 From: Mister-album Date: Fri, 14 Feb 2025 19:58:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=BA=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E5=AD=97=E5=B9=95=E6=B7=BB=E5=8A=A0.default=E5=90=8E=E7=BC=80?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=E9=BB=98=E8=AE=A4=E5=AD=97=E5=B9=95?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 2 ++ app/modules/filemanager/__init__.py | 14 +++++++++----- config/app.env | 2 ++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 41ba137d..bd8133b8 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -255,6 +255,8 @@ class ConfigModel(BaseModel): ) # 启用分词搜索 TOKENIZED_SEARCH: bool = False + # 为指定默认字幕添加.default后缀,默认不启用 + DEFAULT_SUB: Optional[str] = None class Settings(BaseSettings, ConfigModel, LogConfigModel): diff --git a/app/modules/filemanager/__init__.py b/app/modules/filemanager/__init__.py index 5749bbe4..fb309c96 100644 --- a/app/modules/filemanager/__init__.py +++ b/app/modules/filemanager/__init__.py @@ -676,11 +676,15 @@ class FileManagerModule(_ModuleBase): ".zh-tw": ".繁体中文" } new_sub_tag_list = [ - new_file_type if t == 0 else "%s%s(%s)" % (new_file_type, - new_sub_tag_dict.get( - new_file_type, "" - ), - t) for t in range(6) + (".default" + new_file_type if ( + (settings.DEFAULT_SUB == "zh-cn" and new_file_type == ".chi.zh-cn") or + (settings.DEFAULT_SUB == "zh-tw" and new_file_type == ".zh-tw") or + (settings.DEFAULT_SUB == "eng" and new_file_type == ".eng") + ) else new_file_type) if t == 0 else "%s%s(%s)" % (new_file_type, + new_sub_tag_dict.get( + new_file_type, "" + ), + t) for t in range(6) ] for new_sub_tag in new_sub_tag_list: new_file: Path = target_file.with_name(target_file.stem + new_sub_tag + file_ext) diff --git a/config/app.env b/config/app.env index 4786acde..6a40d863 100644 --- a/config/app.env +++ b/config/app.env @@ -63,3 +63,5 @@ OCR_HOST=https://movie-pilot.org PLUGIN_MARKET=https://github.com/jxxghp/MoviePilot-Plugins,https://github.com/thsrite/MoviePilot-Plugins,https://github.com/InfinityPacer/MoviePilot-Plugins,https://github.com/honue/MoviePilot-Plugins # 搜索多个名称,true/false,为true时搜索时会同时搜索中英文及原始名称,搜索结果会更全面,但会增加搜索时间;为false时其中一个名称搜索到结果或全部名称搜索完毕即停止 SEARCH_MULTIPLE_NAME=true +# 为指定字幕添加.default后缀设置为默认字幕,支持为'zh-cn','zh-tw','eng'添加默认字幕,未定义或设置为None则不添加 +DEFAULT_SUB=None