better
This commit is contained in:
parent
7bfb38e16c
commit
77383f0178
2 changed files with 17 additions and 3 deletions
|
|
@ -169,3 +169,15 @@ class MusicMatchingEngine:
|
|||
confidence=best_confidence,
|
||||
match_type=best_match_type
|
||||
)
|
||||
|
||||
def generate_download_query(self, spotify_track: SpotifyTrack) -> str:
|
||||
"""Generate optimized search query for downloading tracks"""
|
||||
# Use artist + track name for more precise matching
|
||||
if spotify_track.artists:
|
||||
# Use first artist and clean track name
|
||||
artist = self.clean_artist(spotify_track.artists[0])
|
||||
track = self.clean_title(spotify_track.name)
|
||||
return f"{artist} {track}".strip()
|
||||
else:
|
||||
# Fallback to just track name if no artist
|
||||
return self.clean_title(spotify_track.name)
|
||||
|
|
|
|||
|
|
@ -267,14 +267,16 @@ class TrackDownloadWorker(QRunnable):
|
|||
if self._cancelled or not self.soulseek_client:
|
||||
return
|
||||
|
||||
# Create search queries - try track name first, then artist + track
|
||||
# Create search queries - prioritize artist + track for better accuracy
|
||||
track_name = self.spotify_track.name
|
||||
artist_name = self.spotify_track.artists[0] if self.spotify_track.artists else ""
|
||||
|
||||
search_queries = []
|
||||
search_queries.append(track_name) # Try track name only first
|
||||
# Try artist + track first (more specific, less false matches)
|
||||
if artist_name:
|
||||
search_queries.append(f"{artist_name} {track_name}") # Then artist + track
|
||||
search_queries.append(f"{artist_name} {track_name}")
|
||||
# Fallback to track name only if artist search fails
|
||||
search_queries.append(track_name)
|
||||
|
||||
download_id = None
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue