from BunnyCDN.Storage import Storage
import dump_instagram as storysaver
import time, config

if __name__ == '__main__':
    print('Starting processing...')

    newDB, newCursor = config.gen_connection()

    obj_storage = Storage('345697f9-d9aa-4a6b-a5ec8bffc16d-ceaf-453e', 'storysave')

    newCursor.execute("SELECT media_id FROM media WHERE platform='instagram' AND media_id IS NOT NULL")
    existing_files = [image[0] for image in newCursor.fetchall()]

    while True:
        print("Processing...")
        storysaver.dump_instagram('storysaver/')
        print("Processing completed.")
        time.sleep(15)