Skip to content

Add audio timing support for Bible chapters#49

Open
KallynGowdy wants to merge 4 commits into
mainfrom
claude/bible-api-issue-10-7og5yd
Open

Add audio timing support for Bible chapters#49
KallynGowdy wants to merge 4 commits into
mainfrom
claude/bible-api-issue-10-7og5yd

Conversation

@KallynGowdy

Copy link
Copy Markdown
Collaborator

Summary

This PR adds comprehensive support for audio timings (per-verse start times in seconds) across the Bible API generation and CLI tools. Audio timings allow clients to know exactly when each verse begins in an audio recording, enabling features like synchronized verse highlighting during playback.

Key Changes

API Generation (packages/helloao-tools/generation/)

  • Added ApiTranslationBookChapterAudioTimings schema and type to represent audio timing data for a specific chapter and reader
  • Extended ApiTranslationBookChapter to include three new fields:
    • thisChapterAudioTimings: Links to audio timing files for the current chapter
    • nextChapterAudioTimings: Links to audio timing files for the next chapter (nullable)
    • previousChapterAudioTimings: Links to audio timing files for the previous chapter (nullable)
  • Added bookChapterAudioTimingsApiLink() helper function to generate API endpoints for audio timing files
  • Updated API generation logic to process audio timings from the dataset and create corresponding API output files
  • Added new endpoint /api/{translation}/{book}/{chapter}.{reader}.audioTimings.json to OpenAPI documentation

Database Layer (packages/helloao-cli/)

  • Added ChapterAudioTiming Prisma model to store per-verse timing data (JSON array of seconds)
  • Created database migration to add the ChapterAudioTiming table with proper foreign key relationships
  • Added upsertChapterAudioTiming() function for inserting/updating timing records
  • Updated insertTranslationContent() to persist audio timings when importing translations
  • Modified loadTranslationDatasets() to load audio timings from the database

CLI Tools (packages/helloao-cli/)

  • Added importAudioTimings() command to import audio timing data from JSON files
  • Added import-audio-timings CLI command that accepts a JSON file with timing records
  • Defined AudioTimingRecord interface for the import format

Data Models (packages/helloao-tools/generation/common-types.ts)

  • Added TranslationBookChapterAudioTimings schema and type representing a map of reader IDs to verse timing arrays
  • Updated TranslationBookChapter to include thisChapterAudioTimings field

Tests

  • Updated all test cases to include the new audio timing fields in expected outputs

Implementation Details

  • Audio timings are stored as JSON arrays of numbers (seconds) in the database
  • The API generates individual JSON files for each chapter/reader combination at the endpoint pattern {chapter}.{reader}.audioTimings.json
  • Audio timing links are included in chapter metadata alongside audio links, maintaining parallel structure
  • The implementation follows the existing pattern used for audio links, ensuring consistency across the codebase

https://claude.ai/code/session_016Ku4uMT7pCxVbLKnUCf9rC

claude added 4 commits July 3, 2026 13:24
Implements the API design from issue #10 (comment #2657325351): chapters
now expose thisChapterAudioTimings/previousChapterAudioTimings/nextChapterAudioTimings
link maps, and a new per-reader endpoint
`/api/{translation}/{book}/{chapter}.{reader}.audioTimings.json` returns
the per-verse start times (in seconds).

Timing data is stored in a new ChapterAudioTiming table (mirroring
ChapterAudioUrl) and surfaced through dataset generation, API generation,
and static file output, following the existing audio-links plumbing.
Since no formula can generate real timing data, a new
`import-audio-timings` CLI command lets timing data be loaded from a
JSON file into the database whenever it becomes available.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Ku4uMT7pCxVbLKnUCf9rC
The docs build (vuepress + @vuepress/theme-default) compiles SCSS via
Vite, which requires a sass implementation to be installed but none was
declared, breaking `npm run build:docs` in CI (and locally).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Ku4uMT7pCxVbLKnUCf9rC
The workflow was pinned to Node 20.x while package.json requires
node ^22.19.0. This mismatch left pnpm installing on an unsupported
engine, which likely contributed to native module (better-sqlite3)
build failures on Windows runners.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Ku4uMT7pCxVbLKnUCf9rC
better-sqlite3 can't compile on the windows-latest runner: node-gyp
v11.1.0 (bundled with pnpm 10.12.1) doesn't recognize the Visual Studio
version installed on the image, so the native module build fails
regardless of Node version. This is an upstream node-gyp/toolchain gap,
not something fixable from this repo. Testing on ubuntu and macOS covers
the supported platforms until that's resolved separately.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Ku4uMT7pCxVbLKnUCf9rC
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