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, l Location,
m Moonphase 🌑🌒🌓🌔🌕🌖🌗🌘, m Moonphase 🌑🌒🌓🌔🌕🌖🌗🌘,
M Moonday, M Moonday,
p precipitation (mm),
P pressure (hPa),
``` ```
So, these two calls are the same: So, these two calls are the same:

View file

@ -89,6 +89,26 @@ def render_humidity(data, query):
humidity += '%' humidity += '%'
return 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): def render_wind(data, query):
""" """
wind (w) wind (w)
@ -166,6 +186,8 @@ FORMAT_SYMBOL = {
'm': render_moonphase, 'm': render_moonphase,
'M': render_moonday, 'M': render_moonday,
's': render_sunset, 's': render_sunset,
'p': render_precipitation,
'P': render_pressure,
} }
def render_line(line, data, query): def render_line(line, data, query):