Fix changing repeat mode while playing
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 19 Dec 2025 22:07:03 +0000 (23:07 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 19 Dec 2025 22:07:03 +0000 (23:07 +0100)
music_assistant/controllers/player_queues.py

index 7b7aa8ce1857f3314f0d898d5de73414d2ca101e..6bcbbe8e7d89d99af0250e2c9c308058f751dc2e 100644 (file)
@@ -364,6 +364,17 @@ class PlayerQueuesController(CoreController):
             return  # no change
         queue.repeat_mode = repeat_mode
         self.signal_update(queue_id)
+        if (
+            queue.state == PlaybackState.PLAYING
+            and queue.index_in_buffer is not None
+            and queue.index_in_buffer == queue.current_index
+        ):
+            # if the queue is playing,
+            # ensure to (re)queue the next track because it might have changed
+            # note that we only do this if the player has loaded the current track
+            # if not, we wait until it has loaded to prevent conflicts
+            if next_item := self.get_next_item(queue_id, queue.index_in_buffer):
+                self._enqueue_next_item(queue_id, next_item)
 
     @api_command("player_queues/play_media")
     async def play_media(