Skip to content

Commit

Permalink
optimistically update player after sync/unsync
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Dec 30, 2023
1 parent c449991 commit d47681a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions music_assistant/server/controllers/players.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,8 @@ async def cmd_sync(self, player_id: str, target_player: str) -> None:
player_provider = self.get_player_provider(player_id)
await player_provider.cmd_sync(player_id, target_player)
child_player.hidden_by.add(target_player)
# optimistically update the player to update the UI as fast as possible
player_provider.poll_player(player_id)

@api_command("players/cmd/unsync")
@log_player_command
Expand Down Expand Up @@ -603,6 +605,8 @@ async def cmd_unsync(self, player_id: str) -> None:
player.hidden_by.remove(player.synced_to)
player_provider = self.get_player_provider(player_id)
await player_provider.cmd_unsync(player_id)
# optimistically update the player to update the UI as fast as possible
player_provider.poll_player(player_id)

def _check_redirect(self, player_id: str) -> str:
"""Check if playback related command should be redirected."""
Expand Down

0 comments on commit d47681a

Please sign in to comment.