diff --git a/src/pyblu/entities.py b/src/pyblu/entities.py index e039985..9f60c77 100644 --- a/src/pyblu/entities.py +++ b/src/pyblu/entities.py @@ -155,7 +155,7 @@ class Preset: @dataclass class Input: - id: str + id: str | None """Unique id of the input""" text: str """User friendly name of the input""" diff --git a/src/pyblu/parse.py b/src/pyblu/parse.py index 74ae591..0b1f7d1 100644 --- a/src/pyblu/parse.py +++ b/src/pyblu/parse.py @@ -225,7 +225,7 @@ def parse_inputs(response: bytes) -> list[Input]: inputs = [ Input( - id=x.attrib["id"], + id=x.attrib.get("id"), text=x.attrib["text"], image=x.attrib["image"], url=unquote(x.attrib["URL"]), diff --git a/tests/test_player.py b/tests/test_player.py index 9a70bc0..37248a4 100644 --- a/tests/test_player.py +++ b/tests/test_player.py @@ -635,7 +635,7 @@ async def test_inputs(): status=200, body=""" - + @@ -647,7 +647,7 @@ async def test_inputs(): mocked.assert_called_once() assert inputs == [ - Input(id="input3", text="Bluetooth", image="/images/BluetoothIcon.png", url="Capture:bluez:bluetooth"), + Input(id=None, text="Bluetooth", image="/images/BluetoothIcon.png", url="Capture:bluez:bluetooth"), Input(id="input2", text="HDMI ARC", image="/images/capture/ic_tv.png", url="Capture:hw:imxspdif,0/1/25/2?id=input2"), Input(id="Spotify", text="Spotify", image="/Sources/images/SpotifyIcon.png", url="Spotify:play"), ]