From 34e7e0e28b05095193d672b45d79d0ded38bb8f4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 27 Jan 2025 13:10:19 +0300 Subject: =?UTF-8?q?fixes=20#4847=20(Weather:=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4=D0=B8=D1=82=D1=8C=20=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20=D1=81=D0=BA?= =?UTF-8?q?=D0=BB=D0=B5=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=D0=BC)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Weather/src/weather_update.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'protocols/Weather/src/weather_update.cpp') diff --git a/protocols/Weather/src/weather_update.cpp b/protocols/Weather/src/weather_update.cpp index a03e0aeeca..2af9dc3cc8 100644 --- a/protocols/Weather/src/weather_update.cpp +++ b/protocols/Weather/src/weather_update.cpp @@ -360,9 +360,26 @@ static wchar_t *moon2str(double phase) return TranslateT("Waning crescent"); } +static CMStringW parseConditions(const CMStringW &str) +{ + CMStringW ret; + int iStart = 0; + while (true) { + auto substr = str.Tokenize(L",", iStart); + if (substr.IsEmpty()) + break; + + substr.Trim(); + if (!ret.IsEmpty()) + ret += ", "; + ret += TranslateW(substr); + } + return ret; +} + static void getData(OBJLIST &arValues, const JSONNode &node) { - arValues.insert(new WIDATAITEM(LPGENW("Condition"), L"", node["conditions"].as_mstring())); + arValues.insert(new WIDATAITEM(LPGENW("Condition"), L"", parseConditions(node["conditions"].as_mstring()))); arValues.insert(new WIDATAITEM(LPGENW("Temperature"), L"C", node["temp"].as_mstring())); arValues.insert(new WIDATAITEM(LPGENW("High"), L"C", node["tempmax"].as_mstring())); arValues.insert(new WIDATAITEM(LPGENW("Low"), L"C", node["tempmin"].as_mstring())); -- cgit v1.2.3