def schedule():
    data = request.get_json()
    token = data.get("token")
    user_info = Users.authenticate(token)
    user = Users(user_info[0][1],
                 user_info[0][2],
                 user_info[0][4],
                 twitch_id=user_info[0][3])
    # get schedule info from react the "data" coming in will need to have a lot of info
    # i.e. date, a time slots array, a performers array, user_id will come from the auth here in the route,
    # and the unique sked_id generated here:
    sk_id = sked_id_gen()
    # print(sk_id)
    time_slots = data.get("timeSlots")
    # print(time_slots)
    performers = data.get("performers")
    # print(performers)
    print(user_info[0][3], data.get("date"), time_slots[0], performers[0])
    for i in range(len(time_slots)):
        sked = Schedule(user_info[0][3],
                        data.get("date"),
                        time_slots[i],
                        performers[i],
                        sked_id=sk_id)
        sked._insert()
    return jsonify({"create": "successful", "sk_id": sk_id})
def logout():
    data = request.get_json()
    token = data.get("token")
    user_info = Users.authenticate(token)
    user = Users(user_info[0][1], user_info[0][2], user_info[0][4])
    user.logout()
    return jsonify({"logout": "successful"})
def get_my_performers():
    data = request.get_json()
    token = data.get("token")
    user_info = Users.authenticate(token)
    user = Users(user_info[0][1],
                 user_info[0][2],
                 user_info[0][4],
                 twitch_id=user_info[0][3])
    performers = user.my_performers(user_info[0][3])
    # return all those performers to React
    return jsonify(performers)
def synch_performers():
    data = request.get_json()
    token = data.get("token")
    user_info = Users.authenticate(token)
    user = Users(user_info[0][1],
                 user_info[0][2],
                 user_info[0][4],
                 twitch_id=user_info[0][3])
    # make call to twitch for all the artists this user follows
    status = user.performers_by_music(user_info[0][3])
    # return all user follows from DB
    # performers = user.my_performers(user_info[0][3])
    if status:
        return jsonify({"synch": "successful"})
    else:
        return jsonify({"synch": ""})