diff --git a/pyheos/message.py b/pyheos/message.py index b68d698..6be08ca 100644 --- a/pyheos/message.py +++ b/pyheos/message.py @@ -50,9 +50,9 @@ def _encode_query(cls, items: dict[str, Any], *, mask: bool = False) -> str: for key in sorted(items.keys()): value = const.MASK if mask and key in const.MASKED_PARAMS else items[key] item = f"{key}={HeosCommand._quote(value)}" - # Ensure 'url' goes last per CLI spec + # Ensure 'url' goes last per CLI spec and is not quoted if key == const.ATTR_URL: - pairs.append(item) + pairs.append(f"{key}={value}") else: pairs.insert(0, item) return "&".join(pairs) diff --git a/tests/fixtures/browse.play_stream.json b/tests/fixtures/browse.play_stream.json index a3ffdac..352ccc6 100644 --- a/tests/fixtures/browse.play_stream.json +++ b/tests/fixtures/browse.play_stream.json @@ -1 +1 @@ -{"heos": {"command": "browse/play_stream", "result": "success", "message": "pid=1&url=https://my.website.com/podcast.mp3"}} \ No newline at end of file +{"heos": {"command": "browse/play_stream", "result": "success", "message": "pid=1&url=https://my.website.com/podcast.mp3?patron-auth=qwerty"}} \ No newline at end of file diff --git a/tests/test_player.py b/tests/test_player.py index 8b18f51..0cc87ed 100644 --- a/tests/test_player.py +++ b/tests/test_player.py @@ -204,11 +204,14 @@ async def test_play_preset_station_invalid_index(player: HeosPlayer) -> None: @calls_command( "browse.play_stream", - {const.ATTR_PLAYER_ID: 1, const.ATTR_URL: "https://my.website.com/podcast.mp3"}, + { + const.ATTR_PLAYER_ID: 1, + const.ATTR_URL: "https://my.website.com/podcast.mp3?patron-auth=qwerty", + }, ) async def test_play_url(player: HeosPlayer) -> None: """Test the play url.""" - await player.play_url("https://my.website.com/podcast.mp3") + await player.play_url("https://my.website.com/podcast.mp3?patron-auth=qwerty") @pytest.mark.parametrize("quick_select", [0, 7])