diff --git a/music_assistant/server/controllers/players.py b/music_assistant/server/controllers/players.py index 1e783174a..ffb188188 100644 --- a/music_assistant/server/controllers/players.py +++ b/music_assistant/server/controllers/players.py @@ -836,7 +836,6 @@ def update( prev_state, new_state, ignore_keys=[ - "elapsed_time", "elapsed_time_last_updated", "seq_no", "last_poll", @@ -848,13 +847,15 @@ def update( # ignore updates for disabled players return - # always signal update to the playerqueue - self.mass.player_queues.on_player_update(player, changed_values) - if len(changed_values) == 0 and not force_update: return - self.mass.signal_event(EventType.PLAYER_UPDATED, object_id=player_id, data=player) + # signal update to the playerqueue + self.mass.player_queues.on_player_update(player, changed_values) + + if changed_values != {"elapsed_time"} or force_update: + # ignore elapsed_time only changes + self.mass.signal_event(EventType.PLAYER_UPDATED, object_id=player_id, data=player) if skip_forward and not force_update: return @@ -1226,9 +1227,7 @@ async def _poll_players(self) -> None: player_id = player.player_id # if the player is playing, update elapsed time every tick # to ensure the queue has accurate details - player_playing = ( - player.active_source == player.player_id and player.state == PlayerState.PLAYING - ) + player_playing = player.state == PlayerState.PLAYING if player_playing: self.mass.loop.call_soon(self.update, player_id) # Poll player; diff --git a/music_assistant/server/providers/player_group/__init__.py b/music_assistant/server/providers/player_group/__init__.py index 064767ade..b3b5c6f06 100644 --- a/music_assistant/server/providers/player_group/__init__.py +++ b/music_assistant/server/providers/player_group/__init__.py @@ -511,13 +511,6 @@ async def poll_player(self, player_id: str) -> None: if 'needs_poll' is set to True in the player object. """ if group_player := self.mass.players.get(player_id): - # dynamically change the poll interval - if group_player.state == PlayerState.PLAYING: - group_player.poll_interval = 5 - elif group_player.powered: - group_player.poll_interval = 20 - else: - group_player.poll_interval = 60 self._update_attributes(group_player) async def create_group(self, group_type: str, name: str, members: list[str]) -> Player: @@ -690,7 +683,7 @@ async def _register_group_player( group_childs=set(members), active_source=group_player_id, needs_poll=True, - poll_interval=5, + poll_interval=30, ) await self.mass.players.register_or_update(player) diff --git a/music_assistant/server/providers/slimproto/__init__.py b/music_assistant/server/providers/slimproto/__init__.py index dcccfe4ec..f78d2b9ab 100644 --- a/music_assistant/server/providers/slimproto/__init__.py +++ b/music_assistant/server/providers/slimproto/__init__.py @@ -931,7 +931,7 @@ async def _serve_multi_client_stream(self, request: web.Request) -> web.Response fmt = request.query.get("fmt") child_player_id = request.query.get("child_player_id") - if not (player := self.mass.players.get(player_id)): + if not self.mass.players.get(player_id): raise web.HTTPNotFound(reason=f"Unknown player: {player_id}") if not (child_player := self.mass.players.get(child_player_id)): @@ -955,8 +955,7 @@ async def _serve_multi_client_stream(self, request: web.Request) -> web.Response # all checks passed, start streaming! self.logger.debug( - "Start serving multi-client flow audio stream for player %s to %s", - player.display_name, + "Start serving multi-client flow audio stream to %s", child_player.display_name, )