Merge f2fffcedce
into f349a2686c
This commit is contained in:
commit
ae197814fa
2 changed files with 23 additions and 11 deletions
|
@ -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
|
||||
|
@ -123,7 +123,7 @@ def vtuner_redirect(url):
|
|||
def upstream(path):
|
||||
if request.args.get('token') == '0':
|
||||
return vtuner.get_init_token()
|
||||
if request.args.get('search'):
|
||||
if request.args.get('search') or request.args.get('Search'):
|
||||
return station_search()
|
||||
if 'statxml.asp' in path and request.args.get('id'):
|
||||
return get_station_info()
|
||||
|
@ -238,15 +238,20 @@ def radiobrowser_popular():
|
|||
methods=['GET', 'POST'])
|
||||
def station_search():
|
||||
query = request.args.get('search')
|
||||
if not query:
|
||||
query = request.args.get('Search')
|
||||
if not query or len(query) < 3:
|
||||
page = vtuner.Page()
|
||||
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,
|
||||
|
|
|
@ -131,14 +131,21 @@ class Station:
|
|||
ET.SubElement(item, 'StationName').text = self.name
|
||||
if self.trackurl:
|
||||
ET.SubElement(item, 'StationUrl').text = self.trackurl
|
||||
else:
|
||||
elif self.url:
|
||||
ET.SubElement(item, 'StationUrl').text = self.url
|
||||
ET.SubElement(item, 'StationDesc').text = self.description
|
||||
ET.SubElement(item, 'Logo').text = self.icon
|
||||
ET.SubElement(item, 'StationFormat').text = self.genre
|
||||
ET.SubElement(item, 'StationLocation').text = self.location
|
||||
ET.SubElement(item, 'StationBandWidth').text = str(self.bitrate)
|
||||
ET.SubElement(item, 'StationMime').text = self.mime
|
||||
if self.description:
|
||||
ET.SubElement(item, 'StationDesc').text = self.description
|
||||
if self.icon:
|
||||
ET.SubElement(item, 'Logo').text = self.icon
|
||||
if self.genre:
|
||||
ET.SubElement(item, 'StationFormat').text = self.genre
|
||||
if self.location:
|
||||
ET.SubElement(item, 'StationLocation').text = self.location
|
||||
if self.bitrate:
|
||||
ET.SubElement(item, 'StationBandWidth').text = str(self.bitrate)
|
||||
if self.mime:
|
||||
ET.SubElement(item, 'StationMime').text = self.mime
|
||||
ET.SubElement(item, 'Relia').text = '3'
|
||||
ET.SubElement(item, 'Bookmark').text = self.bookmark
|
||||
if self.bookmark:
|
||||
ET.SubElement(item, 'Bookmark').text = self.bookmark
|
||||
return item
|
||||
|
|
Loading…
Add table
Reference in a new issue