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:
@@ -1,9 +1,9 @@
|
||||
// Package similarity owns the inbound ListenBrainz similarity ingest
|
||||
// pipeline. A periodic worker queries LB's /explore/similar-recordings
|
||||
// and /explore/similar-artists endpoints for tracks the user has played,
|
||||
// filters returned MBIDs to the local library, and stores the top-K
|
||||
// edges in track_similarity / artist_similarity for M4c's radio
|
||||
// candidate-pool builder.
|
||||
// pipeline. A periodic worker queries the LB Labs API
|
||||
// (labs.api.listenbrainz.org similar-recordings / similar-artists) for
|
||||
// tracks the user has played, filters returned MBIDs to the local
|
||||
// library, and stores the top-K edges in track_similarity /
|
||||
// artist_similarity for M4c's radio candidate-pool builder.
|
||||
package similarity
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user