Добавлены тайп-хинты для следующих классов: VideoSupplement, Supplement, Lyrics, Subscription, Status, Product, Plus, Price, Permissions, PassportPhone, AutoRenewable, Account.
2019-12-27 17:42:24 +09:00
|
|
|
|
from typing import TYPE_CHECKING, Optional, List
|
|
|
|
|
|
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
|
|
|
|
|
Добавлены тайп-хинты для следующих классов: VideoSupplement, Supplement, Lyrics, Subscription, Status, Product, Plus, Price, Permissions, PassportPhone, AutoRenewable, Account.
2019-12-27 17:42:24 +09:00
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
|
from yandex_music import Client, Lyrics, VideoSupplement
|
|
|
|
|
|
2019-10-19 05:44:17 +09:00
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
@model
|
2019-10-17 05:10:52 +09:00
|
|
|
|
class Supplement(YandexMusicObject):
|
2019-10-17 12:35:24 +09:00
|
|
|
|
"""Класс, представляющий дополнительную информацию о треке.
|
2019-10-17 05:25:17 +09:00
|
|
|
|
|
2022-11-16 03:20:38 +09:00
|
|
|
|
Warning:
|
|
|
|
|
Получение текста из дополнительной информации устарело. Используйте
|
|
|
|
|
:func:`yandex_music.Client.tracks_lyrics`.
|
|
|
|
|
|
2019-10-17 05:25:17 +09:00
|
|
|
|
Attributes:
|
2019-10-19 05:44:17 +09:00
|
|
|
|
id (:obj:`int`): Уникальный идентификатор дополнительной информации.
|
2020-03-22 06:29:34 +09:00
|
|
|
|
lyrics (:obj:`yandex_music.Lyrics`): Текст песни.
|
|
|
|
|
videos (:obj:`yandex_music.VideoSupplement`): Видео.
|
2020-12-28 06:01:40 +09:00
|
|
|
|
radio_is_available (:obj:`bool`, optional): Доступно ли радио.
|
2021-02-01 21:57:06 +09:00
|
|
|
|
description (:obj:`str`, optional): Полное описание эпизода подкаста.
|
Удаление избыточной информации (#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.
|
2019-10-17 05:25:17 +09:00
|
|
|
|
"""
|
2019-10-19 05:44:17 +09:00
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
id: int
|
|
|
|
|
lyrics: Optional['Lyrics']
|
|
|
|
|
videos: List['VideoSupplement']
|
|
|
|
|
radio_is_available: bool = None
|
|
|
|
|
description: Optional[str] = None
|
|
|
|
|
client: Optional['Client'] = None
|
2020-12-28 06:01:40 +09:00
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
def __post_init__(self):
|
2020-12-28 06:01:40 +09:00
|
|
|
|
self._id_attrs = (self.id, self.lyrics, self.videos)
|
2019-10-17 05:10:52 +09:00
|
|
|
|
|
|
|
|
|
@classmethod
|
Добавлены тайп-хинты для следующих классов: VideoSupplement, Supplement, Lyrics, Subscription, Status, Product, Plus, Price, Permissions, PassportPhone, AutoRenewable, Account.
2019-12-27 17:42:24 +09:00
|
|
|
|
def de_json(cls, data: dict, client: 'Client') -> Optional['Supplement']:
|
2019-10-17 05:25:17 +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.
|
2019-10-17 05:25:17 +09:00
|
|
|
|
|
|
|
|
|
Returns:
|
2020-03-22 06:29:34 +09:00
|
|
|
|
:obj:`yandex_music.Supplement`: Дополнительная информация о треке.
|
2019-10-17 05:25:17 +09:00
|
|
|
|
"""
|
2019-10-17 05:10:52 +09:00
|
|
|
|
if not data:
|
|
|
|
|
return None
|
2019-12-27 04:51:29 +09:00
|
|
|
|
|
2019-10-17 05:10:52 +09:00
|
|
|
|
data = super(Supplement, cls).de_json(data, client)
|
|
|
|
|
from yandex_music import Lyrics, VideoSupplement
|
2021-02-03 21:28:10 +09:00
|
|
|
|
|
2019-10-19 05:44:17 +09:00
|
|
|
|
data['lyrics'] = Lyrics.de_json(data.get('lyrics'), client)
|
|
|
|
|
data['videos'] = VideoSupplement.de_list(data.get('videos'), client)
|
2019-10-17 05:10:52 +09:00
|
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|