Добавлены тайп хинты для Suggestions, SearchResult, Search, Best, Value, StationResult, Station, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, Dashboard, AdParams
2019-12-27 22:06:24 +09:00
|
|
|
|
from typing import TYPE_CHECKING, Optional, List
|
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:
|
Добавлены тайп хинты для Suggestions, SearchResult, Search, Best, Value, StationResult, Station, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, Dashboard, AdParams
2019-12-27 22:06:24 +09:00
|
|
|
|
from yandex_music import Client, Station, RotorSettings, AdParams
|
2019-12-27 18:14:51 +09:00
|
|
|
|
|
New supported objects: Station, StationResult, StationTrackResult, Value, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, DashBoard, AdParams
The following methods are wrapped:
- /rotor/account/status
- /rotor/stations/dashboard
- /rotor/stations/list
- /rotor/station/genre:{genre}/feedback
- /rotor/station/genre:{genre}/info
- /rotor/station/genre:{genre}/tracks
The following fields are now optional: Account[region, passport_phones], Status[cache_limit, subeditor, subeditor_level, plus], Subscription[auto_renewable, can_start_trial, mcdonalds]
Added new fields: Subscription.end, Status[skips_per_hour, station_exists, premium_region], Track..preview_duration_ms
Fixed downloading the cover of the track
2019-06-03 22:16:24 +09:00
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
@model
|
New supported objects: Station, StationResult, StationTrackResult, Value, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, DashBoard, AdParams
The following methods are wrapped:
- /rotor/account/status
- /rotor/stations/dashboard
- /rotor/stations/list
- /rotor/station/genre:{genre}/feedback
- /rotor/station/genre:{genre}/info
- /rotor/station/genre:{genre}/tracks
The following fields are now optional: Account[region, passport_phones], Status[cache_limit, subeditor, subeditor_level, plus], Subscription[auto_renewable, can_start_trial, mcdonalds]
Added new fields: Subscription.end, Status[skips_per_hour, station_exists, premium_region], Track..preview_duration_ms
Fixed downloading the cover of the track
2019-06-03 22:16:24 +09:00
|
|
|
|
class StationResult(YandexMusicObject):
|
2020-03-22 10:14:17 +09:00
|
|
|
|
"""Класс, представляющий радиостанцию с настройками.
|
2020-01-26 23:50:54 +09:00
|
|
|
|
|
2022-11-23 07:09:14 +09:00
|
|
|
|
Note:
|
|
|
|
|
Известные значения `custom_name`: `Танцую`, `R'n'B`, `Отдыхаю`, `Просыпаюсь`, `Тренируюсь`, `В дороге`, `Работаю`, `Засыпаю`.
|
|
|
|
|
|
2020-01-26 23:50:54 +09:00
|
|
|
|
Attributes:
|
2020-03-22 10:14:17 +09:00
|
|
|
|
station (:obj:`yandex_music.Station` | :obj:`None`): Станция.
|
|
|
|
|
settings (:obj:`yandex_music.RotorSettings` | :obj:`None`): Первый набор настроек.
|
|
|
|
|
settings2 (:obj:`yandex_music.RotorSettings` | :obj:`None`): Второй набор настроек.
|
|
|
|
|
ad_params (:obj:`yandex_music.AdParams` | :obj:`None`): Настройки рекламы.
|
|
|
|
|
explanation (:obj:`str`, optional): TODO.
|
|
|
|
|
prerolls (:obj:`list` из :obj:`str`, optional): Прероллы TODO.
|
2022-11-23 07:09:14 +09:00
|
|
|
|
rup_title (:obj:`str`): Название станции / Моя волна TODO.
|
|
|
|
|
rup_description (:obj:`str`): Описание станции.
|
|
|
|
|
custom_name (:obj:`str`, optional): Название станции TODO.
|
Удаление избыточной информации (#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
|
|
|
|
station: Optional['Station']
|
|
|
|
|
settings: Optional['RotorSettings']
|
|
|
|
|
settings2: Optional['RotorSettings']
|
|
|
|
|
ad_params: Optional['AdParams']
|
|
|
|
|
explanation: Optional[str] = None
|
|
|
|
|
prerolls: Optional[list] = None
|
2022-11-23 07:09:14 +09:00
|
|
|
|
rup_title: str = None
|
|
|
|
|
rup_description: str = None
|
|
|
|
|
custom_name: Optional[str] = None
|
2021-09-19 22:47:19 +09:00
|
|
|
|
client: Optional['Client'] = None
|
New supported objects: Station, StationResult, StationTrackResult, Value, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, DashBoard, AdParams
The following methods are wrapped:
- /rotor/account/status
- /rotor/stations/dashboard
- /rotor/stations/list
- /rotor/station/genre:{genre}/feedback
- /rotor/station/genre:{genre}/info
- /rotor/station/genre:{genre}/tracks
The following fields are now optional: Account[region, passport_phones], Status[cache_limit, subeditor, subeditor_level, plus], Subscription[auto_renewable, can_start_trial, mcdonalds]
Added new fields: Subscription.end, Status[skips_per_hour, station_exists, premium_region], Track..preview_duration_ms
Fixed downloading the cover of the track
2019-06-03 22:16:24 +09:00
|
|
|
|
|
2021-09-19 22:47:19 +09:00
|
|
|
|
def __post_init__(self):
|
Добавлены основные тесты для следующих классов: Album, Artist, Chart, Counts, Genre, Label, PermissionAlerts, PromoCodeStatus, Restrictions, Settings, Station, StatuonResult, Status, Track.
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Отрефакторен restrictions.py.
Исправлен баг в .to_dict() методе, связанный с десериализцией объектов списков и словарей.
2019-11-09 00:24:54 +09:00
|
|
|
|
self._id_attrs = (self.station, self.settings, self.settings2, self.ad_params)
|
New supported objects: Station, StationResult, StationTrackResult, Value, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, DashBoard, AdParams
The following methods are wrapped:
- /rotor/account/status
- /rotor/stations/dashboard
- /rotor/stations/list
- /rotor/station/genre:{genre}/feedback
- /rotor/station/genre:{genre}/info
- /rotor/station/genre:{genre}/tracks
The following fields are now optional: Account[region, passport_phones], Status[cache_limit, subeditor, subeditor_level, plus], Subscription[auto_renewable, can_start_trial, mcdonalds]
Added new fields: Subscription.end, Status[skips_per_hour, station_exists, premium_region], Track..preview_duration_ms
Fixed downloading the cover of the track
2019-06-03 22:16:24 +09:00
|
|
|
|
|
|
|
|
|
@classmethod
|
Добавлены тайп хинты для Suggestions, SearchResult, Search, Best, Value, StationResult, Station, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, Dashboard, AdParams
2019-12-27 22:06:24 +09:00
|
|
|
|
def de_json(cls, data: dict, client: 'Client') -> Optional['StationResult']:
|
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 10:14:17 +09:00
|
|
|
|
:obj:`yandex_music.StationResult`: Радиостанция с настройками.
|
2020-01-26 22:17:09 +09:00
|
|
|
|
"""
|
New supported objects: Station, StationResult, StationTrackResult, Value, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, DashBoard, AdParams
The following methods are wrapped:
- /rotor/account/status
- /rotor/stations/dashboard
- /rotor/stations/list
- /rotor/station/genre:{genre}/feedback
- /rotor/station/genre:{genre}/info
- /rotor/station/genre:{genre}/tracks
The following fields are now optional: Account[region, passport_phones], Status[cache_limit, subeditor, subeditor_level, plus], Subscription[auto_renewable, can_start_trial, mcdonalds]
Added new fields: Subscription.end, Status[skips_per_hour, station_exists, premium_region], Track..preview_duration_ms
Fixed downloading the cover of the track
2019-06-03 22:16:24 +09:00
|
|
|
|
if not data:
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
data = super(StationResult, cls).de_json(data, client)
|
|
|
|
|
from yandex_music import Station, RotorSettings, AdParams
|
2021-02-03 21:28:10 +09:00
|
|
|
|
|
New supported objects: Station, StationResult, StationTrackResult, Value, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, DashBoard, AdParams
The following methods are wrapped:
- /rotor/account/status
- /rotor/stations/dashboard
- /rotor/stations/list
- /rotor/station/genre:{genre}/feedback
- /rotor/station/genre:{genre}/info
- /rotor/station/genre:{genre}/tracks
The following fields are now optional: Account[region, passport_phones], Status[cache_limit, subeditor, subeditor_level, plus], Subscription[auto_renewable, can_start_trial, mcdonalds]
Added new fields: Subscription.end, Status[skips_per_hour, station_exists, premium_region], Track..preview_duration_ms
Fixed downloading the cover of the track
2019-06-03 22:16:24 +09:00
|
|
|
|
data['station'] = Station.de_json(data.get('station'), client)
|
|
|
|
|
data['settings'] = RotorSettings.de_json(data.get('settings'), client)
|
|
|
|
|
data['settings2'] = RotorSettings.de_json(data.get('settings2'), client)
|
|
|
|
|
data['ad_params'] = AdParams.de_json(data.get('ad_params'), client)
|
|
|
|
|
|
|
|
|
|
return cls(client=client, **data)
|
|
|
|
|
|
|
|
|
|
@classmethod
|
Добавлены тайп хинты для Suggestions, SearchResult, Search, Best, Value, StationResult, Station, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, Dashboard, AdParams
2019-12-27 22:06:24 +09:00
|
|
|
|
def de_list(cls, data: dict, client: 'Client') -> List['StationResult']:
|
2020-01-26 22:17:09 +09:00
|
|
|
|
"""Десериализация списка объектов.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
data (:obj:`list`): Список словарей с полями и значениями десериализуемого объекта.
|
Удаление избыточной информации (#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 10:14:17 +09:00
|
|
|
|
:obj:`list` из :obj:`yandex_music.StationResult`: Радиостанции с настройками.
|
2020-01-26 22:17:09 +09:00
|
|
|
|
"""
|
New supported objects: Station, StationResult, StationTrackResult, Value, Sequence, RotorSettings, Restrictions, Id, Enum, DiscreteScale, DashBoard, AdParams
The following methods are wrapped:
- /rotor/account/status
- /rotor/stations/dashboard
- /rotor/stations/list
- /rotor/station/genre:{genre}/feedback
- /rotor/station/genre:{genre}/info
- /rotor/station/genre:{genre}/tracks
The following fields are now optional: Account[region, passport_phones], Status[cache_limit, subeditor, subeditor_level, plus], Subscription[auto_renewable, can_start_trial, mcdonalds]
Added new fields: Subscription.end, Status[skips_per_hour, station_exists, premium_region], Track..preview_duration_ms
Fixed downloading the cover of the track
2019-06-03 22:16:24 +09:00
|
|
|
|
if not data:
|
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
station_results = list()
|
|
|
|
|
for station_result in data:
|
|
|
|
|
station_results.append(cls.de_json(station_result, client))
|
|
|
|
|
|
|
|
|
|
return station_results
|