Adding announcement flag to media player command (#871)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Mischa Siekmann 2024-05-15 00:05:18 +02:00 committed by GitHub
parent 8e6717c197
commit 8778ad485c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 187 additions and 170 deletions

View File

@ -1175,6 +1175,9 @@ message MediaPlayerCommandRequest {
bool has_media_url = 6;
string media_url = 7;
bool has_announcement = 8;
bool announcement = 9;
}
// ==================== BLUETOOTH ====================

File diff suppressed because one or more lines are too long

View File

@ -1192,6 +1192,7 @@ class APIClient:
command: MediaPlayerCommand | None = None,
volume: float | None = None,
media_url: str | None = None,
announcement: bool | None = None,
) -> None:
req = MediaPlayerCommandRequest(key=key)
if command is not None:
@ -1203,6 +1204,9 @@ class APIClient:
if media_url is not None:
req.media_url = media_url
req.has_media_url = True
if announcement is not None:
req.announcement = announcement
req.has_announcement = True
self._get_connection().send_message(req)
def text_command(self, key: int, state: str) -> None:

View File

@ -794,6 +794,16 @@ async def test_select_command(
dict(key=1, media_url="http://example.com"),
dict(key=1, has_media_url=True, media_url="http://example.com"),
),
(
dict(key=1, media_url="http://example.com", announcement=True),
dict(
key=1,
has_media_url=True,
media_url="http://example.com",
has_announcement=True,
announcement=True,
),
),
],
)
async def test_media_player_command(