pressure (P) and precipitation (p) (fixes #293)

This commit is contained in:
Igor Chubin 2019-04-23 17:31:46 +02:00
parent 83b1fd45f2
commit 9a72e04ec7
2 changed files with 24 additions and 0 deletions

View File

@ -149,6 +149,8 @@ To specify your own custom output format, use the special `%`-notation:
l Location,
m Moonphase 🌑🌒🌓🌔🌕🌖🌗🌘,
M Moonday,
p precipitation (mm),
P pressure (hPa),
```
So, these two calls are the same:

View File

@ -89,6 +89,26 @@ def render_humidity(data, query):
humidity += '%'
return humidity
def render_precipitation(data, query):
"""
precipitation (p)
"""
answer = data.get('precipMM', '')
if answer:
answer += 'mm'
return answer
def render_pressure(data, query):
"""
pressure (P)
"""
answer = data.get('pressure', '')
if answer:
answer += 'hPa'
return answer
def render_wind(data, query):
"""
wind (w)
@ -166,6 +186,8 @@ FORMAT_SYMBOL = {
'm': render_moonphase,
'M': render_moonday,
's': render_sunset,
'p': render_precipitation,
'P': render_pressure,
}
def render_line(line, data, query):