Exemplo n.º 1
0
def loading(state):
    state.currentUser, state.userList, newUser = startup.getUser(state)
    if newUser:
        state.currentPage = constants.Page.ENTERNAME
        state.userList.append(state.currentUser)
    else:
        state.currentPage = constants.Page.HOME
Exemplo n.º 2
0
def main():
    directory = os.path.dirname(os.path.abspath(__file__)) + "\\users"
    state = systemState.SystemState()
    state.currentUser, state.userList, newUser = startup.getUser()
    if newUser:
        state.currentPage = constants.Page.ENTERNAME
    else:
        state.currentPage = constants.Page.HOME

    motionThread = threading.Thread(target=motionTracking, args=(state, ))
    logicThread = threading.Thread(target=changeData, args=(state, ))

    motionThread.start()
    logicThread.start()
    motionThread.join()
    logicThread.join()

    pickle.dump(state.currentUser,
                open("users\\" + state.currentUser.name, 'wb'))
Exemplo n.º 3
0
def main():
    response = startup.getUser()
    token = startup.getAccessToken()
    if len(token) == 0:
        return redirect(url_for('index'))
    access_token = token[0]
    artists = plotify_data.get_top_genres(access_token)
    genres = [item[1] for item in artists][:10]
    username, prof_pic = plotify_data.get_username(access_token)
    stracks = plotify_data.get_top_tracks(access_token, 'short_term')
    sartists = plotify_data.get_top_artists(access_token, 'short_term')
    mtracks = plotify_data.get_top_tracks(access_token, 'medium_term')
    martists = plotify_data.get_top_artists(access_token, 'medium_term')
    ltracks = plotify_data.get_top_tracks(access_token, 'long_term')
    lartists = plotify_data.get_top_artists(access_token, 'long_term')
    years, count = plotify_data.get_track_data(access_token, 'long_term')
    legend = 'Tracks by Year'
    danceable, averaged, plist_names = plotify_data.get_playlist_metrics(
        access_token)
    radar_labels = [
        'danceability', 'energy', 'speechiness', 'acousticness',
        'instrumentalness', 'liveness', 'valence'
    ]
    return render_template('index.html',
                           username=username,
                           genres=genres,
                           stracks=stracks,
                           sartists=sartists,
                           mtracks=mtracks,
                           martists=martists,
                           ltracks=ltracks,
                           lartists=lartists,
                           prof_pic=prof_pic,
                           values=count,
                           labels=years,
                           legend=legend,
                           danceable=danceable,
                           averaged=averaged,
                           radar_labels=radar_labels,
                           plist_names=plist_names)
Exemplo n.º 4
0
def index():
    response = startup.getUser()
    return redirect(response)
Exemplo n.º 5
0
def spotify_login():
    response = startup.getUser()
Exemplo n.º 6
0
def performOAuth():
    response = startup.getUser()
    return redirect(response)