Clear blank

This commit is contained in:
Mathhew
2020-09-16 21:46:21 +08:00
parent c153e37ccf
commit c3768a6306

10
core.py
View File

@@ -203,6 +203,7 @@ def create_folder(success_folder, location_rule, json_data, conf: config.Config)
path = success_folder + '/' + location_rule.replace("'actor'", "'manypeople'", 3).replace("actor","'manypeople'",3) # path为影片+元数据所在目录 path = success_folder + '/' + location_rule.replace("'actor'", "'manypeople'", 3).replace("actor","'manypeople'",3) # path为影片+元数据所在目录
else: else:
path = success_folder + '/' + location_rule path = success_folder + '/' + location_rule
path = trimblank(path)
if not os.path.exists(path): if not os.path.exists(path):
path = escape_path(path, conf.escape_literals()) path = escape_path(path, conf.escape_literals())
try: try:
@@ -215,6 +216,15 @@ def create_folder(success_folder, location_rule, json_data, conf: config.Config)
return path return path
def trimblank(s: str):
"""
Clear the blank on the right side of the folder name
"""
if s[-1] == " ":
return trimblank(s[:-1])
else:
return s
# =====================资源下载部分=========================== # =====================资源下载部分===========================
# path = examle:photo , video.in the Project Folder! # path = examle:photo , video.in the Project Folder!