]> git.lizzy.rs Git - nhentai.git/commitdiff
remove repeated spaces
authorRicterZ <ricterzheng@gmail.com>
Mon, 11 Jan 2021 03:04:29 +0000 (11:04 +0800)
committerRicterZ <ricterzheng@gmail.com>
Mon, 11 Jan 2021 03:04:29 +0000 (11:04 +0800)
nhentai/utils.py

index 1ce429878f7dfbd8d7f71cc8fa2cfb5727491925..474ea52e5b3d31da57b1b7de7b385c2c8bada23f 100644 (file)
@@ -241,6 +241,8 @@ def format_filename(s):
     # maybe you can use `--format` to select a suitable filename
     ban_chars = '\\\'/:,;*?"<>|\t'
     filename = s.translate(str.maketrans(ban_chars, ' '*len(ban_chars))).strip()
+    filename = re.sub("\s\s+" , " ", filename)
+
     while filename.endswith('.'):
         filename = filename[:-1]