Koito/internal/catalog
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
..
associate_album.go fix: improve matching with identically named albums (#126) 2026-01-12 13:03:04 -05:00
associate_artists.go fix: do not update mbz id when one already exists (#123) 2026-01-11 01:39:41 -05:00
associate_track.go fix: ensure listen activity correctly sums listen activity in step (#139) 2026-01-14 21:35:01 -05:00
catalog.go Add MusicBrainz search-by-name enrichment for scrobbles without IDs 2026-03-27 03:02:17 +05:30
catalog_test.go Pre-release version v0.0.14 (#96) 2025-11-19 20:26:56 -05:00
duration.go fix: correctly cycle tracks in backfill (#138) 2026-01-14 12:46:17 -05:00
duration_test.go fix: correctly cycle tracks in backfill (#138) 2026-01-14 12:46:17 -05:00
images.go fix: improve subsonic image searching (#164) 2026-01-21 14:54:52 -05:00
images_test.go chore: static -> test_assets 2025-06-13 16:23:43 -04:00
submit_listen_test.go Add MusicBrainz search-by-name enrichment for scrobbles without IDs 2026-03-27 03:02:17 +05:30