Update data_source.py

This commit is contained in:
HibiKier 2021-08-09 07:50:04 +08:00 committed by GitHub
parent 0455cba221
commit 7148940a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,6 +90,8 @@ async def search_online_setu(
index = random.randint(1, 100000) if id_ is None else id_
path_ = "temp" if not path_ else path_
file = f"{index}_temp_setu.jpg" if not path_ else f"{index}.jpg"
if not os.path.exists(f'{IMAGE_PATH}/path_'):
os.mkdir(f'{IMAGE_PATH}/path_')
async with aiofiles.open(
f"{IMAGE_PATH}/{path_}/{file}", "wb"
) as f: