def index(): me = app_friends = access_token = None access_token = get_access_token() if access_token: me = fb_call('me', args={'access_token': access_token}) app_friends = fql( "SELECT uid, name, is_app_user, pic_square " "FROM user " "WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND " " is_app_user = 1", access_token) r = connect_redis() playlists = db.get_recent_playlists(r, 0, 100) playlists.sort(key=lambda playlist: playlist.score, reverse=True) playlists = playlists[:20] resp = make_response( render_template('index.html', appId=FBAPI_APP_ID, app_friends=app_friends, me=me, access_token=access_token, recent_playlists=playlists, get_top_three_artists=get_top_three_artists)) return resp
def recent(page): me = None access_token = get_access_token() if access_token: me = fb_call('me', args={'access_token': access_token}) r = connect_redis() results_per_page = 20 start = (page - 1) * results_per_page playlists = db.get_recent_playlists(r, start, results_per_page) resp = make_response(render_template("recent.html", appId=FBAPI_APP_ID, me=me, access_token=access_token, page=page, playlists=playlists, get_top_three_artists=get_top_three_artists)) return resp
def show_genre(genre_name): me = None access_token = get_access_token() if access_token: me = fb_call('me', args={'access_token': access_token}) r = connect_redis() playlists = db.get_recent_playlists(r, 0, 100, db.Genre.get(r, genre_name)) playlists.sort(key=lambda playlist: playlist.score, reverse=True) playlists = playlists[:20] resp = make_response(render_template( 'genre.html', appId=FBAPI_APP_ID, me=me, access_token=access_token, recent_playlists=playlists, get_top_three_artists=get_top_three_artists)) return resp
def show_genre(genre_name): me = None access_token = get_access_token() if access_token: me = fb_call('me', args={'access_token': access_token}) r = connect_redis() playlists = db.get_recent_playlists(r, 0, 100, db.Genre.get(r, genre_name)) playlists.sort(key=lambda playlist: playlist.score, reverse=True) playlists = playlists[:20] resp = make_response( render_template('genre.html', appId=FBAPI_APP_ID, me=me, access_token=access_token, recent_playlists=playlists, get_top_three_artists=get_top_three_artists)) return resp
def recent(page): me = None access_token = get_access_token() if access_token: me = fb_call('me', args={'access_token': access_token}) r = connect_redis() results_per_page = 20 start = (page - 1) * results_per_page playlists = db.get_recent_playlists(r, start, results_per_page) resp = make_response( render_template("recent.html", appId=FBAPI_APP_ID, me=me, access_token=access_token, page=page, playlists=playlists, get_top_three_artists=get_top_three_artists)) return resp
def index(): me = app_friends = access_token = None access_token = get_access_token() if access_token: me = fb_call('me', args={'access_token': access_token}) app_friends = fql( "SELECT uid, name, is_app_user, pic_square " "FROM user " "WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND " " is_app_user = 1", access_token) r = connect_redis() playlists = db.get_recent_playlists(r, 0, 100) playlists.sort(key=lambda playlist: playlist.score, reverse=True) playlists = playlists[:20] resp = make_response(render_template( 'index.html', appId=FBAPI_APP_ID, app_friends=app_friends, me=me, access_token=access_token, recent_playlists=playlists, get_top_three_artists=get_top_three_artists)) return resp