示例#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)
示例#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)
示例#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)
示例#4
0
 def pu_wrapper(self, *args, **kwargs):
     user = get_user()
     return func(self, user, *args, **kwargs)