diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-11-25 17:24:36 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-11-25 17:24:36 +0100 |
| commit | a26acb22a08bed4ec3f163337e3a6714027deff3 (patch) | |
| tree | 24e99130958a286e0b6696aa9445cd8a21963a77 | |
| parent | ce4b869ba12b41ad73dce2a49a4afc797316f721 (diff) | |
check for completed files on startup
| -rw-r--r-- | scrape-codex.py | 6 |
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) |
