New supported objects: Search, Suggestions, Video, Best, AlbumSearchResult, ArtistSearchResult, PlaylistSearchResult, TrackSearchResult, VideoSearchResult,
The following methods are wrapped:
- /search
- /search/suggest
The following classes received optional fields instead of required ones: Album, Artist, Playlist, Track
Added "params" arg to the GET request
Code refactoring
2019-05-18 01:20:34 +09:00
|
|
|
from yandex_music import YandexMusicObject, Artist, Album, Track, Playlist, Video
|
|
|
|
|
|
|
|
|
|
|
|
de_json_result = {
|
|
|
|
'track': Track.de_json,
|
|
|
|
'artist': Artist.de_json,
|
|
|
|
'album': Album.de_json,
|
|
|
|
'playlist': Playlist.de_json,
|
|
|
|
'video': Video.de_json,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class Best(YandexMusicObject):
|
|
|
|
def __init__(self,
|
|
|
|
type,
|
|
|
|
result,
|
|
|
|
text=None,
|
|
|
|
client=None,
|
|
|
|
**kwargs):
|
|
|
|
self.type = type
|
|
|
|
self.result = result
|
|
|
|
|
|
|
|
self.text = text
|
|
|
|
|
|
|
|
self.client = client
|
2019-11-10 03:11:43 +09:00
|
|
|
self._id_attrs = (self.type, self.result)
|
New supported objects: Search, Suggestions, Video, Best, AlbumSearchResult, ArtistSearchResult, PlaylistSearchResult, TrackSearchResult, VideoSearchResult,
The following methods are wrapped:
- /search
- /search/suggest
The following classes received optional fields instead of required ones: Album, Artist, Playlist, Track
Added "params" arg to the GET request
Code refactoring
2019-05-18 01:20:34 +09:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def de_json(cls, data, client):
|
|
|
|
if not data:
|
|
|
|
return None
|
|
|
|
|
|
|
|
data = super(Best, cls).de_json(data, client)
|
|
|
|
data['result'] = de_json_result.get(data.get('type'))(data.get('result'), client)
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|