Fixed regression in search

This commit is contained in:
Eric van Blokland
2021-09-08 18:20:12 +02:00
parent 63da37c012
commit 76161adfdb
3 changed files with 16 additions and 4 deletions

View File

@@ -293,7 +293,7 @@ class RadioNetClient(object):
)
return self.set_cache(cache_key, favorite_stations, 1440)
def do_search(self, query_string, page_index=1, search_results=[]):
def do_search(self, query_string, page_index=1, search_results=None):
api_suffix = "/search/stationsonly"
url_params = {
@@ -308,6 +308,8 @@ class RadioNetClient(object):
logger.error("Radio.net: Search error " + response.text)
else:
logger.debug("Radio.net: Done search")
if search_results is None:
search_results = []
json = response.json()
for match in json["categories"][0]["matches"]:
station = self.get_station_by_id(match["id"])