Enhanced Skip previous behavior (#2915)
authorBart <35781016+Bonusbartus@users.noreply.github.com>
Sat, 3 Jan 2026 23:20:42 +0000 (00:20 +0100)
committerGitHub <noreply@github.com>
Sat, 3 Jan 2026 23:20:42 +0000 (00:20 +0100)
music_assistant/controllers/player_queues.py

index 5ecfd9294ab440bcd56eabe82f1f7f46b8f8c5b5..2bcdb5f1aed49f6982b3f0fdc542e364f1fb00b9 100644 (file)
@@ -783,7 +783,12 @@ class PlayerQueuesController(CoreController):
         current_index = self._queues[queue_id].current_index
         if current_index is None:
             return
-        await self.play_index(queue_id, max(current_index - 1, 0), debounce=True)
+        next_index = int(current_index)
+        # restart current track if current track has played longer than 4
+        # otherwise skip to previous track
+        if self._queues[queue_id].elapsed_time < 5:
+            next_index = max(current_index - 1, 0)
+        await self.play_index(queue_id, next_index, debounce=True)
 
     @api_command("player_queues/skip")
     async def skip(self, queue_id: str, seconds: int = 10) -> None: