2019-05-11 17:37:47 +09:00
|
|
|
from yandex_music import YandexMusicObject
|
|
|
|
|
|
|
|
|
|
|
|
class Cover(YandexMusicObject):
|
|
|
|
def __init__(self,
|
2019-06-01 15:04:15 +09:00
|
|
|
type=None,
|
New supported objects: Album, CaseForms, Label, Library, MadeFor, Major, Normalization, PlayCounter, Playlist, Track, TrackPosition, TrackShort, User
The following methods are wrapped:
- albums;
- playlists/list;
- users/{user_id}/playlists/list;
- tracks;
- users/{user_id}/likes/tracks.
Added property to get full track ID
Cover received more optional fields
Ability to pass arguments to the request
Removed unnecessary type conversions
2019-05-13 02:39:12 +09:00
|
|
|
uri=None,
|
|
|
|
items_uri=None,
|
|
|
|
dir=None,
|
|
|
|
version=None,
|
|
|
|
custom=None,
|
|
|
|
prefix=None,
|
2019-06-01 15:04:15 +09:00
|
|
|
error=None,
|
2019-05-11 17:37:47 +09:00
|
|
|
client=None,
|
|
|
|
**kwargs):
|
|
|
|
self.type = type
|
|
|
|
self.uri = uri
|
New supported objects: Album, CaseForms, Label, Library, MadeFor, Major, Normalization, PlayCounter, Playlist, Track, TrackPosition, TrackShort, User
The following methods are wrapped:
- albums;
- playlists/list;
- users/{user_id}/playlists/list;
- tracks;
- users/{user_id}/likes/tracks.
Added property to get full track ID
Cover received more optional fields
Ability to pass arguments to the request
Removed unnecessary type conversions
2019-05-13 02:39:12 +09:00
|
|
|
self.items_uri = items_uri
|
|
|
|
self.prefix = prefix
|
|
|
|
self.dir = dir
|
|
|
|
self.version = version
|
|
|
|
self.custom = custom
|
2019-06-01 15:04:15 +09:00
|
|
|
self.error = error
|
2019-05-11 17:37:47 +09:00
|
|
|
|
|
|
|
self.client = client
|
|
|
|
|
New supported objects: Landing, Block, BlockEntity, Chart, ChartItem, MixLink, PersonalPlaylistsData, PlayContext, PlayContextsData, Promotion, TrackId, TrackShorOld (YEAH!)
The following method are wrapped:
- /landing3
Added the ability to download covers
The following field are optional: Playlist.tags
Now, when parsing json, the "client" key is replaced with "client_"
2019-05-25 02:10:39 +09:00
|
|
|
def download(self, filename):
|
|
|
|
self.client._request.download(self.uri, filename)
|
|
|
|
|
2019-05-11 17:37:47 +09:00
|
|
|
@classmethod
|
|
|
|
def de_json(cls, data, client):
|
|
|
|
if not data:
|
|
|
|
return None
|
|
|
|
|
|
|
|
data = super(Cover, cls).de_json(data, client)
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|