Repository navigation
fix(scanner): read Ogg and Opus audiobook tags from the audio stream - #3165
Conversation
Ogg stores Vorbis comments per stream, so ffprobe reports an Ogg Vorbis or Opus file's title, artist, narrator and date on the audio stream and leaves format.tags empty. The audiobook and podcast scanners read only format tags, so those books lost their author, narrator, year, description, series and genres, keeping only a filesystem-derived title. For Ogg containers, fill the keys format tags lack from the first audio stream's tags. Other containers are unchanged: their stream tags (language, handler_name) describe the track, not the file.
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
The Evidence table describes the results but does not show the changed views. Please add before-and-after captures of Authors and People search using the same synthetic Ogg/Opus books, identify each build, and include desktop and phone-width web captures (or explain why mobile is unaffected). |
|
This change is visible: Ogg/Opus stream tags add book credits and year, affecting Authors browsing and People search. The Evidence table describes the results but does not show them. Please add before-and-after captures of the same Authors view and People search with the same test books/query, identifying the surface and build; include desktop and phone-width web captures for both where those screens show the change. Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
The
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
Problem
Related issue: #1253
Validation tasks: unblocks #1254 C2; unblocks #1256 C2 and C11
Audiobooks stored as Ogg Vorbis (
.ogg) or Opus (.opus) lose all of their tags. They show no author or narrator, no year, summary, series or genres, and can't be found by author or narrator. Only the title survives, because it falls back to the folder name.The scanner reads book metadata from ffprobe's container-level tags (
format.tags). Ogg keeps its Vorbis comments on the audio stream instead, so for these filesformat.tagsis empty. This change reads them from there.Approach
When the container is Ogg,
FormatTagstakes any key it is missing from the first audio stream's tags, normalised the same way. Container tags still win when both have a key, and cover-art streams are skipped. The fallback is limited to Ogg on purpose: in MP4 the audio stream carries tags such aslanguage=undandhandler_name, which would otherwise leak into book metadata.The podcast scanner is the only other reader of
FormatTags, so Ogg and Opus podcast episodes also get their file tags now. Chapters were already read correctly from Ogg files.Books already in a library are re-read only when their files change, or while they are still unmatched. The unchanged-folder check skips the rest, so an Ogg/Opus book that was already matched keeps its missing credits until its files change.
Validation
go test ./internal/scanner/...: pass. The new test feeds Ogg- and MP4-shaped ffprobe output through the probe parser; it fails without the fix.Evidence
Zoë Ångström(author),Søren Ølgaard(narrator), 2018Evan Pryce(author)Surface and build: catalog data after a fresh scan of the same synthetic files; before on
e6df1d8ed, after on this branch. Web search for "Ångström" in the Audiobooks scope returns the author under People only after the change.Risks
None identified. Only files in an Ogg container take the new path.
Checklist
AI Disclosure
Note
Fix Ogg/Opus audiobook tag reading to use audio stream tags
Ogg files often store metadata on the audio stream rather than the container. A new
formatTagshelper in probe.go fills missing keys from the first audio stream for Ogg files only; format-level tags take precedence, and non-audio streams are skipped. Other containers keep using container-level tags only. Adds tests in probe_container_test.go covering stream tag fallback, precedence, and non-Ogg behavior.Macroscope summarized 174b6cb.