Skip to content

Commit

Permalink
fix: 添加Exif信息填充条件检查,仅支持特定文件类型
Browse files Browse the repository at this point in the history
  • Loading branch information
Coooolfan committed Dec 16, 2024
1 parent b8dde7b commit 0fbf449
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ async def download_and_save_media(media: Media):
f.write(resp3.content)
media.downloaded = True
media.save()
fill_exif(media, target_file_path)
# 检查文件类型是否允许填充Exif信息(此由piexif限制)
if any(ext in media.mime_type for ext in ["jpeg", "jpg", "tif", "tiff"]):
fill_exif(media, target_file_path)
# print(f"文件{"media/" + media.filename}下载完成")
except Exception as e:
print(f"文件{media.filename}下载失败,原因:{e}\n ")
Expand Down

0 comments on commit 0fbf449

Please sign in to comment.