From bf8a2cdcb597cd84a6494ce409c223f0e09d9b33 Mon Sep 17 00:00:00 2001 From: Gilles Boccon-Gibod Date: Sat, 26 Jul 2025 20:24:55 -0700 Subject: [PATCH] add discrete command methods --- bumble/profiles/ams.py | 44 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/bumble/profiles/ams.py b/bumble/profiles/ams.py index 6d2b86b..6693bdd 100644 --- a/bumble/profiles/ams.py +++ b/bumble/profiles/ams.py @@ -212,7 +212,7 @@ class AmsClient(utils.EventEmitter): supported_commands: set[RemoteCommandId] player_name: str = "" - player_playback_info: PlaybackInfo + player_playback_info: PlaybackInfo = PlaybackInfo(PlaybackState.PAUSED, 0.0, 0.0) player_volume: float = 1.0 queue_count: int = 0 queue_index: int = 0 @@ -277,6 +277,48 @@ class AmsClient(utils.EventEmitter): bytes([command]), with_response=True ) + async def play(self) -> None: + await self.command(RemoteCommandId.PLAY) + + async def pause(self) -> None: + await self.command(RemoteCommandId.PAUSE) + + async def toggle_play_pause(self) -> None: + await self.command(RemoteCommandId.TOGGLE_PLAY_PAUSE) + + async def next_track(self) -> None: + await self.command(RemoteCommandId.NEXT_TRACK) + + async def previous_track(self) -> None: + await self.command(RemoteCommandId.PREVIOUS_TRACK) + + async def volume_up(self) -> None: + await self.command(RemoteCommandId.VOLUME_UP) + + async def volume_down(self) -> None: + await self.command(RemoteCommandId.VOLUME_DOWN) + + async def advance_repeat_mode(self) -> None: + await self.command(RemoteCommandId.ADVANCE_REPEAT_MODE) + + async def advance_shuffle_mode(self) -> None: + await self.command(RemoteCommandId.ADVANCE_SHUFFLE_MODE) + + async def skip_forward(self) -> None: + await self.command(RemoteCommandId.SKIP_FORWARD) + + async def skip_backward(self) -> None: + await self.command(RemoteCommandId.SKIP_BACKWARD) + + async def like_track(self) -> None: + await self.command(RemoteCommandId.LIKE_TRACK) + + async def dislike_track(self) -> None: + await self.command(RemoteCommandId.DISLIKE_TRACK) + + async def bookmark_track(self) -> None: + await self.command(RemoteCommandId.BOOKMARK_TRACK) + def _on_remote_command_notification(self, data: bytes) -> None: supported_commands = [RemoteCommandId(command) for command in data] logger.debug(