예제 #1
0
def main():
    _staff = Staff(CONFIG.STAFF_INDEX)
    for root, dirs, files in os.walk(CUR_DIR+"/data/"):
        for dirct in dirs:
            abs_path = root + f"{dirct}"
            photos = sorted(list_all_photos(abs_path), key=lambda path: int(os.path.basename(path)[:-4]))
            photo_json = retrieve_logo_data(abs_path+"/photo.json")
            if len(photos) > len(photo_json):
                photo_json = []
                for photo in photos:
                    key, url = _staff.upload(photo)
                    # key, url = "key", "url"
                    logger.info("upload %s with key:%s url:%s" % (photo, key, url))
                    photo_json.append(dict(key=key, url=url))
                with open(abs_path+"/photo.json", "w") as f:
                    f.write(json.dumps(photo_json))
            logger.info("==========  Upload %u photo done  ==========" % len(photo_json))
예제 #2
0
def main():
    _staff = Staff(CONFIG.STAFF_INDEX)
    url, key = _staff.upload(CUR_DIR + "/data/white_paper_coin.pdf")
    print("white paper => url:%s key:%s" % (url, key))