From 12dced1cc951e7d3894d2bec2a484fda0cc3cfbd Mon Sep 17 00:00:00 2001 From: noahhusby <32528627+noahhusby@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:44:16 -0400 Subject: [PATCH 1/2] Add stream radio calls --- aiostreammagic/endpoints.py | 1 + aiostreammagic/stream_magic.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/aiostreammagic/endpoints.py b/aiostreammagic/endpoints.py index f9c2ecf..8915b93 100644 --- a/aiostreammagic/endpoints.py +++ b/aiostreammagic/endpoints.py @@ -8,4 +8,5 @@ POSITION = "/zone/play_state/position" NOW_PLAYING = "/zone/now_playing" PLAY_CONTROL = "/zone/play_control" +STREAM_RADIO = "/stream/radio" POWER = "/system/power" diff --git a/aiostreammagic/stream_magic.py b/aiostreammagic/stream_magic.py index 7abd89d..dfd8e80 100644 --- a/aiostreammagic/stream_magic.py +++ b/aiostreammagic/stream_magic.py @@ -406,3 +406,20 @@ async def set_repeat(self, repeat: RepeatMode): ep.PLAY_CONTROL, params={"match": "none", "zone": "ZONE1", "mode_repeat": repeat}, ) + + async def play_radio_airable(self, name: str, airable_radio_id: int) -> None: + """Play an airable radio station.""" + await self.request( + ep.STREAM_RADIO, + params={ + "zone": "ZONE1", + "airable_radio_id": airable_radio_id, + "name": name, + }, + ) + + async def play_radio_url(self, name: str, url: str) -> None: + """Play a radio station from a provided url.""" + await self.request( + ep.STREAM_RADIO, params={"zone": "ZONE1", "url": url, "name": name} + ) From 7fd0e6e3fc1216297549b8750cce4916f9bd8473 Mon Sep 17 00:00:00 2001 From: noahhusby <32528627+noahhusby@users.noreply.github.com> Date: Tue, 17 Sep 2024 10:45:23 -0400 Subject: [PATCH 2/2] Bump to 2.4.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f770131..3fb5578 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aiostreammagic" -version = "2.3.1" +version = "2.4.0" description = "An async python package for interfacing with Cambridge Audio / Stream Magic compatible streamers." authors = ["Noah Husby <32528627+noahhusby@users.noreply.github.com>"] maintainers = ["Noah Husby <32528627+noahhusby@users.noreply.github.com>"]