Skip to content

Commit

Permalink
Merge branch 'firerogue-patch-2'
Browse files Browse the repository at this point in the history
Long overdue.
  • Loading branch information
Elad Alfassa committed Nov 24, 2014
2 parents bb352a1 + 07e97b3 commit ded07e0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ def get_temp(parsed):
return (u'%d\u00B0C (%d\u00B0F)' % (temp, f))


def get_pressure(parsed):
def get_humidity(parsed):
try:
pressure = parsed['feed']['yweather_atmosphere']['pressure']
millibar = float(pressure)
inches = int(millibar / 33.7685)
humidity = parsed['feed']['yweather_atmosphere']['humidity']
except (KeyError, ValueError):
return 'unknown'
return ('%din (%dmb)' % (inches, int(millibar)))
return "Humidity: %s%%" % humidity


def get_wind(parsed):
Expand Down Expand Up @@ -158,9 +156,9 @@ def weather(bot, trigger):

cover = get_cover(parsed)
temp = get_temp(parsed)
pressure = get_pressure(parsed)
humidity = get_humidity(parsed)
wind = get_wind(parsed)
bot.say(u'%s: %s, %s, %s, %s' % (location, cover, temp, pressure, wind))
bot.say(u'%s: %s, %s, %s, %s' % (location, cover, temp, humidity, wind))


@commands('setlocation', 'setwoeid')
Expand Down

0 comments on commit ded07e0

Please sign in to comment.