From 3cbf7a934923cf0b58a420a53b954f5bc219c9e5 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sun, 5 Jun 2022 20:07:00 +0200 Subject: [PATCH] Add UV Index support (one-line format) --- README.md | 1 + lib/view/line.py | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index bae9fae..6723802 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,7 @@ To specify your own custom output format, use the special `%`-notation: M Moon day, p Precipitation (mm/3 hours), P Pressure (hPa), + u UV index (1-12), D Dawn*, S Sunrise*, diff --git a/lib/view/line.py b/lib/view/line.py index 7bc81ef..f657246 100644 --- a/lib/view/line.py +++ b/lib/view/line.py @@ -167,6 +167,14 @@ def render_pressure(data, query): answer += 'hPa' return answer +def render_uv_index(data, query): + """ + UV Index (u) + """ + + answer = data.get('uvIndex', '') + return answer + def render_wind(data, query): """ wind (w) @@ -284,6 +292,7 @@ FORMAT_SYMBOL = { 'p': render_precipitation, 'o': render_precipitation_chance, 'P': render_pressure, + "u": render_uv_index, } FORMAT_SYMBOL_ASTRO = {