weather: fix parsing of negative temperatures

Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
This commit is contained in:
Martin Striz 2009-12-27 18:39:12 +01:00 committed by Adrian C. (anrxc)
parent 2100ea1d8c
commit fba4db6d37
1 changed files with 2 additions and 2 deletions

View File

@ -54,9 +54,9 @@ local function worker(format, station)
weather["{weather}"] = -- Weather conditions if available weather["{weather}"] = -- Weather conditions if available
string.match(ws, "Weather:[%s](.-)[%c]") or weather["{weather}"] string.match(ws, "Weather:[%s](.-)[%c]") or weather["{weather}"]
weather["{tempf}"] = -- Temperature in fahrenheit weather["{tempf}"] = -- Temperature in fahrenheit
string.match(ws, "Temperature:[%s]([%d%.]+).*[%c]") or weather["{tempf}"] string.match(ws, "Temperature:[%s]([%-]?[%d%.]+).*[%c]") or weather["{tempf}"]
weather["{tempc}"] = -- Temperature in celsius weather["{tempc}"] = -- Temperature in celsius
string.match(ws, "Temperature:[%s][%d%.]+[%s]F[%s]%(([%d%.]+)[%s]C%)[%c]") or weather["{tempc}"] string.match(ws, "Temperature:[%s][%d%.]+[%s]F[%s]%(([%-]?[%d%.]+)[%s]C%)[%c]") or weather["{tempc}"]
weather["{humid}"] = -- Relative humidity in percent weather["{humid}"] = -- Relative humidity in percent
string.match(ws, "Relative[%s]Humidity:[%s]([%d]+)%%") or weather["{humid}"] string.match(ws, "Relative[%s]Humidity:[%s]([%d]+)%%") or weather["{humid}"]
weather["{press}"] = -- Pressure in hPa weather["{press}"] = -- Pressure in hPa