diff --git a/ycast/server.py b/ycast/server.py index 316ef77..12e35f5 100644 --- a/ycast/server.py +++ b/ycast/server.py @@ -105,7 +105,7 @@ def get_station_by_id(stationid, additional_info=False): return my_stations.get_station_by_id(generic.get_stationid_without_prefix(stationid)) elif station_id_prefix == radiobrowser.ID_PREFIX: station = radiobrowser.get_station_by_id(generic.get_stationid_without_prefix(stationid)) - if additional_info: + if station and additional_info: station.get_playable_url() return station return None @@ -245,10 +245,13 @@ def station_search(): page.add(vtuner.Display("Search query too short")) page.set_count(1) return page.to_string() + station = get_station_by_id(query, additional_info=(not station_tracking)) + if station: + stations = [station] else: # TODO: we also need to include 'my station' elements stations = radiobrowser.search(query) - return get_stations_page(stations, request).to_string() + return get_stations_page(stations, request).to_string() @app.route('/' + PATH_ROOT + '/' + PATH_PLAY,