Skip to content

M4B audiobook parsing improvements#316

Merged
chocolatkey merged 3 commits into
developfrom
audiobook-parsing-improvements
Jul 8, 2026
Merged

M4B audiobook parsing improvements#316
chocolatkey merged 3 commits into
developfrom
audiobook-parsing-improvements

Conversation

@chocolatkey

Copy link
Copy Markdown
Member

This is a follow-up to the audiobook parsing that was implemented. Some weak points were identified after testing it, in particular with large .m4b files. More concurrency is now used to load the TOC of such files more quickly.
A bug was also found in the file fetcher
(Most changes by Claude Fable)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves M4B/MP4 audiobook probing performance for large files by adding bounded intra-file concurrency when fetching scattered chapter-title samples, and fixes an S3 range-read bug in the fetcher layer.

Changes:

  • Thread a concurrency setting from AudioParser through probing to MP4 chapter extraction to parallelize scattered chapter-title reads.
  • Implement concurrent, coalesced MP4 chapter-title sample fetching using errgroup with a configurable limit.
  • Fix s3Resource.Read to actually send the constructed GetObjectInput (including the Range header), and add tests to verify ranged vs whole-object reads.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/parser/audio/rich.go Passes parser concurrency into per-item probing.
pkg/parser/audio/probe.go Threads concurrency into MP4 probing path.
pkg/parser/audio/parser.go Clarifies concurrency semantics (file-level and intra-file).
pkg/parser/audio/mp4.go Adds concurrent chapter-title sample fetching with bounded parallelism.
pkg/fetcher/fetcher_s3.go Fixes S3 ranged reads by using the request object with Range applied.
pkg/fetcher/fetcher_s3_test.go Adds coverage to assert correct S3 range-header behavior and response slicing.
pkg/fetcher/fetcher_file.go Makes file-backed resources safer for concurrent ranged reads (ReadAt/SectionReader) and serializes offset-based reads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/parser/audio/mp4.go
chocolatkey and others added 2 commits July 8, 2026 01:10
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@chocolatkey chocolatkey merged commit de0cc0e into develop Jul 8, 2026
3 checks passed
@chocolatkey chocolatkey deleted the audiobook-parsing-improvements branch July 8, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants