def recent_listens(): recent = [] for listen in _redis.get_recent_listens(NUMBER_OF_RECENT_LISTENS): recent.append({ "track_metadata": listen.data, "user_name": listen.user_name, "listened_at": listen.ts_since_epoch, "listened_at_iso": listen.timestamp.isoformat() + "Z", }) spotify_user = get_current_spotify_user() youtube_user = get_current_youtube_user() props = { "listens": recent, "mode": "recent", "spotify": spotify_user, "youtube": youtube_user, "api_url": current_app.config["API_URL"], "sentry_dsn": current_app.config.get("LOG_SENTRY", {}).get("dsn") } return render_template("index/recent.html", props=ujson.dumps(props), mode='recent', active_section='listens')
def recent_listens(): recent = [] for listen in _redis.get_recent_listens(NUMBER_OF_RECENT_LISTENS): recent.append({ "track_metadata": listen.data, "user_name" : listen.user_name, "listened_at": listen.ts_since_epoch, "listened_at_iso": listen.timestamp.isoformat() + "Z", }) spotify_user = {} if current_user.is_authenticated: spotify_user = spotify.get_user_dict(current_user.id) props = { "listens": recent, "mode": "recent", "spotify": spotify_user, "api_url": current_app.config["API_URL"], } return render_template("index/recent.html", props=ujson.dumps(props), mode='recent', active_section='listens')
def recent_listens(): recent = [] for listen in _redis.get_recent_listens(NUMBER_OF_RECENT_LISTENS): recent.append({ "track_metadata": listen.data, "user_name": listen.user_name, "listened_at": listen.ts_since_epoch, "listened_at_iso": listen.timestamp.isoformat() + "Z", }) props = { "listens": recent, } return render_template("index/recent.html", props=ujson.dumps(props))