From a0a0a094d3ead2c373669037159bfd93aab67272 Mon Sep 17 00:00:00 2001 From: pSpitzner Date: Sat, 27 Sep 2025 13:06:12 +0200 Subject: [PATCH 1/2] Changed query from double to single quotes. --- beets/metadata_plugins.py | 2 +- docs/changelog.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/beets/metadata_plugins.py b/beets/metadata_plugins.py index 0b8d81c95..56bf8124f 100644 --- a/beets/metadata_plugins.py +++ b/beets/metadata_plugins.py @@ -412,7 +412,7 @@ class SearchApiMetadataSourcePlugin( :return: Query string to be provided to the search API. """ - components = [query_string, *(f'{k}:"{v}"' for k, v in filters.items())] + components = [query_string, *(f"{k}:'{v}'" for k, v in filters.items())] query = " ".join(filter(None, components)) if self.config["search_query_ascii"].get(): diff --git a/docs/changelog.rst b/docs/changelog.rst index 092a1a5a0..ef7eb9ff8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -27,6 +27,8 @@ Bug fixes: matching. :bug:`5189` - :doc:`plugins/discogs` Fixed inconsistency in stripping disambiguation from artists but not labels. :bug:`5366` +- :doc:`plugins/spotify` Fixed an issue where candidate lookup would not find + matches due to query escaping (single vs double quotes). For packagers: From cc0024e089112863e2a8661de6a6e2b533b16964 Mon Sep 17 00:00:00 2001 From: pSpitzner Date: Sat, 27 Sep 2025 13:22:41 +0200 Subject: [PATCH 2/2] Spotify tests are now consistent with quote change --- test/plugins/test_spotify.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/plugins/test_spotify.py b/test/plugins/test_spotify.py index 86b5651b9..bc55485c6 100644 --- a/test/plugins/test_spotify.py +++ b/test/plugins/test_spotify.py @@ -82,8 +82,8 @@ class SpotifyPluginTest(PluginTestCase): params = _params(responses.calls[0].request.url) query = params["q"][0] assert "duifhjslkef" in query - assert 'artist:"ujydfsuihse"' in query - assert 'album:"lkajsdflakjsd"' in query + assert "artist:'ujydfsuihse'" in query + assert "album:'lkajsdflakjsd'" in query assert params["type"] == ["track"] @responses.activate @@ -117,8 +117,8 @@ class SpotifyPluginTest(PluginTestCase): params = _params(responses.calls[0].request.url) query = params["q"][0] assert "Happy" in query - assert 'artist:"Pharrell Williams"' in query - assert 'album:"Despicable Me 2"' in query + assert "artist:'Pharrell Williams'" in query + assert "album:'Despicable Me 2'" in query assert params["type"] == ["track"] @responses.activate @@ -233,8 +233,8 @@ class SpotifyPluginTest(PluginTestCase): params = _params(responses.calls[0].request.url) query = params["q"][0] assert item.title in query - assert f'artist:"{item.albumartist}"' in query - assert f'album:"{item.album}"' in query + assert f"artist:'{item.albumartist}'" in query + assert f"album:'{item.album}'" in query assert not query.isascii() # Is not found in the library if ascii encoding is enabled