def get_albums2(): albumlist = [] for album in sorted(library.get_albums(), key=lambda a: a.get_title()): jobject = {"title": album.get_title(), "artist": album.get_artist().get_name(), "songs": len(album.get_songs())} albumlist.append(jobject) json = {"albums": albumlist} return flask.jsonify(**json)
def get_albums(): s = "" for album in library.get_albums(): s += album.get_title() + ":" + album.get_artist().get_name() + ";" return s[:-1]