Added wind speed in km/h to the weather widget.
This commit is contained in:
parent
f841c540d4
commit
1630b786d4
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
-- {{{ Grab environment
|
-- {{{ Grab environment
|
||||||
local io = { popen = io.popen }
|
local io = { popen = io.popen }
|
||||||
|
local math = { floor = math.floor }
|
||||||
local string = { match = string.match }
|
local string = { match = string.match }
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ function worker(format, station)
|
||||||
["{city}"] = "N/A",
|
["{city}"] = "N/A",
|
||||||
["{wind}"] = "N/A",
|
["{wind}"] = "N/A",
|
||||||
["{windmph}"] = "N/A",
|
["{windmph}"] = "N/A",
|
||||||
|
["{windkmh}"] = "N/A",
|
||||||
["{sky}"] = "N/A",
|
["{sky}"] = "N/A",
|
||||||
["{weather}"] = "N/A",
|
["{weather}"] = "N/A",
|
||||||
["{tempf}"] = "N/A",
|
["{tempf}"] = "N/A",
|
||||||
|
@ -62,6 +64,10 @@ function worker(format, station)
|
||||||
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
|
||||||
string.match(ws, "Pressure[%s].+%((.+)[%s]hPa%)") or weather["{press}"]
|
string.match(ws, "Pressure[%s].+%((.+)[%s]hPa%)") or weather["{press}"]
|
||||||
|
weather["{windkmh}"] = -- Wind speed in KMH if MPH was available
|
||||||
|
if weather["{windmph}"] ~= "N/A" then
|
||||||
|
weather["{windkmh}"] = math.floor(weather["{windmph}"] * 1.6)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return weather
|
return weather
|
||||||
|
|
Loading…
Reference in New Issue