Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 def json_wrapper(*args, **kwargs):
     return build_json(func(*args, **kwargs))