dhrone / pydPiper

A general purpose program to display song metadata on LCD and OLED devices
MIT License
78 stars 36 forks source link

Weather response language #58

Closed elpaul closed 5 years ago

elpaul commented 5 years ago

accuweather.com allows you to set the response in a specific language: example: http://api.accuweather.com/currentconditions/v1/335315.json?apikey={your key}&language=es&details=true Where and how to put it in the code?

dhrone commented 5 years ago

The lines you'd need to play with are at 353 and 354 of pydPiper.py.

elpaul commented 5 years ago

querystr = 'http://dataservice.accuweather.com/forecasts/v1/daily/1day/' + pydPiper_config.WEATHER_LOCATION r = requests.get(querystr, { 'apikey': pydPiper_config.WEATHER_API, }, language=pl)

It's will be correct?

dhrone commented 5 years ago

Close. It's probably more like...

querystr = 'http://dataservice.accuweather.com/forecasts/v1/daily/1day/' + pydPiper_config.WEATHER_LOCATION
r = requests.get(querystr, { 'apikey': pydPiper_config.WEATHER_API, language=es-es })

You'll want to look up the appropriate localization code from https://developer.accuweather.com/localizations-by-language. In this example I've used Spain.

elpaul commented 5 years ago

Unfortunately, after adding this parameter, the display is permanently dark, But I solved it in a different way

querystr = 'http://dataservice.accuweather.com/forecasts/v1/daily/1day/2xxx5.json?apikey=xxxxxxxxxxxxxxxxxxxxxxxxxyz&language=pl' r = requests.get(querystr)

Can weather information be displayed not from daily forecast, but from current condition? BTW, what do you think about adding "openweathermap"? 60 calls per minute in free program.