Edzelf / ESP32-Radio

Internet radio based on ESP32, VS1053 and a TFT screen.
GNU General Public License v3.0
990 stars 228 forks source link

search stations #489

Closed mirek76 closed 2 years ago

mirek76 commented 2 years ago

Hi Is it possible to search for stations only in a given country? I would like to search for stations in e.g. Germany What to change in file search_index.h? I would like to use country instead of genre

Edzelf commented 2 years ago

I think you only have to change search.html in the data directory. The API used is described at https://nl1.api.radio-browser.info.

mirek76 commented 2 years ago

Thank you for your answer. Is that the part of search_html.h?

// Get info from a radiobrowser. Working servers are: // https://de1.api.radio-browser.info, https://fr1.api.radio-browser.info, https://nl1.api.radio-browser.info function listStats ( genre ) { var theUrl = "https://nl1.api.radio-browser.info/json/stations/bytag/" + genre + "?hidebroken=true" ;

What is the format for a given country? Thx

Edzelf commented 2 years ago

Read the docs. Instead of "bytag", you have to use "bycountry". Examples in the docs, like: https://nl1.api.radio-browser.info/xml/stations/bycountry/austria

mirek76 commented 2 years ago

Thank you Edzelf Works great.

// Get info from a radiobrowser. Working servers are: // https://de1.api.radio-browser.info, https://fr1.api.radio-browser.info, https://nl1.api.radio-browser.info function listStats ( country ) { var theUrl = "https://nl1.api.radio-browser.info/json/stations/bycountry/" + country + "?hidebroken=true" ; var xhr = new XMLHttpRequest() ; xhr.onreadystatechange = function()

It would be nice to add a double search in search_html.h According to genre and country.