fix(discover): drop suggestions for non-artists (no core discography)
ListenBrainz surfaces producers/session players/band members (Max Martin, Dominic Howard) that co-occur in listens but have no releases of their own — they showed as bare rows with an empty page. _derive_albums now drops a surfaced artist (deletes their pending suggestion) when their MB discography has no core release-group (Album/Single/EP, no secondary type), catching both empty discographies and soundtrack/production-only credits, while keeping real singles/EP-only artists. On browse failure the suggestion is kept. Test fake browser gains default_core so scoring tests keep surfacing candidates. worker 249 tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -204,6 +204,16 @@ def _derive_albums(conn: psycopg.Connection, browser: MbBrowser, surfaced: list[
|
||||
except Exception as e: # one artist's browse failure must not abort the sweep
|
||||
print(f"worker: discovery album browse failed for {artist['mbid']}: {e}", flush=True)
|
||||
continue
|
||||
# Drop suggestions for "artists" with no real discography of their own — producers,
|
||||
# session players, band members, soundtrack-only credits. ListenBrainz surfaces them
|
||||
# (they co-occur in listens) but they have no core release-group to follow or want, and
|
||||
# their page is empty. Require at least one core release (Album/Single/EP, no secondary
|
||||
# type); on browse failure we keep the suggestion rather than drop a real artist.
|
||||
if not any(is_core_release(g.primary_type, g.secondary_types) for g in groups):
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("DELETE FROM \"DiscoverySuggestion\" WHERE status = 'pending' "
|
||||
'AND "artistMbid" = %s', (artist["mbid"],))
|
||||
continue
|
||||
core = [g for g in groups
|
||||
if _album_kind_ok(g, cfg.albums_only) and g.rg_mbid not in have]
|
||||
core.sort(key=lambda g: g.first_release_date or "", reverse=True)
|
||||
|
||||
Reference in New Issue
Block a user