From e5457c0214c9a64caf92a85764d5d1c280897307 Mon Sep 17 00:00:00 2001 From: Broque Thomas Date: Tue, 6 Jan 2026 07:10:04 -0800 Subject: [PATCH] Improve title normalization in discography merge Updated the normalize_title function to remove unicode accents using NFD normalization and filtering non-spacing marks. This enhances title comparison by handling accented characters more robustly. --- web_server.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web_server.py b/web_server.py index 30095d9c..de510f78 100644 --- a/web_server.py +++ b/web_server.py @@ -22373,7 +22373,15 @@ def merge_discography_data(owned_releases, spotify_discography): def normalize_title(title): """Normalize title for comparison""" import re - normalized = title.lower().strip() + import unicodedata + + # Normalize unicode characters to decomposed form (NFD) + normalized = unicodedata.normalize('NFD', title) + # Filter out non-spacing mark characters (accents) + normalized = "".join(c for c in normalized if unicodedata.category(c) != 'Mn') + + # Standard normalization + normalized = normalized.lower().strip() normalized = re.sub(r'[^\w\s]', '', normalized) normalized = re.sub(r'\s+', ' ', normalized) return normalized.strip()