def one_track_audio_features(): one_track = get_one_track() item = one_track["items"] uri_data = mapv(get_track_uris, item) uri_data_str = list_to_string(uri_data) data = audio_features(uri_data_str) return data
def audio_features_all_favs() -> list: fav_artists = get_all_fav_artists() saved_artist_uri = set(mapv(get_artist_uris, fav_artists)) # 91 different top saved artists (9/16/19) ttrack_database = [] for artist in saved_artist_uri: all_artist_top_songs = get_artist_top_tracks(artist)['tracks'] for song in all_artist_top_songs: ttrack_database.append(song['uri']) # a database that is a list # of user's top artist's top tracks, 921 songs (9/16/19), 750 songs (10/11/19) return ttrack_database
def make_playlist_of_last_100(name_of_playlist, tracks): # mapv = list(map()) s_track_uri_data = mapv(get_track_uris, tracks) pl_id = create_playlist(name_of_playlist) add_tracks_to_playlist(pl_id, s_track_uri_data) return None
from naga import mapv class Symbol(str): pass def Sym(s, symbol_table={}): "Find or create unique Symbol entry for str s in symbol table." if s not in symbol_table: symbol_table[s] = Symbol(s) return symbol_table[s] # @formatter:off quote_, if_, set_, def_, fn_, begin_, defmacro_, = mapv( Sym, "quote if set! def fn begin defmacro".split()) quasiquote_, unquote_, unquotesplicing_ = mapv( Sym, "quasiquote unquote unquote-splicing".split()) append_, cons_, let_, cond_ = mapv(Sym, "append cons let cond".split()) autogensym_ = Sym('autogensym') # @formatter:on specforms = [quote_, if_, set_, def_, fn_, begin_, defmacro_] def PyObject(x): return eval(x)
def let(forms, *exps): if forms == []: return _let([], [], exps) forms = mapv(list, partition(2, forms)) return _let(*zip(*forms), [begin_, *exps])