Skip to content

Start at 0:00 when seeking to the start of an audiobook or episode - #7363

Merged
OzGav merged 2 commits into
devfrom
queue-seek-to-start
Nov 6, 2026
Merged

OzGav merged 2 commits into
devfrom
queue-seek-to-start

Conversation

@fmunkes

@fmunkes fmunkes commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What does this implement/fix?

Seeking to 0:00 (seek bar, chapter 1) restarted an audiobook or episode at its resume point, because play_index read 0 as "no position given". The public play_index keeps that behaviour for clients, and seek() now calls a private _play_index directly. Most of the diff is the unchanged body moving to the bottom of the file. The actual change:

     async def seek(self, queue_id: str, position: int = 10) -> None:
-        await self.play_index(queue_id, queue.current_index, seek_position=position)
+        await self._play_index(queue_id, queue.current_index, position, fade_in=False)

     async def play_index(self, queue_id, index, seek_position: int = 0, fade_in=False) -> None:
         self._check_player_permission(queue_id)
+        await self._play_index(queue_id, index, seek_position or None, fade_in)

+    async def _play_index(self, queue_id, index, seek_position: int | None, fade_in: bool) -> None:
         ...
-            if (
-                not seek_position
-                and not restarting_ended_queue
-                and (queue_item := self.get_item(queue_id, index))
-            ):
-                seek_position = await self._get_resume_position(queue_item)
+            if seek_position is None:
+                seek_position = (
+                    await self._get_resume_position(queue_item)
+                    if not restarting_ended_queue and (queue_item := self.get_item(queue_id, index))
+                    else 0
+                )

Related issue (if applicable):

Types of changes

  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • New music/player/metadata/plugin provider — new-provider
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — documentation
  • Maintenance / chore — maintenance
  • CI / workflow change — ci
  • Dependencies bump — dependencies

Checklist

  • The code change is tested and works locally.
  • pre-commit run --all-files passes.
  • pytest passes, and tests have been added/updated under tests/ where applicable.
  • For changes to shared models, the companion PR in music-assistant/models is linked.
  • For changes affecting the UI, the companion PR in music-assistant/frontend is linked.
  • I have read and complied with the project's AI Policy for any AI-assisted contributions.
  • I have raised a PR against the documentation repository targeting the main or beta branch as appropriate.

@github-actions github-actions Bot added the bugfix label Nov 3, 2026
@fmunkes fmunkes changed the title Start an audiobook at 0:00 when seeking to the start Start at 0:00 when seeking to the start of an audiobook or episode Nov 3, 2026
@fmunkes
fmunkes marked this pull request as ready for review November 3, 2026 19:28

@Bot-MArley Bot-MArley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This comment was written by Claude and posted by Bot-MArley on behalf of the Music Assistant maintainers.

This fixes seeking to 0:00 on an audiobook or episode: seek() now calls a private _play_index so a position of 0 means "start at 0" instead of "use the resume point", while the public play_index keeps its old behaviour for clients. Most of the diff is the unchanged body moving to the bottom of the file.

I read the whole diff and found nothing to change. seek() still has @handle_play_action and its own permission check, and the other play_index callers behave as before. CI is green, so this is waiting for a maintainer to review and merge.

@OzGav OzGav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but needs a careful rebase after #7395

@fmunkes
fmunkes added this pull request to the merge queue Nov 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 6, 2026

@Bot-MArley Bot-MArley left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

This comment was written by Claude and posted by Bot-MArley on behalf of the Music Assistant maintainers.

This only brings the branch up to date with dev (the rebase after #7395); the PR's own change to seeking to 0:00 is unchanged and I found no issues in it.

Requested changes: none. Checks are green, so it waits for a maintainer to merge; the earlier approval was on the previous commit.

@OzGav
OzGav added this pull request to the merge queue Nov 6, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 6, 2026
@OzGav

OzGav commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

@fmunkes can you have another look?

@OzGav
OzGav added this pull request to the merge queue Nov 6, 2026
Merged via the queue into dev with commit 64063ab Nov 6, 2026
22 checks passed
@OzGav
OzGav deleted the queue-seek-to-start branch November 6, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants