fix(listenbrainz): similarity hits Labs API, not the 404'ing main API
Root cause of zero LB recommendations (every similar-recordings AND
similar-artists call returned HTTP 404, worker logs):
- Wrong host/path: client called
api.listenbrainz.org/1/explore/similar-{recordings,artists}/{mbid}.
/explore/... is a WEBSITE route, not an API endpoint — it 308s then
404s. Similarity datasets live on the separate Labs API.
- Invalid algorithm: the hardcoded
session_…_session_30_…_limit_100_filter_True_… is not a permitted
Labs enum member (400s) regardless of host.
Verified against the live Labs API:
GET labs.api.listenbrainz.org/similar-recordings/json
?recording_mbids=<mbid>&algorithm=<algo>
GET labs.api.listenbrainz.org/similar-artists/json
?artist_mbids=<mbid>&algorithm=<algo>
algorithm=session_based_days_9000_session_300_contribution_5_threshold_15_limit_50_skip_30
→ 200 for both. Response field names (recording_mbid/artist_mbid/
name/score) already match the existing structs — parsing unchanged.
- Add defaultLabsBaseURL + Client.LabsBaseURL (separate from the main
BaseURL; scrobble submission still uses api.listenbrainz.org).
- Drop the count/limit query param — result size is encoded in the
algorithm name (limit_50); caller still applies its own top-K.
- Tests: newTestClient sets LabsBaseURL; the two *_LimitParamSet tests
become *_MbidParamSet (assert the Labs path + mbid query param).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,8 +29,9 @@ func extractMBIDs(m tag.Metadata) (albumMBID, artistMBID string) {
|
||||
|
||||
// extractRecordingMBID reads the MusicBrainz *recording* ID — Picard's
|
||||
// musicbrainz_recordingid, surfaced by dhowden/tag as mbz.Recording
|
||||
// (tag display name "MusicBrainz Track Id"). This is the id ListenBrainz
|
||||
// /explore/similar-recordings keys on and what tracks.mbid stores.
|
||||
// (tag display name "MusicBrainz Track Id"). This is the id the
|
||||
// ListenBrainz Labs similar-recordings API keys on and what tracks.mbid
|
||||
// stores.
|
||||
//
|
||||
// Deliberately NOT mbz.Track ("MusicBrainz Release Track Id"): that is
|
||||
// per-release-track, whereas similarity is per-recording. Kept separate
|
||||
|
||||
Reference in New Issue
Block a user