Repository navigation
Audiobookshelf: send ebookLocation so ABS's reader resumes in place - #24
Conversation
ABS's built-in EPUB reader resumes only from mediaProgress.ebookLocation (an epubcfi), so after a sync "Read" always opened at page one even though the progress percentage was correct. Push: resolve the device's KOReader XPath against the item's EPUB (GET /api/items/:id/ebook) with the existing epubPosition helper and send ebookLocation + ebookProgress alongside progress/currentTime. The EPUB map is stored per book via withEpubMap, items with no EPUB are remembered for an hour so audio-only books don't trigger a lookup on every push, and any failure still lands the percentage. Pull: for ebook-only items (no audio duration), read ebookProgress instead of progress and map ebookLocation back to an exact XPath with epubXPath, so reading in ABS's web reader syncs to the device. Items with audio keep the listening position as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VSu9p45TgStCPnzV4mSRYc
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The change adds EPUB position sync to Audiobookshelf, with fallback to percentage-only progress when an EPUB or position cannot be resolved. No concrete merge-blocking risk was identified. Pre-merge checks |
|
Audiobookshelf: send
ebookLocationso ABS's reader resumes in placeProblem
After a sync, ABS shows the right percentage, but clicking Read opens the EPUB at page one. ABS's built-in reader resumes only from
mediaProgress.ebookLocation, and only when that value is anepubcfi(...)(seeclient/components/readers/EpubReader.vue,savedEbookLocation). The connector sent onlyprogress, pluscurrentTime/durationfor audiobooks.Change
Push (device → ABS)
GET /api/items/:id/ebook) using the existingepubPositionhelper, and sendebookLocation(CFI) andebookProgressalongside the existing fields. ABS applies these directly throughMediaProgress.applyProgressUpdate→this.set(payload).withEpubMap, as the BookOrbit connector does, so each book is downloaded once.Pull (ABS → device)
ebookProgressinstead ofprogress, and mapebookLocationback to an exact XPath withepubXPath, so reading in ABS's web reader syncs back to the device. Previously these changes were never picked up.Tests
New
test/audiobookshelf-ebook.test.ts(9 tests):Full suite passes: 39 files, 584 tests.
Tested live
Xteink X4 running CrossPoint → self-hosted crosspoint-sync → Audiobookshelf v2.37.1 behind SWAG. After Upload Local on the device, Read in ABS opens on the page being read.
🤖 Generated with Claude Code