sfuhrm/radiobrowser4j

The value returned by radioBrowser.listCountries() is not easy to use

Closed this issue · 2 comments

This is the format returned by this API "key = value"
Papua New Guinea = 1
Cambodia = 2
Paraguay = 50
Kazakhstan = 51

But most of your APIs require ISO 3166-1 country code.
For example:
China -> CN
List stations = rb.listStationsBy(Paging.at(0, 10), SearchMode.BYCOUNTRYCODEEXACT, "CN");

After checking, the official should provide the ISO 3166-1 country code directly.
https://de1.api.radio-browser.info/#List_of_countries

Thanks for the issue. The HTTP-API changed a bit, all plaintext country fields are deprecated and replaced by countrycode which is ISO 3166-1. I didn't check the library according to this change, especially the listCountries() call.

Thinking about your issue, I see the improvement to add another call called listCountryCodes() which would suit to the new nomenclature of the HTTP API, and deprecate the listCountries() call.

Fixed in master according to the description above.