| 26 | |
| 27 | # ===================== 通用工具函数 ===================== |
| 28 | def get_project_dirs() -> dict: |
| 29 | script_abspath = os.path.abspath(__file__) |
| 30 | root_dir = os.path.dirname(script_abspath) |
| 31 | return { |
| 32 | "root": root_dir, |
| 33 | "blacklist_auto": os.path.join(root_dir, "assets/whitelist-blacklist/blacklist_auto.txt"), |
| 34 | "whitelist_respotime": os.path.join(root_dir, "assets/whitelist-blacklist/whitelist_respotime.txt"), |
| 35 | "blacklist_manual": os.path.join(root_dir, "assets/whitelist-blacklist/blacklist_manual.txt"), |
| 36 | "whitelist_manual": os.path.join(root_dir, "assets/whitelist-blacklist/whitelist_manual.txt"), |
| 37 | "corrections_name": os.path.join(root_dir, "assets/corrections_name.txt"), |
| 38 | "urls": os.path.join(root_dir, "assets/urls.txt"), |
| 39 | "main_channel": os.path.join(root_dir, "主频道"), |
| 40 | "local_channel": os.path.join(root_dir, "地方台") |
| 41 | } |
| 42 | |
| 43 | def read_txt(file_path: str, strip: bool = True, skip_empty: bool = True) -> list: |
| 44 | try: |