From: Bart <35781016+Bonusbartus@users.noreply.github.com> Date: Sat, 3 Jan 2026 23:20:42 +0000 (+0100) Subject: Enhanced Skip previous behavior (#2915) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=10fb99a06392a9633f46f288a45a3d242f0f4576;p=music-assistant-server.git Enhanced Skip previous behavior (#2915) --- diff --git a/music_assistant/controllers/player_queues.py b/music_assistant/controllers/player_queues.py index 5ecfd929..2bcdb5f1 100644 --- a/music_assistant/controllers/player_queues.py +++ b/music_assistant/controllers/player_queues.py @@ -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: