def read_metadata(file_root, cities, url_field):
    metadata = {}
    urls = {}
    for city in cities:
        urls[city] = set()
        file_path = f'{file_root}/{city}/metadata.json'
        if os.path.exists(file_path):
            with open(file_path, 'r') as f:
                loaded = json.load(f)
                for img in loaded['images']:
                    if ((url_field in img) and (not (img[url_field] in urls))):
                        urls[city].add(img[url_field])
                metadata[city] = loaded
    return (metadata, urls)
def read_metadata(file_root, cities, url_field):
    metadata = {}
    urls = {}
    for city in cities:
        urls[city] = set()
        file_path = f'{file_root}/{city}/metadata.json'
        if os.path.exists(file_path):
            with open(file_path, 'r') as f:
                loaded = json.load(f)
                for img in loaded['images']:
                    if ((url_field in img) and (not (img[url_field] in urls))):
                        urls[city].add(img[url_field])
                metadata[city] = loaded
    return (metadata, urls)