Koito/internal/mbz
safierinx-a 2c29499403 Add MusicBrainz search-by-name enrichment for scrobbles without IDs
When a listen arrives with no MBZ IDs and no album title (the common
multi-scrobbler/Last.fm case), search MusicBrainz by artist+track name
to resolve recording, release, and release group IDs. This unlocks
CoverArtArchive album art, proper album association, and duration data.

New file: internal/mbz/search.go
- SearchRecording() method with Lucene query escaping
- Confidence filter: case-insensitive exact match on title + artist credit
- Release selection: prefer Official status, then first available
- Uses existing rate-limited queue (1 req/sec)

Integration in catalog.go:
- Only triggers when RecordingMbzID, ReleaseMbzID, AND ReleaseTitle are
  all missing — no impact on scrobbles that already have MBZ data
- Soft failure — search errors don't block the listen
- KOITO_DISABLE_MUSICBRAINZ handled automatically (MbzErrorCaller returns error)

Interface + mocks updated:
- SearchRecording added to MusicBrainzCaller interface
- MbzMockCaller: SearchResults map for test data
- MbzErrorCaller: returns error (existing pattern)

New tests:
- TestSubmitListen_SearchByName — mock search, verify album+duration resolved
- TestSubmitListen_SearchByNameNoMatch — verify graceful fallback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 03:02:17 +05:30
..
artist.go feat: v0.0.8 2025-06-16 21:55:39 -04:00
mbz.go Add MusicBrainz search-by-name enrichment for scrobbles without IDs 2026-03-27 03:02:17 +05:30
mock.go Add MusicBrainz search-by-name enrichment for scrobbles without IDs 2026-03-27 03:02:17 +05:30
release.go feat: v0.0.8 2025-06-16 21:55:39 -04:00
search.go Add MusicBrainz search-by-name enrichment for scrobbles without IDs 2026-03-27 03:02:17 +05:30
track.go Pre-release version v0.0.13 (#52) 2025-07-26 15:57:46 -04:00