if __name__ == "__main__":
    import sqlite3, pathlib

    db_loc = pathlib.Path(__file__).parent.parent.parent / "footviz.db"
    handle = sqlite3.connect(str(db_loc))
    names_read_cursor = handle.execute("SELECT name FROM api_matchreview")
    names = names_read_cursor.fetchall()
    for name_line in names:
        name = name_line[0]
        print(name)
        handle.execute("UPDATE api_matchreview SET thumbnail_url=? where name=?"
                       , (f"./videos/{name}/{name}.jpg",name, )
                       )
        handle.execute("UPDATE api_matchreview SET video_url=? where name=?"
                       , (f"./videos/{name}/{name}.mp4",name, )
                       )
        handle.commit()
    handle.commit()
    handle.close()
