@@ -457,6 +457,16 @@ def _get_releases(self, query: str) -> Iterator[AlbumInfo]:
457457 # Strip medium information from query, Things like "CD1" and "disk 1"
458458 # can also negate an otherwise positive result.
459459 query = re .sub (r"\b(CD|disc)\s*\d+" , "" , query , flags = re .I )
460+
461+ # query may be empty strings
462+ # We want to skip the lookup in this case.
463+ if not query .strip ():
464+ self ._log .debug (
465+ "Empty search query after preprocessing, skipping {.data_source}." ,
466+ self ,
467+ )
468+ return
469+
460470 for beatport_release in self .client .search (query , "release" ):
461471 if beatport_release is None :
462472 continue
@@ -522,8 +532,18 @@ def _get_artist(self, artists):
522532 """
523533 return self .get_artist (artists = artists , id_key = 0 , name_key = 1 )
524534
525- def _get_tracks (self , query ):
535+ def _get_tracks (self , query : str ):
526536 """Returns a list of TrackInfo objects for a Beatport query."""
537+
538+ # query may be empty strings
539+ # We want to skip the lookup in this case.
540+ if not query .strip ():
541+ self ._log .debug (
542+ "Empty search query after preprocessing, skipping {.data_source}." ,
543+ self ,
544+ )
545+ return []
546+
527547 bp_tracks = self .client .search (query , release_type = "track" )
528548 tracks = [self ._get_track_info (x ) for x in bp_tracks ]
529549 return tracks
0 commit comments