import os
from iiif_utils import get_imgurls_from_collectionurl, create_paths_from_iiifurls, download_images_multithreded
from time import time

collection_of_colorpostcards = 'https://iiif.onb.ac.at/presentation/collection/labs_postcards_all_color_cards'
start = time()
urls = get_imgurls_from_collectionurl(collection_of_colorpostcards)
dur = time() - start
print(f'downloaded {dur}')
urls = [e.replace('full/full', 'full/256,256') for e in urls]  # downlaod with 256x256

if not os.path.exists('postcards_256'):
    os.makedir('postcards_256')
paths = create_paths_from_iiifurls(urls, 'postcards_256')

download_images_multithreded(urls, paths, 10)
