Repository navigation
v2.4.0: a re-ordered download takes the new order on its next online start - #133
Merged
Merged
Conversation
…rder Server v2.4.0 plays a book's files in natural order, so a downloaded book can come back with the same files in another order. refreshedChapters refused that, leaving the offline copy on the old whole-book timeline while the server and an online start used the new one. The same file set in a new order now adopts the server's chapters and order (no download), held while the player has the book loaded in the old order and taken from the cached answer once the loaded book changes.
- A new file order moves only the chapters: manifest.files stays in the order the download wrote it, since a file's index there is its name on disk (relocateEntry at every launch, runOne's retry). Reordering it swapped audio between files after a relaunch, or dropped the book and deleted its folder when the extensions differed. refreshedFor now gets the new order from chaptersRefresh instead of the files array identity. - The loaded-order probe also covers a playBook in flight (its queue is built before the place lookup, nowPlaying only after), so a new order landing in that window waits; the start takes a held one as it ends. - The car sync rebuilds the snapshot when a downloaded book's chapters change, so Android's no-JS play spec follows a new order. - Cleanups: one take step for startChapterRefresh and adoptCachedChapters, withCachedChapters takes a BookRef, selectBookKey in the subscription, shared cacheHolds and the real chapters key in tests; docs and comments (types.ts, book-queue.ts, CONVENTIONS) say what the code does now.
The hold could see only what JS loaded, so after an Android JS restart (or a relaunch mid-Cast) a chapters answer landing before adoptLoaded could move the order the engine's track index is mapped through. A background answer now never changes a download's file order; playBook hands the chapters it loaded the engine with to adoptStartedChapters once the load landed and the start still owns the engine, saved at once. Same order chapter refreshes are unchanged. Removes the loaded-order probe, startingOrders and the take-on-unload path.
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.
Server v2.4.0 (server#171) plays a book's files in natural order and re-orders an existing book once. On main, a downloaded copy of a re-ordered book kept its old order while online starts used the new one, so whole-book positions were saved against two different timelines.
The fix: a downloaded copy takes the server's new order only when a start loads that order. The start's load must have landed, and the start must still own the engine. The file set must be the same paths with matching sizes. Only the copy's chapters change; its files keep their download order on disk, so nothing is downloaded again.
Background chapters answers still refuse a reorder, as on main. Until its next online start, the copy plays in its download order. That covers offline starts, Android's no-JS car start and
adoptLoadedafter a JS restart. A start with no chapters builds its queue from the download's own chapters and files.Tests cover each path. They also cover an overtaken start, a size change and a different file set, and an Android
adoptLoadedafter a restart. The guard tests fail without their guards. The gate is green: tsc, lint, format and test (5419). /simplify and /code-review max --fix ran, then a fix-round /code-review high --fix.Needs a device run: an online start of a re-ordered download, a JS restart mid-play on Android, an Android Auto start, offline playback afterwards, and a relaunch while casting.
Follow-ups, filed separately: an Android JS restart during the load window itself, and chapters with no file list.
Pairs with KodeStar/audiosilo-docs#163.