diff --git a/info.yaml b/info.yaml index 25e0324..c0373ba 100644 --- a/info.yaml +++ b/info.yaml @@ -1,5 +1,5 @@ title: "애니 다운로더" -version: "0.5.39" +version: "0.5.40" package_name: "anime_downloader" developer: "projectdx" description: "anime downloader" diff --git a/lib/util.py b/lib/util.py index 410cb0f..76e1954 100644 --- a/lib/util.py +++ b/lib/util.py @@ -58,11 +58,21 @@ class Util(object): @staticmethod def change_text_for_use_filename(text): - # text = text.replace('/', '') - # 2021-07-31 X:X - # text = text.replace(':', ' ') - text = re.sub('[\\/:*?\"<>|]', ' ', text).strip() - text = re.sub("\s{2,}", ' ', text) + # 1. Remove/replace Windows-forbidden characters + text = re.sub('[\\/:*?"<>|]', ' ', text) + + # 2. Remove consecutive dots (.. → .) + text = re.sub(r'\.{2,}', '.', text) + + # 3. Remove leading/trailing dots and spaces + text = text.strip('. ') + + # 4. Collapse multiple spaces to single space + text = re.sub(r'\s{2,}', ' ', text) + + # 5. Remove any remaining trailing dots (after space collapse) + text = text.rstrip('.') + return text @staticmethod