Merge pull request #314 from examknow/weather-kelvin
weather.py: add kelvin unit
This commit is contained in:
commit
5c6a27cd25
1 changed files with 5 additions and 3 deletions
|
@ -69,6 +69,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
celsius = "%dC" % page["main"]["temp"]
|
celsius = "%dC" % page["main"]["temp"]
|
||||||
fahrenheit = "%dF" % ((page["main"]["temp"]*(9/5))+32)
|
fahrenheit = "%dF" % ((page["main"]["temp"]*(9/5))+32)
|
||||||
|
kelvin = "%dK" % ((page["main"]["temp"])+273.15)
|
||||||
description = page["weather"][0]["description"].title()
|
description = page["weather"][0]["description"].title()
|
||||||
humidity = "%s%%" % page["main"]["humidity"]
|
humidity = "%s%%" % page["main"]["humidity"]
|
||||||
|
|
||||||
|
@ -81,10 +82,11 @@ class Module(ModuleManager.BaseModule):
|
||||||
location_str = "(%s) %s" % (nickname, location_str)
|
location_str = "(%s) %s" % (nickname, location_str)
|
||||||
|
|
||||||
event["stdout"].write(
|
event["stdout"].write(
|
||||||
"%s | %s/%s | %s | Humidity: %s | Wind: %s (%s)" % (
|
"%s | %s/%s/%s | %s | Humidity: %s | Wind: %s/%s" % (
|
||||||
location_str, celsius, fahrenheit, description, humidity,
|
location_str, celsius, fahrenheit, kelvin, description,
|
||||||
wind_speed_k, wind_speed_m))
|
humidity, wind_speed_k, wind_speed_m))
|
||||||
else:
|
else:
|
||||||
event["stderr"].write("No weather information for this location")
|
event["stderr"].write("No weather information for this location")
|
||||||
else:
|
else:
|
||||||
raise utils.EventResultsError()
|
raise utils.EventResultsError()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue