fix incorrect matches when album is missing or empty

closes #5189
This commit is contained in:
Sebastian Mohr 2025-09-15 23:32:04 +02:00
parent c265bd7727
commit c7ba399dd1
3 changed files with 15 additions and 2 deletions

View file

@ -371,7 +371,9 @@ class SearchApiMetadataSourcePlugin(
album: str,
va_likely: bool,
) -> Iterable[AlbumInfo]:
query_filters: SearchFilter = {"album": album}
query_filters: SearchFilter = {}
if album:
query_filters["album"] = album
if not va_likely:
query_filters["artist"] = artist

View file

@ -569,7 +569,13 @@ class SpotifyPlugin(
query_string = item[self.config["track_field"].get()]
# Query the Web API for each track, look for the items' JSON data
query_filters: SearchFilter = {"artist": artist, "album": album}
query_filters: SearchFilter = {}
if artist:
query_filters["artist"] = artist
if album:
query_filters["album"] = album
response_data_tracks = self._search_api(
query_type="track",
query_string=query_string,

View file

@ -11,6 +11,11 @@ New features:
Bug fixes:
- :doc:`plugins/spotify` Fixed an issue where track matching and lookups could
return incorrect or misleading results when using the Spotify plugin. The
problem occurred primarily when no album was provided or when the album field
was an empty string. :bug:`5189`
For packagers:
Other changes: