jdotjdot / BashWeather

A Bash script to add regularly updated localized weather icons to your bash prompt
MIT License
10 stars 4 forks source link

No WEATHERCHAR for haze/mist #5

Open maheshjag opened 9 years ago

maheshjag commented 9 years ago

No matter what city I try, I can't seem to get WEATHERCHAR set to anything other than the default. For reference, the response for "London,UK" today is:

{"coord":{"lon":-0.13,"lat":51.51},"sys":{"type":1,"id":5091,"message":0.5896,"country":"GB","sunrise":1417160409,"sunset":1417190223},"weather":[{"id":721,"main":"Haze","description":"haze","icon":"50d"}],"base":"cmc stations","main":{"temp":284.35,"pressure":1003,"humidity":81,"temp_min":283.15,"temp_max":285.15},"wind":{"speed":5.7,"deg":80},"clouds":{"all":0},"dt":1417190071,"id":2643743,"name":"London","cod":200}

I tried debugging a bit, but gave up after I realised that I don't know quite how you interpret the OpenWeatherMap API responses (and I don't have the inclination to read it now :-) )

jdotjdot commented 9 years ago

The important part of the response is this, with the weather IDs: image

BashWeather uses the weather ID codes to decide what icon to return.

It looks like BashWeather is properly receiving the API response, but the issue here is actually that I have no unicode icon yet for the 700-range of OpenWeatherMap condition identifiers (atmospheric), so the default is returned.

If you suggest a good unicode icon, I'd be happy to add it, or you could submit a pull request. The icons are specified on lines 11-22, and then you would include the check for if the response code starts with 700 in the rather ugly if-statement on lines 180-187.

maheshjag commented 9 years ago

Okay, sounds good to me. Will come up with something in the next week or two and get back to you.

Thanks for looking into this.

On Sat, 29 Nov 2014 14:37 J.J. notifications@github.com wrote:

The important part of the response is this, with the weather IDs: [image: image] https://cloud.githubusercontent.com/assets/1328961/5234033/9435fc3c-777c-11e4-9ff8-1918754164bf.png

BashWeather uses the weather ID codes to decide what icon to return.

It looks like BashWeather is properly receiving the API response, but the issue here is actually that I have no unicode icon yet for the 700-range http://openweathermap.org/weather-conditions#Atmosphere of OpenWeatherMap condition identifiers (atmospheric), so the default is returned.

If you suggest a good unicode icon, I'd be happy to add it, or you could submit a pull request. The icons are specified on lines 11-22 https://github.com/jdotjdot/BashWeather/blob/master/BashWeather.sh#L11-22, and then you would include the check for if the response code starts with 700 in the rather ugly if-statement on lines 180-187 https://github.com/jdotjdot/BashWeather/blob/master/BashWeather.sh#L180-187 .

— Reply to this email directly or view it on GitHub https://github.com/jdotjdot/BashWeather/issues/5#issuecomment-64945955.