sounds¶
Submodules¶
Exceptions¶
Generic exception for the module |
|
Generic exception for the module |
|
Generic exception for the module |
|
Generic exception for the module |
|
Generic exception for the module |
Classes¶
A client to interact with the Sounds API |
|
Create a collection of name/value pairs. |
|
An enum for valid image types for recipes |
|
Create a collection of name/value pairs. |
|
/v2/networks - Provides the list of all the v2 networks |
|
Represents a content category. |
|
Represents a collection container. |
|
Base container for organizing content - not directly playable. |
|
Base class for actual playable content. |
|
Represents a menu container with items. |
|
Represents a menu item container. |
|
Base class for actual playable content. |
|
Represents a podcast container (holds episodes). |
|
Represents a playable podcast episode. |
|
Base container for organizing content - not directly playable. |
|
Represents a playable radio clip. |
|
Represents a radio series container (holds episodes). |
|
Represents a playable radio show. |
|
Represents a recommended menu item. |
|
Represents a schedule for a given date. |
|
Represents a scheduled program item. |
|
Represents a segment within a stream. |
|
Represents a radio/media station. |
|
Represents a search result showing a station. Keys are different enough to warrant a separate model |
|
Represents a station stream. |
|
Create a collection of name/value pairs. |
Package Contents¶
- class sounds.SoundsClient(session: aiohttp.ClientSession | None = None, timezone: datetime.tzinfo | None = None, logger: logging.Logger | None = None, log_level: str | None = None, mock_session: bool = False, **kwargs)¶
A client to interact with the Sounds API
- current_station: sounds.models.Station | None = None¶
- current_stream: sounds.models.Stream | None = None¶
- current_segment: sounds.models.Segment | None = None¶
- timeout¶
- mock_session = False¶
- auth¶
- schedules¶
- streaming¶
- stations¶
- personal¶
- setLogger(log_level=None)¶
- async close()¶
- class sounds.ContainerType(*args, **kwds)¶
Bases:
enum.EnumCreate a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- BRAND = 'brand'¶
- SERIES = 'series'¶
- ITEM = 'container_item'¶
- class sounds.ImageType(*args, **kwds)¶
Bases:
enum.EnumAn enum for valid image types for recipes
- COLOUR = 'colour'¶
- COLOUR_DEFAULT = 'colour_default'¶
- BACKGROUND = 'background'¶
- BLOCKS_COLOUR = 'blocks_colour'¶
- BLOCKS_COLOUR_BLACK = 'blocks_colour_black'¶
- BLOCKS_COLOUR_WHITE = 'blocks_colour_white'¶
- class sounds.PlayStatus(*args, **kwds)¶
Bases:
enum.EnumCreate a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- STARTED = 'started'¶
- PAUSED = 'paused'¶
- ENDED = 'ended'¶
- HEARTBEAT = 'heartbeat'¶
- class sounds.URLs(*args, **kwds)¶
Bases:
enum.Enum/v2/networks - Provides the list of all the v2 networks /v2/networks/playable - Provides the list of all the playable networks /v2/networks/{id}/playable - Provides the network playable item by network ID. <span>🎶</span> Green Day /radio/networks.json - All iPlayer Radio networks - contains business logic for masterbrand and service relationships
/v2/services/{sid}/tracks/latest/playable - Retrieve list of tracks as playable items for a service <span>🎶</span> Deftones
- LOGIN_START = 'https://session.bbc.co.uk/session?ptrt=https%3A%2F%2Fwww.bbc.co.uk%2Fsounds&context=iplayerradio...¶
- LOGIN_START_I18N = 'https://account.bbc.com/auth?realm=%2F&clientId=Account&ptrt=https%3A%2F%2Fwww.bbc.com%2F&userOr...¶
- LOGIN_BASE = 'https://account.bbc.com'¶
- COOKIE_BASE = 'https://www.bbc.co.uk'¶
- COOKIE_BASE_I18N = 'https://www.bbc.com'¶
- JWT = 'https://rms.api.bbc.co.uk/v2/sign/token/{station_id}'¶
- INTL_JWT = 'https://web-cdn.api.bbci.co.uk/xd/media-token?{id_type}={id}'¶
- USER_INFO = 'https://www.bbc.co.uk/userinfo'¶
- MEDIASET = 'https://open.live.bbc.co.uk/mediaselector/6/select/version/2.0/mediaset/pc/vpid/{station_id}/for...¶
- EPISODE_MEDIASET = 'https://open.live.bbc.co.uk/mediaselector/6/select/version/2.0/mediaset/pc/vpid/{episode_id}'¶
- NETWORKS_LIST = 'https://rms.api.bbc.co.uk/radio/networks.json'¶
- STATIONS = 'https://rms.api.bbc.co.uk/v2/experience/inline/stations'¶
- LIVE_STATION_DETAILS = 'https://rms.api.bbc.co.uk/v2/experience/inline/play/{station_id}'¶
- STATION_DETAILS = 'https://rms.api.bbc.co.uk/v2/networks/{station_id}'¶
- STATION_PLAYABLE_DETAILS = 'https://rms.api.bbc.co.uk/v2/networks/{station_id}/playable'¶
- LIVE_STATION = 'https://www.bbc.co.uk/sounds/play/live:{station_id}'¶
- NOW_PLAYING = 'https://rms.api.bbc.co.uk/v2/services/{station_id}/segments/latest?limit={limit}'¶
- SCHEDULE = 'https://rms.api.bbc.co.uk/v2/experience/inline/schedules/{station_id}'¶
- SCHEDULE_DATE = 'https://rms.api.bbc.co.uk/v2/experience/inline/schedules/{station_id}/{date}'¶
- SEGMENTS = 'https://rms.api.bbc.co.uk/v2/versions/{vpid}/segments'¶
- PLAYABLE_ITEMS_CONTAINER = 'https://rms.api.bbc.co.uk/v2/programmes/playable?container={pid}&sort=sequential'¶
- CATEGORY_LATEST = 'https://rms.api.bbc.co.uk/v2/programmes/playable?category={category}&sort=-release_date&experien...¶
- CATEGORY_POPULAR = 'https://rms.api.bbc.co.uk/v2/programmes/playable?category={category}&sort=popular&experience=domestic'¶
- BROADCAST = 'https://rms.api.bbc.co.uk/v2/broadcasts/{pid}'¶
- PID = 'https://rms.api.bbc.co.uk/v2/programmes/{pid}'¶
- PID_PLAYABLE = 'https://rms.api.bbc.co.uk/v2/programmes/{pid}/playable'¶
- CONTAINER_URL = 'https://rms.api.bbc.co.uk/v2/experience/inline/container/{urn}'¶
- PLAYLIST = 'https://www.bbc.co.uk/programmes/{pid}/playlist.json'¶
- COLLECTIONS_FULL = 'https://rms.api.bbc.co.uk/v2/collections/{pid}/members/container?experience=domestic&offset={off...¶
- COLLECTIONS = 'https://rms.api.bbc.co.uk/v2/collections/{pid}/members/container?experience=domestic'¶
- EXPERIENCE_MENU = 'https://rms.api.bbc.co.uk/v2/my/experience/inline/listen'¶
- SEARCH_URL = 'https://rms.api.bbc.co.uk/v2/experience/inline/search?q={search}'¶
- SHOW_SEARCH_URL = 'https://rms.api.bbc.co.uk/v2/programmes/search/container?q={search}'¶
- EPISOSDE_SEARCH_URL = 'https://rms.api.bbc.co.uk/v2/programmes/search/playable?q={search}'¶
- PODCASTS = 'https://rms.api.bbc.co.uk/v2/experience/inline/speech'¶
- MUSIC = 'https://rms.api.bbc.co.uk/v2/experience/inline/music'¶
- NEWS = 'https://rms.api.bbc.co.uk/v2/experience/inline/container/urn:bbc:radio:category:news'¶
- exception sounds.APIResponseError¶
Bases:
SoundsExceptionGeneric exception for the module
- exception sounds.InvalidFormatError¶
Bases:
SoundsExceptionGeneric exception for the module
- exception sounds.LoginFailedError¶
Bases:
SoundsExceptionGeneric exception for the module
- exception sounds.NetworkError¶
Bases:
SoundsExceptionGeneric exception for the module
- exception sounds.NotFoundError¶
Bases:
SoundsExceptionGeneric exception for the module
- class sounds.Container¶
Bases:
BaseObjectBase container for organizing content - not directly playable.
- sub_items: List[SoundsTypes] | None = None¶
- property item_id¶
- class sounds.LiveStation¶
Bases:
PlayableItemBase class for actual playable content.
- property item_id¶
- class sounds.Menu¶
Represents a menu container with items.
- get(key: str) MenuItem | RecommendedMenuItem | None¶
Get a menu item by ID.
- class sounds.PlayableItem¶
Bases:
BaseObjectBase class for actual playable content.
- start: datetime.datetime | None = None¶
- end: datetime.datetime | None = None¶
- property item_id¶
- class sounds.PodcastEpisode¶
Bases:
PlayableItemRepresents a playable podcast episode.
- class sounds.PromoItem¶
Bases:
ContainerBase container for organizing content - not directly playable.
- item: PlayableItem¶
- class sounds.RadioClip¶
Bases:
PlayableItem,TimedContentRepresents a playable radio clip.
- class sounds.RadioShow¶
Bases:
PlayableItem,TimedContentRepresents a playable radio show.
- property item_id¶
- class sounds.Schedule¶
Bases:
ContainerRepresents a schedule for a given date.
- get_current_item(timezone: zoneinfo.ZoneInfo | pytz.tzinfo.BaseTzInfo = pytz.timezone('UTC')) ScheduleItem | None¶
Get the currently airing schedule item.
- class sounds.ScheduleItem¶
Bases:
PlayableItemRepresents a scheduled program item.
- is_live(timezone: zoneinfo.ZoneInfo | pytz.tzinfo.BaseTzInfo) bool¶
- has_already_aired(timezone: zoneinfo.ZoneInfo | pytz.tzinfo.BaseTzInfo) bool¶
- class sounds.Segment¶
Represents a segment within a stream.
- class sounds.StationSearchResult¶
Represents a search result showing a station. Keys are different enough to warrant a separate model
- property item_id¶
- class sounds.Stream¶
Bases:
TimedContentRepresents a station stream.
- class sounds.MenuRecommendationOptions(*args, **kwds)¶
Bases:
enum.EnumCreate a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- EXCLUDE = 'Exclude'¶
- INCLUDE = 'Include'¶
- ONLY = 'Only'¶