new option: C (Weather condition textual name)

pull/295/head
Igor Chubin 6 years ago
parent 5901e711f6
commit 83b1fd45f2

@ -142,6 +142,7 @@ To specify your own custom output format, use the special `%`-notation:
```
c Weather condition,
C Weather condition textual name,
h Humidity,
t Temperature,
w Wind,

@ -59,6 +59,26 @@ def render_condition(data, query):
weather_condition = WEATHER_SYMBOL[WWO_CODE[data['weatherCode']]]
return weather_condition
def render_condition_fullname(data, query):
"""
condition_fullname (C)
"""
found = None
for key, val in data.items():
if key.startswith('lang_'):
found = val
break
if not found:
found = data['weatherDesc']
try:
weather_condition = found[0]['value']
except KeyError:
weather_condition = ''
return weather_condition
def render_humidity(data, query):
"""
humidity (h)
@ -138,6 +158,7 @@ def render_sunset(data, query):
FORMAT_SYMBOL = {
'c': render_condition,
'C': render_condition_fullname,
'h': render_humidity,
't': render_temperature,
'w': render_wind,

Loading…
Cancel
Save