KoЯn....
This commit is contained in:
parent
3bbb635848
commit
f4ac2b7d6e
7 changed files with 32 additions and 3 deletions
Binary file not shown.
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -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
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue