Skip to content

fix(bookmarks): play the item of the bookmark - #11

Merged
Thelost77 merged 2 commits into
mainfrom
fix/bookmark-playback-switch
Oct 13, 2026
Merged

Thelost77 merged 2 commits into
mainfrom
fix/bookmark-playback-switch

Conversation

@Thelost77

Copy link
Copy Markdown
Owner

What was wrong

Enter on a bookmark in the detail screen did not use the item of the bookmark.

  1. Enter on a bookmark moved the item that played. handleSeekToBookmark in internal/app/bookmarks.go looked only at isPlaying(). If an item played, it called seekToBookGlobalPosition with the time of the bookmark. It did not compare m.itemID with the item of the bookmark. So, while book A played, Enter on a bookmark of book B moved book A.
  2. Enter on a podcast bookmark did not use the episode of the bookmark. A bookmark has no episode ID (abs.Bookmark in internal/abs/types.go). While an item played, the handler moved that item. While no item played, the handler called StartPlaySession for the podcast with no episode.

What changes

  • handleSeekToBookmark seeks the player only if the book or the episode of the bookmark plays. If not, it stops the current playback, closes its session, and then starts the book or the episode at the time of the bookmark. The order is that of handlePlayCmd: stopPlaybackCmds, then closeThen.
  • bookmarkEpisode finds the episode of a podcast bookmark from the title of the bookmark. handleAddBookmark puts the episode title and episodeTitleSeparator (—) before the title of a podcast bookmark. Each release has that format, from v0.1.0. If more than one episode title is before the bookmark title, the longest is the episode.
  • detail.SeekToBookmarkCmd has the new field Title.
  • startEpisodePlaybackAtPositionCmd starts an episode at a position. buildEpisodePlaySessionMsg makes its PlaySessionMsg. handlePlayEpisodeCmd also uses that function now.
  • AGENTS.md has two new lines about this behavior and the title format.

Decisions:

  • If the title of a podcast bookmark gives no episode and the podcast of the bookmark plays, Enter seeks the episode that plays, as before. If that podcast does not play, pine shows the error cannot find the episode of this bookmark and does not change the playback.
  • The episode comes from the title, because the bookmark has no other data about the episode. A bookmark has no episode title if the user changed its title, or if a different program made it.
  • If two episodes have the same title, the first of them in the episode list is the episode.

How it was tested

Each fault has a test that failed with the code of main (ce7ab8b). The tests use the fake Audiobookshelf server and the mock player of the app tests.

Fault Test (internal/app) Failure with the code of main
1 TestE2E_BookmarkEnterSwitchesToItemOfBookmark e2e_test.go:618: itemID = "item-001", want item-002
2 TestE2E_PodcastBookmarkEnterSwitchesToEpisodeOfBookmark e2e_test.go:670: playing "item-001"/"", want pod-001/pod-001-ep-002
2 TestE2E_PodcastBookmarkEnterWithSamePodcastPlaying e2e_test.go:738: playing "pod-001"/"pod-001-ep-001", want pod-001/pod-001-ep-002
2 TestE2E_PodcastBookmarkEnterWithUnknownEpisodeKeepsPlayback e2e_test.go:789: mock player position = 300.000000, want 50.0 (no seek)

TestBookmarkEpisode is a table test of bookmarkEpisode.

Checks on Linux, on the commit 674ee34 of the branch release/v0.8.3. That commit adds only documentation to the last commit of this pull request (fbfc50e).

  • gofmt -l .: no file
  • go vet ./...: pass
  • go build ./...: pass
  • golangci-lint run with version 2.14.0: 0 issues
  • PINE_REQUIRE_LIBMPV=1 PINE_REQUIRE_DBUS=1 go test ./... -count=1: 865 tests pass
  • The same command with -race: 865 tests pass

Not verified

  • No real Audiobookshelf server ran. pine did not run in a terminal. The tests send messages to the model and read its state.
  • The statement that a bookmark has no episode ID is from the bookmark type of pine. The source of Audiobookshelf was not read.
  • The answer of Audiobookshelf to a play request for a podcast with no episode is not known. pine does not send that request for a bookmark now.

🤖 Generated with Claude Code

Enter on a bookmark seeked the player whatever played: a bookmark
of book B moved book A. Stop the other playback and start the
book or the episode of the bookmark at its time.

ABS bookmarks have no episode ID. Find the episode of a podcast
bookmark from the title prefix that handleAddBookmark writes.
Show an error if no episode matches and the podcast does not play.
The unknown-episode test did not run the command that Enter
returns, so its checks for no seek and no request could not fail.
@Thelost77
Thelost77 merged commit 889def5 into main Oct 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant