Skip to content

Commit

Permalink
Merge pull request #28 from noahhusby/feat/radio-support
Browse files Browse the repository at this point in the history
Add stream radio calls
  • Loading branch information
noahhusby authored Sep 17, 2024
2 parents 8d2734c + 7fd0e6e commit 6245b69
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions aiostreammagic/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
17 changes: 17 additions & 0 deletions aiostreammagic/stream_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
maintainers = ["Noah Husby <[email protected]>"]
Expand Down

0 comments on commit 6245b69

Please sign in to comment.