From 43f168a04888fb78b7b5153cad102382847b3c46 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sun, 10 May 2026 16:02:52 -0700 Subject: [PATCH] Add artists.aliases column for cross-script artist matching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- database/music_database.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/database/music_database.py b/database/music_database.py index 857d16b0..e6a1c35a 100644 --- a/database/music_database.py +++ b/database/music_database.py @@ -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")