Add ability to fetch single station element by hardcoded vTuner URL
Some AVRs fetch the station info by calling statxml.asp with the station ID parameter.
It seems like they expect a single station element in a vTuner compatible page.
This should not be confused with the streamurl acquisition proxying implemented in 7c3161aff9
.
This commit is contained in:
parent
70d5ff072b
commit
19e0ff8649
1 changed files with 19 additions and 0 deletions
|
@ -10,6 +10,7 @@ import ycast.generic as generic
|
|||
|
||||
PATH_ROOT = 'ycast'
|
||||
PATH_PLAY = 'play'
|
||||
PATH_STATION = 'station'
|
||||
PATH_SEARCH = 'search'
|
||||
PATH_MY_STATIONS = 'my_stations'
|
||||
PATH_RADIOBROWSER = 'radiobrowser'
|
||||
|
@ -101,6 +102,8 @@ def upstream(path):
|
|||
return vtuner.get_init_token()
|
||||
if request.args.get('search'):
|
||||
return station_search()
|
||||
if 'statxml.asp' in path and request.args.get('id'):
|
||||
return get_station_info()
|
||||
if 'loginXML.asp' in path:
|
||||
return redirect(url_for('landing', _external=True), code=302)
|
||||
logging.error("Unhandled upstream query (/setupapp/%s)", path)
|
||||
|
@ -219,3 +222,19 @@ def get_stream_url():
|
|||
abort(404)
|
||||
logging.debug("Station with ID '%s' requested", station.id)
|
||||
return redirect(station.url, code=302)
|
||||
|
||||
|
||||
@app.route('/' + PATH_ROOT + '/' + PATH_STATION)
|
||||
def get_station_info():
|
||||
stationid = request.args.get('id')
|
||||
if not stationid:
|
||||
logging.error("Station info without station ID requested")
|
||||
abort(400)
|
||||
station = get_station_by_id(stationid)
|
||||
if not station:
|
||||
logging.error("Could not get station with id '%s'", stationid)
|
||||
abort(404)
|
||||
page = vtuner.Page()
|
||||
page.add(station.to_vtuner())
|
||||
page.set_count(1)
|
||||
return page.to_string()
|
||||
|
|
Loading…
Reference in a new issue