Repository navigation
fix(bookmarks): play the item of the bookmark - #11
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Enter on a bookmark in the detail screen did not use the item of the bookmark.
handleSeekToBookmarkininternal/app/bookmarks.golooked only atisPlaying(). If an item played, it calledseekToBookGlobalPositionwith the time of the bookmark. It did not comparem.itemIDwith the item of the bookmark. So, while book A played, Enter on a bookmark of book B moved book A.abs.Bookmarkininternal/abs/types.go). While an item played, the handler moved that item. While no item played, the handler calledStartPlaySessionfor the podcast with no episode.What changes
handleSeekToBookmarkseeks 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 ofhandlePlayCmd:stopPlaybackCmds, thencloseThen.bookmarkEpisodefinds the episode of a podcast bookmark from the title of the bookmark.handleAddBookmarkputs the episode title andepisodeTitleSeparator(—) 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.SeekToBookmarkCmdhas the new fieldTitle.startEpisodePlaybackAtPositionCmdstarts an episode at a position.buildEpisodePlaySessionMsgmakes itsPlaySessionMsg.handlePlayEpisodeCmdalso uses that function now.AGENTS.mdhas two new lines about this behavior and the title format.Decisions:
cannot find the episode of this bookmarkand does not change the playback.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.internal/app)mainTestE2E_BookmarkEnterSwitchesToItemOfBookmarke2e_test.go:618: itemID = "item-001", want item-002TestE2E_PodcastBookmarkEnterSwitchesToEpisodeOfBookmarke2e_test.go:670: playing "item-001"/"", want pod-001/pod-001-ep-002TestE2E_PodcastBookmarkEnterWithSamePodcastPlayinge2e_test.go:738: playing "pod-001"/"pod-001-ep-001", want pod-001/pod-001-ep-002TestE2E_PodcastBookmarkEnterWithUnknownEpisodeKeepsPlaybacke2e_test.go:789: mock player position = 300.000000, want 50.0 (no seek)TestBookmarkEpisodeis a table test ofbookmarkEpisode.Checks on Linux, on the commit
674ee34of the branchrelease/v0.8.3. That commit adds only documentation to the last commit of this pull request (fbfc50e).gofmt -l .: no filego vet ./...: passgo build ./...: passgolangci-lint runwith version 2.14.0: 0 issuesPINE_REQUIRE_LIBMPV=1 PINE_REQUIRE_DBUS=1 go test ./... -count=1: 865 tests pass-race: 865 tests passNot verified
🤖 Generated with Claude Code