diff --git a/README.md b/README.md index 10d8683..159e744 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,7 @@ To specify your own custom output format, use the special `%`-notation: m Moonphase 🌑🌒🌓🌔🌕🌖🌗🌘, M Moonday, p precipitation (mm), + o Probability of Precipitation, P pressure (hPa), ``` diff --git a/lib/wttr_line.py b/lib/wttr_line.py index 5ede450..48fb6a1 100644 --- a/lib/wttr_line.py +++ b/lib/wttr_line.py @@ -101,6 +101,16 @@ def render_precipitation(data, query): answer += 'mm' return answer +def render_precipitation_chance(data, query): + """ + precipitation chance (o) + """ + + answer = data.get('chanceofrain', '') + if answer: + answer += '%' + return answer + def render_pressure(data, query): """ pressure (P) @@ -189,6 +199,7 @@ FORMAT_SYMBOL = { 'M': render_moonday, 's': render_sunset, 'p': render_precipitation, + 'o': render_precipitation_chance, 'P': render_pressure, }