audiobookshelf/test/server
Victor Da Luz 640c2f98b8 Add "Download by Chapters" tool for audiobooks
Adds a new tool in the item tools tab that splits a book's audio file
into per-chapter files using ffmpeg -c copy (no re-encoding) and
packages them as a ZIP download.

Key details:
- New GET /api/items/:id/download-chapters endpoint
- Accepts optional ?fileIno= to select which audio file to split when
  a book has multiple (e.g. m4b + mp3)
- Computes each file's start offset in the global chapter timeline and
  filters + re-bases chapter timestamps to be file-relative before
  splitting, handling the case where ABS stores chapters from all audio
  files with concatenated global timestamps
- Splits all chapters in parallel (ffmpeg -c copy per chapter) then
  streams the result as a ZIP
- Temp files written to MetadataPath/cache/items/:id/chapter-split-:ts
  with a timestamp suffix to prevent concurrent request collisions;
  cleaned up in a finally block regardless of success or failure
- UI shows a file selector dropdown when multiple audio files exist,
  with "Preparing..." state feedback during the request
- 10 new tests covering guard conditions and the chapter offset logic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 17:24:01 -06:00
..
controllers Add "Download by Chapters" tool for audiobooks 2026-04-14 17:24:01 -06:00
finders Improved subtitle parsing to account for bare colon in title 2026-02-06 14:31:09 -05:00
managers Merge pull request #3417 from nichwall/series_cleanup_2 2024-10-12 15:48:04 -05:00
migrations Improve book library page query performance for author sort order (#4080) 2025-03-17 17:09:49 -05:00
objects Fixes + add progress to m4b and embed tools 2024-07-20 12:28:06 +03:00
providers Add tests for cleanSeriesSequence 2024-03-14 19:37:51 +02:00
utils Improved subtitle parsing to account for bare colon in title 2026-02-06 14:31:09 -05:00
Logger.test.js Log non-strings into log file like console.log does 2024-09-11 19:58:30 +03:00