soulsync/core/metadata
Broque Thomas c121582557 MusicBrainz genres: fall back to release then artist when recording is empty
User report: SoulSync was only pulling MusicBrainz genres from the
recording (track-level) endpoint. Most MB recordings don't carry genres
at the track level — they live on the release (album) or artist. So
the MB tier was contributing nothing to the genre merge for the
overwhelming majority of tracks.

Fix:
- Added `'genres'` to the release-detail `includes` (was missing).
- After release-detail processing, if pp['mb_genres'] is still empty,
  populate from release_detail['genres'] (sorted by count desc).
- If still empty AND artist_mbid is set, fetch artist with
  `includes=['genres']` and use those.

No extra API call when the recording (or release) already had genres —
the artist fetch only fires when both upstream tiers came back empty.

The downstream genre merge in _embed_metadata_genres is unchanged; this
just makes the MB feed into it richer.

Tests: 4 new (recording present, recording empty → release, recording
+ release empty → artist, all empty → []). Full suite 873 passing.
Ruff clean.

Reported by @kcaoyef421 in Discord.
2026-04-27 19:31:27 -07:00
..
__init__.py Move new metadata helpers into a package 2026-04-27 19:54:44 +03:00
artwork.py Move shared metadata helpers into package 2026-04-27 19:54:44 +03:00
common.py Tighten metadata and import safety 2026-04-27 20:28:05 +03:00
enrichment.py Split runtime builders into owning modules 2026-04-27 19:54:45 +03:00
lyrics.py Move shared metadata helpers into package 2026-04-27 19:54:44 +03:00
source.py MusicBrainz genres: fall back to release then artist when recording is empty 2026-04-27 19:31:27 -07:00