Add artists.aliases column for cross-script artist matching

Foundation commit for issue #442 — Japanese kanji ↔ romanized name
quarantines and equivalent cross-script mismatches. MusicBrainz
exposes alternate-spelling aliases on every artist record but
SoulSync's matching never consulted them; cross-script comparison
scored 0% on raw similarity and the file got quarantined even when
MusicBrainz knew both names belonged to the same artist.

This commit only adds the column. Subsequent commits in this PR:
- Build a pure alias-aware artist comparison helper
- Wire the MusicBrainz worker to populate aliases on enrichment
- Add a live MB lookup with cache for un-enriched artists
- Wire the helper into the AcoustID verifier where the quarantine
  decision actually fires

Schema change is additive (NULL default), gated by the same
`PRAGMA table_info` check the existing `_add_musicbrainz_columns`
helper uses, so re-running on databases that already have the
column is a no-op.

Verified:
- New `artists.aliases` column present in fresh DB init
- JSON round-trip works (mirrors the existing `genres` column pattern)
- No existing tests broken
This commit is contained in:
Broque Thomas 2026-05-10 16:02:52 -07:00
parent 03533454bc
commit 43f168a048

View file

@ -1792,6 +1792,17 @@ class MusicDatabase:
if 'musicbrainz_match_status' not in artists_columns:
cursor.execute("ALTER TABLE artists ADD COLUMN musicbrainz_match_status TEXT")
columns_added = True
# MusicBrainz exposes alternate-spelling aliases on every artist
# record (Japanese kanji ↔ romanized, Cyrillic ↔ Latin, etc.).
# SoulSync's artist matching used to compare expected vs actual
# name with raw similarity — cross-script comparison scored 0%
# and the file got quarantined even when MusicBrainz knew both
# names belonged to the same artist (issue #442). Persist the
# alias list as JSON so the verifier + matcher can consult it
# without re-querying MB on every comparison.
if 'aliases' not in artists_columns:
cursor.execute("ALTER TABLE artists ADD COLUMN aliases TEXT")
columns_added = True
if columns_added:
logger.info("Added MusicBrainz columns to artists table")