fix
This commit is contained in:
parent
b695764e00
commit
fc78bcada6
@ -37,7 +37,7 @@ def download_image(image_url, dst_dir, file_name, timeout=20, proxy_type=None, p
|
|||||||
response = None
|
response = None
|
||||||
file_path = os.path.join(dst_dir, file_name)
|
file_path = os.path.join(dst_dir, file_name)
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
print("文件已存在,已跳过=",file_path)
|
print("download_image 文件已存在,已跳过=",file_path)
|
||||||
return None
|
return None
|
||||||
temp_path = os.path.join(dst_dir, file_name+".downloads")
|
temp_path = os.path.join(dst_dir, file_name+".downloads")
|
||||||
repair_count = 1
|
repair_count = 1
|
||||||
@ -87,8 +87,12 @@ def download_images(image_urls, dst_dir, file_prefix="img", concurrency=50, time
|
|||||||
if not os.path.exists(dst_dir):
|
if not os.path.exists(dst_dir):
|
||||||
os.makedirs(dst_dir)
|
os.makedirs(dst_dir)
|
||||||
for image_url in image_urls:
|
for image_url in image_urls:
|
||||||
file_name = filesName[count]
|
file_name = filesName[count]
|
||||||
future_list.append(executor.submit(
|
file_path = os.path.join(dst_dir, file_name)
|
||||||
|
if os.path.exists(file_path):
|
||||||
|
print("文件已存在,已跳过=",file_path)
|
||||||
|
else:
|
||||||
|
future_list.append(executor.submit(
|
||||||
download_image, image_url, dst_dir, file_name, timeout, proxy_type, proxy))
|
download_image, image_url, dst_dir, file_name, timeout, proxy_type, proxy))
|
||||||
count += 1
|
count += 1
|
||||||
concurrent.futures.wait(future_list, timeout)
|
concurrent.futures.wait(future_list, timeout)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user