2019-12-28 22:25:09 +09:00
|
|
|
from typing import TYPE_CHECKING, Optional, List, Union
|
2019-12-27 18:14:51 +09:00
|
|
|
|
2020-01-26 21:19:22 +09:00
|
|
|
from yandex_music import YandexMusicObject
|
2021-09-19 22:47:19 +09:00
|
|
|
from yandex_music.utils import model
|
2020-01-26 21:19:22 +09:00
|
|
|
|
2019-12-27 18:14:51 +09:00
|
|
|
if TYPE_CHECKING:
|
2019-12-27 21:32:50 +09:00
|
|
|
from yandex_music import Client, Block
|
2019-12-27 18:14:51 +09:00
|
|
|
|
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
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
@model
|
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
|
|
|
class Landing(YandexMusicObject):
|
2020-03-22 09:29:38 +09:00
|
|
|
"""Класс, представляющий лендинг.
|
2020-01-26 23:50:54 +09:00
|
|
|
|
|
|
|
Attributes:
|
2020-03-22 09:29:38 +09:00
|
|
|
pumpkin (:obj:`bool`): Хэллоуин.
|
|
|
|
content_id (:obj:`str` | :obj:`int`): Уникальный идентификатор контента.
|
2020-08-26 18:37:31 +09:00
|
|
|
blocks (:obj:`list` из :obj:`yandex_music.Block`): Блоки лендинга.
|
Удаление избыточной информации (#247)
Классы: Account, AutoRenewable, PassportPhone, Permissions, Plus, Price,
Product, Status, Subscription, UserSettings, Album, Label,
TrackPosition, Playlist
У всех классов изменено описание атрибута client
2020-03-22 04:49:20 +09:00
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
2020-01-26 23:50:54 +09:00
|
|
|
"""
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
pumpkin: bool
|
|
|
|
content_id: Union[str, int]
|
|
|
|
blocks: List['Block']
|
|
|
|
client: Optional['Client'] = None
|
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
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
def __post_init__(self):
|
2019-11-10 05:59:22 +09:00
|
|
|
self._id_attrs = (self.content_id, self.blocks)
|
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
|
|
|
|
2019-08-18 23:44:46 +09:00
|
|
|
def __getitem__(self, item):
|
|
|
|
return self.blocks[item]
|
|
|
|
|
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
|
|
|
@classmethod
|
2019-12-27 21:32:50 +09:00
|
|
|
def de_json(cls, data: dict, client: 'Client') -> Optional['Landing']:
|
2020-01-26 22:17:09 +09:00
|
|
|
"""Десериализация объекта.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
data (:obj:`dict`): Поля и значения десериализуемого объекта.
|
Удаление избыточной информации (#247)
Классы: Account, AutoRenewable, PassportPhone, Permissions, Plus, Price,
Product, Status, Subscription, UserSettings, Album, Label,
TrackPosition, Playlist
У всех классов изменено описание атрибута client
2020-03-22 04:49:20 +09:00
|
|
|
client (:obj:`yandex_music.Client`, optional): Клиент Yandex Music.
|
2020-01-26 22:17:09 +09:00
|
|
|
|
|
|
|
Returns:
|
2020-03-22 09:29:38 +09:00
|
|
|
:obj:`yandex_music.Landing`: Лендинг.
|
2020-01-26 22:17:09 +09:00
|
|
|
"""
|
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
|
|
|
if not data:
|
|
|
|
return None
|
|
|
|
|
|
|
|
data = super(Landing, cls).de_json(data, client)
|
|
|
|
from yandex_music import Block
|
2021-02-03 21:28:10 +09:00
|
|
|
|
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
|
|
|
data['blocks'] = Block.de_list(data.get('blocks'), client)
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|