From 06f97eccc8cf7714ee19a6e1a5d418ac2ba192ed Mon Sep 17 00:00:00 2001
From: manonBlanco <blanco@teklia.com>
Date: Wed, 5 Jul 2023 11:14:27 +0200
Subject: [PATCH] Do not download images if they already exist

---
 dan/datasets/extract/utils.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dan/datasets/extract/utils.py b/dan/datasets/extract/utils.py
index e7785f73..90bebb9d 100644
--- a/dan/datasets/extract/utils.py
+++ b/dan/datasets/extract/utils.py
@@ -40,6 +40,9 @@ class EntityType(NamedTuple):
 
 
 def download_image(element: Element, im_path: Path):
+    if im_path.exists():
+        return im_path
+
     tries = 1
     # retry loop
     while True:
-- 
GitLab