attempt to fix track repeat on flow mode players
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 21 Aug 2024 19:37:14 +0000 (21:37 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 21 Aug 2024 19:37:14 +0000 (21:37 +0200)
music_assistant/server/controllers/player_queues.py

index dcca2b3fc429e32ecbb5ae8f06e1d97cc153f0c3..e4ebbe40cd98c3a56fdaeb37c5fcd0cd5178b406 100644 (file)
@@ -1218,12 +1218,16 @@ class PlayerQueuesController(CoreController):
         # player does not support enqueue next feature.
         # we wait for the player to stop after it reaches the end of the track
         if (
-            (not queue.flow_mode or queue.repeat_mode == RepeatMode.ALL)
+            (not queue.flow_mode or queue.repeat_mode in (RepeatMode.ALL, RepeatMode.ONE))
             # we have a couple of guards here to prevent the player starting
             # playback again when its stopped outside of MA's control
             and queue.stream_finished
             and queue.end_of_track_reached
             and queue.state == PlayerState.IDLE
+            and self._get_next_index(queue.queue_id, queue.current_index, allow_repeat=False)
+            is None
+            and self._get_next_index(queue.queue_id, queue.current_index, allow_repeat=True)
+            is not None
         ):
             queue.stream_finished = None
             self.mass.create_task(_enqueue_next(queue.current_index, False))