Fix _handle_response reauth bug and empty str query construction

This commit is contained in:
Rahul Ahuja 2019-01-22 12:14:52 -08:00
parent 7b57b0b608
commit f7d20090e6

View file

@ -120,7 +120,7 @@ class SpotifyPlugin(BeetsPlugin):
'Spotify access token has expired. Reauthenticating.'
)
self._authenticate()
self._handle_response(request_type, url, params=params)
return self._handle_response(request_type, url, params=params)
else:
raise ui.UserError(u'Spotify API error:\n{}', response.text)
return response.json()
@ -374,12 +374,11 @@ class SpotifyPlugin(BeetsPlugin):
:return: Query string to be provided to the Search API.
:rtype: str
"""
query_string = keywords
if filters is not None:
query_string += ' ' + ' '.join(
':'.join((k, v)) for k, v in filters.items()
)
return query_string
query_components = [
keywords,
' '.join(':'.join((k, v)) for k, v in filters.items()),
]
return ' '.join([s for s in query_components if s])
def _search_spotify(self, query_type, filters=None, keywords=''):
"""Query the Spotify Search API for the specified ``keywords``, applying