This commit is contained in:
Hraulein
2026-05-08 16:26:07 +08:00
commit b1e38b8992
14 changed files with 592 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
# src/core/config.py
import configparser
from pathlib import Path
# 获取上一级目录(src)下的 config.ini 绝对路径
_config_file = Path(__file__).parent.parent / 'config.ini'
_parser = configparser.ConfigParser()
# 读取配置文件,指定 utf-8 防止中文乱码
_parser.read(_config_file, encoding='utf-8')
# 解析为 Python 可用的集合与列表
SUPPORTED_EXTS = set(_parser.get('Media', 'supported_exts', fallback='.mkv,.mp4,.avi').split(','))
AD_KEYWORDS = _parser.get('Ads', 'keywords', fallback='TG频道,@yunpantv').split(',')
# 新增 Features 配置解析 (布尔值)
EXTRACT_INTERNAL_SUBS = _parser.getboolean('Features', 'extract_internal_subs', fallback=False)
SKIP_PERFECT_MATCH = _parser.getboolean('Features', 'skip_perfect_match', fallback=True)