summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scrape-codex.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scrape-codex.py b/scrape-codex.py
index ffec8f7..619f452 100644
--- a/scrape-codex.py
+++ b/scrape-codex.py
@@ -61,6 +61,10 @@ def load_image(fn):
# Fetch all the tiles from a tile server and then compose them into a single image
def grab(s, n):
+ out_fn = "./{}/{}/{}_{}.jpg".format(TAG, ZOOM, page, ZOOM)
+ if os.path.exists(out_fn):
+ return
+
page = "{:03d}{}".format(n, s)
print("Fetching {}...".format(page))
os.makedirs("./{}/{}/{}".format(TAG, ZOOM, page), exist_ok=True)
@@ -102,7 +106,7 @@ def grab(s, n):
canvas.paste(image, (x, y))
y += height
x += width
- canvas.save("./{}/{}/{}_{}.jpg".format(TAG, ZOOM, page, ZOOM))
+ canvas.save(out_fn)
if __name__ == '__main__':
os.makedirs("{}/{}".format(TAG, ZOOM), exist_ok=True)