diff --git a/core/__pycache__/matching_engine.cpython-312.pyc b/core/__pycache__/matching_engine.cpython-312.pyc index 02ae65c6..9658a687 100644 Binary files a/core/__pycache__/matching_engine.cpython-312.pyc and b/core/__pycache__/matching_engine.cpython-312.pyc differ diff --git a/core/matching_engine.py b/core/matching_engine.py index 76fb95f3..1f8d9301 100644 --- a/core/matching_engine.py +++ b/core/matching_engine.py @@ -53,7 +53,14 @@ class MusicMatchingEngine: if not text: return "" # Handle Korn/KoЯn variations - both uppercase Я (U+042F) and lowercase я (U+044F) - text = re.sub(r'ko[яЯ]n', 'korn', text, flags=re.IGNORECASE) + char_map = { + 'Я': 'R', # Cyrillic 'Ya' to 'R' + 'я': 'r', # Lowercase Cyrillic 'ya' to 'r' + } + + # Apply the character replacements before other normalization steps + for original, replacement in char_map.items(): + text = text.replace(original, replacement) text = unidecode(text) text = text.lower() diff --git a/database/__pycache__/music_database.cpython-310.pyc b/database/__pycache__/music_database.cpython-310.pyc index 4d19f993..5a53c269 100644 Binary files a/database/__pycache__/music_database.cpython-310.pyc and b/database/__pycache__/music_database.cpython-310.pyc differ diff --git a/database/__pycache__/music_database.cpython-312.pyc b/database/__pycache__/music_database.cpython-312.pyc index 2c391fc7..90d25213 100644 Binary files a/database/__pycache__/music_database.cpython-312.pyc and b/database/__pycache__/music_database.cpython-312.pyc differ diff --git a/database/music_database.py b/database/music_database.py index 1866ffd9..f799b879 100644 --- a/database/music_database.py +++ b/database/music_database.py @@ -874,6 +874,24 @@ class MusicDatabase: except Exception as e: logger.error(f"Error searching albums with title='{title}', artist='{artist}': {e}") return [] + + + + def _get_artist_variations(self, artist_name: str) -> List[str]: + """Returns a list of known variations for an artist's name.""" + variations = [artist_name] + name_lower = artist_name.lower() + + # Add more aliases here in the future + if "korn" in name_lower: + if "KoЯn" not in variations: + variations.append("KoЯn") + if "Korn" not in variations: + variations.append("Korn") + + # Return unique variations + return list(set(variations)) + def check_track_exists(self, title: str, artist: str, confidence_threshold: float = 0.8) -> Tuple[Optional[DatabaseTrack], float]: """ @@ -895,7 +913,10 @@ class MusicDatabase: # Try each title variation for title_variation in title_variations: # Search for potential matches with this variation - potential_matches = self.search_tracks(title=title_variation, artist=artist, limit=20) + potential_matches = [] + artist_variations = self._get_artist_variations(artist) + for artist_variation in artist_variations: + potential_matches.extend(self.search_tracks(title=title_variation, artist=artist_variation, limit=20)) if not potential_matches: continue diff --git a/ui/pages/__pycache__/artists.cpython-312.pyc b/ui/pages/__pycache__/artists.cpython-312.pyc index 3ecfe81d..ad4b43a0 100644 Binary files a/ui/pages/__pycache__/artists.cpython-312.pyc and b/ui/pages/__pycache__/artists.cpython-312.pyc differ diff --git a/ui/pages/artists.py b/ui/pages/artists.py index 2f5598ac..56b7bb12 100644 --- a/ui/pages/artists.py +++ b/ui/pages/artists.py @@ -732,7 +732,8 @@ class DatabaseLibraryWorker(QThread): # Try different artist combinations artists_to_try = spotify_album.artists[:2] if spotify_album.artists else [""] - + if "Korn" in artists_to_try: + artists_to_try.append("KoЯn") best_album = None best_confidence = 0.0 best_owned_tracks = 0