sfuhrm / radiobrowser4j

RadioBrowser Java API library
Other
50 stars 8 forks source link

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

Closed ChildProdigy closed 2 months ago

ChildProdigy commented 3 months ago

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

sfuhrm commented 2 months ago

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.

sfuhrm commented 2 months ago

Fixed in master according to the description above.