def playlist(self, id): if not id: abort(400) user = get_user() playlist = user.get_playlist_by_id(id) if not playlist: abort(404) json = build_json([playlist]) json['data'][0]['type'] = 'playlist' return cjson.encode(json)
def song(self, id): if not id: abort(400) user = get_user() song = user.get_song_by_id(id) if not song: abort(404) json = build_json([song]) json['data'][0]['type'] = 'song' return cjson.encode(json)
def album(self, id): if not id: abort(400) user = get_user() album = user.get_album_by_id(id) if not album: abort(404) json = build_json([album]) json['data'][0]['type'] = 'album' return cjson.encode(json)
def json_wrapper(*args, **kwargs): return build_json(func(*args, **kwargs))