Skip to content

Slice 14 — Jamendo search, preview, download (#15) - #35

Merged
cbaucom merged 1 commit into
mainfrom
feat/15-jamendo-search-preview-download
Jun 11, 2026
Merged

cbaucom merged 1 commit into
mainfrom
feat/15-jamendo-search-preview-download

Conversation

@cbaucom

@cbaucom cbaucom commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Closes #15

Summary

  • New src/jamendo/ module: client.ts (API search), download.ts (file download + sanitize), types.ts (JamendoTrack, JamendoAttribution), all tested against mocked fetch responses (11 tests).
  • JamendoPanel.tsx: search form, results list (title/artist/duration), per-track preview play/stop via HTMLAudioElement, Add button that downloads to project folder and sets attribution. Error/empty states both show fallback hint.
  • App.tsx: handleJamendoAdd downloads track, re-enumerates audio, sets filename + attribution; loadFolder restores attribution (cleared when soundtrack file no longer valid); autosave includes attribution.
  • slidePersistence.ts: slidesToJson extended with soundtrackAttribution? param.
  • schema.ts: SlideshowJson extended with soundtrackAttribution?: JamendoAttribution.
  • env.d.ts: VITE_JAMENDO_CLIENT_ID typed. Panel renders only when env var is set.

Acceptance criteria

  • Given a search term, when submitted, then results show title/artist/duration with working preview play/stop — verified via Playwright smoke test with mocked Jamendo API returning 2 tracks.
  • Given a chosen result, when added, then the audio file exists in the project folder, appears as a soundtrack option, and its attribution is recorded — handleJamendoAdd downloads via File System Access API, re-enumerates, sets state; attribution serialized in slideshow.json.
  • Given API failure or zero results, when searching, then a readable empty/error state shows with a hint to drop an audio file into the folder instead — confirmed both states in Playwright smoke check.

Code review verdict

APPROVED after fixing 8 findings:

  • Orphaned attribution cleared when saved soundtrack file no longer exists on reload
  • audio.play() rejection now caught; previewId reverts to null on autoplay block
  • Audio element paused on component unmount (useEffect cleanup)
  • Stale onended cleared before replacing audioRef.current
  • handleAdd now surfaces download errors in UI
  • enumerateAudioTracks failure after successful download surfaced via setError
  • MIME type guard in downloadTrack rejects non-audio responses
  • slidePersistence.test.ts: added truthy + null tests for soundtrackAttribution

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cbaucom
cbaucom merged commit 00200e3 into main Jun 11, 2026
1 check passed
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.

Slice 14 — Jamendo search, preview, download

1 participant