Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ddean2009 committed Jul 24, 2024
1 parent 6e35aba commit 740b935
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __pycache__/
config/sceneconfig.yml
config/sceneconfig_linux.yml
config/config.yml
config/config-back.yml
*.db
temp/*
hunjian_main.py
Expand Down
1 change: 0 additions & 1 deletion config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ publisher:
enable: True
title_prefix: 标题前缀
collection: 集合名称
tags:
douyin:
enable: True
title_prefix: 标题前缀
Expand Down
27 changes: 14 additions & 13 deletions tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,22 @@ def get_file_from_dir(file_dir, extension):
def get_file_map_from_dir(file_dir, extension):
extension_list = [ext.strip() for ext in extension.split(',')]
# 确保提供的是绝对路径
file_dir = os.path.abspath(file_dir)
# 所有文件的列表
file_map = {}

# 遍历file_dir中的文件
for filename in os.listdir(file_dir):
# print('filename:', filename)
file_extension = os.path.splitext(filename)[1]
# 检查文件名是否以img_file_prefix开头 并且后缀是.txt
if file_extension in extension_list:
# 构建完整的文件路径
file_path = os.path.join(file_dir, filename)
# 确保这是一个文件而不是目录
if os.path.isfile(file_path):
file_map[file_path] = os.path.split(file_path)[1]
if file_dir is not None and os.path.exists(file_dir):
file_dir = os.path.abspath(file_dir)

# 遍历file_dir中的文件
for filename in os.listdir(file_dir):
# print('filename:', filename)
file_extension = os.path.splitext(filename)[1]
# 检查文件名是否以img_file_prefix开头 并且后缀是.txt
if file_extension in extension_list:
# 构建完整的文件路径
file_path = os.path.join(file_dir, filename)
# 确保这是一个文件而不是目录
if os.path.isfile(file_path):
file_map[file_path] = os.path.split(file_path)[1]

return file_map

Expand Down

0 comments on commit 740b935

Please sign in to comment.