添加为指定字幕添加.default后缀设置为默认字幕功能

This commit is contained in:
Mister-album
2025-02-14 19:58:29 +08:00
parent b8f4cd5fea
commit 6cee308894
3 changed files with 13 additions and 5 deletions
+2
View File
@@ -255,6 +255,8 @@ class ConfigModel(BaseModel):
) )
# 启用分词搜索 # 启用分词搜索
TOKENIZED_SEARCH: bool = False TOKENIZED_SEARCH: bool = False
# 为指定默认字幕添加.default后缀,默认不启用
DEFAULT_SUB: Optional[str] = None
class Settings(BaseSettings, ConfigModel, LogConfigModel): class Settings(BaseSettings, ConfigModel, LogConfigModel):
+9 -5
View File
@@ -676,11 +676,15 @@ class FileManagerModule(_ModuleBase):
".zh-tw": ".繁体中文" ".zh-tw": ".繁体中文"
} }
new_sub_tag_list = [ new_sub_tag_list = [
new_file_type if t == 0 else "%s%s(%s)" % (new_file_type, (".default" + new_file_type if (
new_sub_tag_dict.get( (settings.DEFAULT_SUB == "zh-cn" and new_file_type == ".chi.zh-cn") or
new_file_type, "" (settings.DEFAULT_SUB == "zh-tw" and new_file_type == ".zh-tw") or
), (settings.DEFAULT_SUB == "eng" and new_file_type == ".eng")
t) for t in range(6) ) 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: for new_sub_tag in new_sub_tag_list:
new_file: Path = target_file.with_name(target_file.stem + new_sub_tag + file_ext) new_file: Path = target_file.with_name(target_file.stem + new_sub_tag + file_ext)
+2
View File
@@ -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 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时其中一个名称搜索到结果或全部名称搜索完毕即停止 # 搜索多个名称,true/false,为true时搜索时会同时搜索中英文及原始名称,搜索结果会更全面,但会增加搜索时间;为false时其中一个名称搜索到结果或全部名称搜索完毕即停止
SEARCH_MULTIPLE_NAME=true SEARCH_MULTIPLE_NAME=true
# 为指定字幕添加.default后缀设置为默认字幕,支持为'zh-cn''zh-tw''eng'添加默认字幕,未定义或设置为None则不添加
DEFAULT_SUB=None