コード例 #1
0
 def from_api(ApiData, publicUser):
     data = filter_output(ApiData, PlaylistTrack.__dict__.keys())
     data['added_at'] = dateutil.parser.parse(data['added_at'])
     playlistTrack = PlaylistTrack(**data)
     playlistTrack.added_by = publicUser
     track_data = filter_output(data['track'],
                                media_schema.Track.__dict__.keys())
     playlistTrack.track = media_schema.Track(**track_data)
     return playlistTrack
コード例 #2
0
 def from_api(ApiData, album_id=None):
     data = filter_output(ApiData, Track.__dict__.keys())
     track = Track(**data)
     if 'album' in ApiData:
         track._album_id = ApiData['album']['id']
     elif album_id is not None:
         track._album_id = album_id
     return track
コード例 #3
0
 def from_api(ApiData, publicUser=None):
     data = filter_output(ApiData, Playlist.__dict__.keys())
     playlist = Playlist(**data)
     playlist.images = [misc_schema.Image(**img) for img in data['images']]
     if publicUser:
         playlist.owner = publicUser
     else:
         playlist.owner = user_schema.PublicUser.from_api(data['owner'])
     return playlist
コード例 #4
0
 def from_api(ApiData):
     data = filter_output(ApiData, Artist.__dict__.keys())
     artist = Artist(**data)
     artist.images = [misc_schema.Image(**img) for img in data['images']]
     return artist
コード例 #5
0
 def from_api(ApiData):
     data = filter_output(ApiData, Album.__dict__.keys())
     album = Album(**data)
     album._artists_ids = [i['id'] for i in data['artists']]
     album.images = [misc_schema.Image(**img) for img in data['images']]
     return album
コード例 #6
0
 def from_api(ApiData):
     data = filter_output(ApiData[0], AudioFeatures.__dict__.keys())
     aFeat = AudioFeatures(**data)
     return aFeat
コード例 #7
0
ファイル: user_schema.py プロジェクト: Skogsfrae/spotipyql
 def from_api(ApiData):
     fields = list(PublicUser.__dict__.keys()) + list(User.__dict__.keys())
     data = filter_output(ApiData, fields)
     return PublicUser(**data)
コード例 #8
0
ファイル: user_schema.py プロジェクト: Skogsfrae/spotipyql
 def from_api(ApiData):
     fields = list(PrivateUser.__dict__.keys()) + list(User.__dict__.keys())
     data = filter_output(ApiData, fields)
     user = PrivateUser(**data)
     user.images = [misc_schema.Image(**img) for img in data['images']]
     return user