Skip to content

Commit c2ef2dd

Browse files
committed
Normalize dir_rule segments to simplified Chinese to avoid duplicate dirs (use JmcomicText.to_zh_cn)
1 parent f2adb33 commit c2ef2dd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/jmcomic/jm_option.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .jm_client_impl import *
2+
from .jm_toolkit import JmcomicText
23

34

45
class CacheRegistry:
@@ -88,7 +89,14 @@ def apply_rule_to_path(self, album, photo, only_album_rules=False) -> str:
8889
jm_log('dir_rule', f'路径规则"{rule}"的解析出错: {e}, album={album}, photo={photo}')
8990
raise e
9091
if parser != self.parse_bd_rule:
91-
path = fix_windir_name(str(path)).strip()
92+
# 统一将路径段转换为简体,避免繁体/简体导致的重复下载目录
93+
try:
94+
path = JmcomicText.to_zh_cn(str(path))
95+
except Exception:
96+
# 如果转换不可用(例如缺少zhconv),退回原字符串
97+
path = str(path)
98+
99+
path = fix_windir_name(path).strip()
92100

93101
path_ls.append(path)
94102

0 commit comments

Comments
 (0)