示例#1
0
class ArtistDetialResult(RemoteResult):
    artist = model.RequireModel('ArtistInfo')

    class hotSongs(model.List):
        Element = model.RequireModel('SongInfo')

    more = model.Boolean
示例#2
0
class SongInfo(model.NamedObject):
    mp3Url = model.String

    class artists(model.List):
        Element = model.RequireModel('Artist')

    hMusic = model.RequireModel('Mp3Info')
    mMusic = model.RequireModel('Mp3Info')
    lMusic = model.RequireModel('Mp3Info')

    def __getitem__(self, quality):
        if quality == "high" and self.hMusic: return self.hMusic.geturl()
        if (quality == "high" or quality == "medium") and self.mMusic:
            return self.mMusic.geturl()
        if self.lMusic: return self.lMusic.geturl()
        return self.mp3Url
示例#3
0
class Album(model.NamedObject):
    artist = model.RequireModel('Artist')
    company = model.String

    @RPCMethod("GET", "api/album/", AlbumDetailResult)
    def details(self):
        return {"__suffix__": self.id}

    def get_songs(self):
        details = self.details()
        if details.code != 200: raise HTTPStatusError(details.code)
        for song in details.album.songs:
            yield song
示例#4
0
class Song(model.NamedObject):
    class artists(model.List):
        Element = model.RequireModel('Artist')

    album = model.RequireModel('Album')
    duration = model.Integer

    @RPCMethod("GET", "api/song/detail", SongDetialResult)
    def details(self):
        return {'id': self.id, 'ids': [self.id]}

    def info(self):
        details = self.details()
        if details.code != 200: raise HTTPStatusError(details.code)
        return details.songs[0]
示例#5
0
 class artists(model.List):
     Element = model.RequireModel('Artist')
示例#6
0
 class hotSongs(model.List):
     Element = model.RequireModel('SongInfo')
示例#7
0
 class albums(model.List):
     Element = model.RequireModel('Album')
示例#8
0
 class songs(model.List):
     Element = model.RequireModel('Song')