Repository navigation
Audiobooks: find, identify and play audiobooks with chapters and progress - #176
Merged
Merged
Conversation
…indexes Audio folders under audiobook folders (by name or by an 'audiobook' folder rule) and .m4b files become books. Book providers: iTunes, Google Books, Open Library and Audible (opt-in), with Audnexus chapters. Durations and embedded chapters (M4B chpl and chapter tracks, ID3 CHAP) are read from Telegram without downloading the files. Progress on the book timeline, bookmarks, manual identification. API under /api/v1/audiobooks.
Audiobooks pages (continue listening, all books, authors, series, review), book page with chapters, bookmarks and manual identification, settings section (sources, language, Audible store, scan) and the audiobook folder rule. The global player gets a book mode: resume, chapter navigation, -15/+30 s, speed, sleep at the end of the chapter, bookmarks, chapter on the lock screen, and progress saved on the server.
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.
Audiobooks for servers with the
audiobookscapability (TelegramFileManagerfeat/audiobooks,/api/v1/audiobooks). Version 1.14.0.What's in it
services/api/v1/modules/audiobooks.ts): list (paged,sortBy,progress,search,author,series),continue,authors,series, detail, progress GET/PUT/DELETE, finished POST/DELETE, bookmarks POST/PATCH/DELETE.HttpClientgainskeepalive. The section only appears with theaudiobookscapability (remembered for offline use)./audiobooks, sidebar, tab bar, card on the Channels screen): «Seguir escuchando», grid of square covers with progress bars, Todos / Autores / Series / Terminados, search, infinite scroll. Persisted react-query entries (apiCache) so it renders offline; covers go through a newcover-cacheCacheFirst rule of the service worker./audiobooks/:id): cover, authors, «Narrado por», series/number, length, description, chapters (tap = play from there), bookmarks (play, edit note, delete), «Continuar»/«Reproducir», «Desde el principio», «Marcar como (no) terminado», «Descargar» (whole book through the existing download queue → cached blobs, plays offline) with its state and removal.AudioPlayerServicethrough a smallPlaybackDelegate, not a second player. The queue holds the book's files;AudiobookPlaybackmaps the player position to the book timeline. Resumes at the newest of device/server progress and speed; chapter as title (also MediaSession); previous/next chapter from buttons, media keys and shortcuts; −15 s / +30 s across files (alsoseekbackward/seekforward); its own speed 0.5–3× withpreservesPitch; shuffle/repeat ignored inside a book; sleep timer «Final del capítulo»; bookmark with optional note; a dedicated expanded player view (lazy chunk). File changes still use the prepared standby element (no silent await, no fakepaused). Audiobook files are kept out of resume points and history, and files > 200 MB are not auto-cached while streaming.services/audiobooks/progressSync.ts): every 15 s while playing, on pause, chapter/file change, end of book (finished: true),visibilitychange/pagehide(fetchkeepalive). Each change is written to IndexedDB first (Dexie v6,audiobookProgress, dirty flag) and flushed ononline/app start; queued changes older than the server'slastPlayedAtare dropped.Tests
npm test: 189 passing (new: timeline maths, progress queue, the playback mode against the fake media element, library and book pages).npm run lint(0 errors, existing warnings only) andnpm run buildpass.Not verified