aboutsummaryrefslogtreecommitdiff
path: root/weather.lua
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2009-08-01 06:20:31 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2009-08-01 06:20:31 +0200
commit1630b786d4028a8075695c026391ee80cc9b9aca (patch)
treea5fef0c843e79f2e13c0c113d94ff06a79ee2b89 /weather.lua
parentf841c540d41507f37e907482fe467c3e0b3c285d (diff)
downloadvicious-legacy-1630b786d4028a8075695c026391ee80cc9b9aca.tar.xz
Added wind speed in km/h to the weather widget.
Diffstat (limited to 'weather.lua')
-rw-r--r--weather.lua6
1 files changed, 6 insertions, 0 deletions
diff --git a/weather.lua b/weather.lua
index b83538e..e14c0ed 100644
--- a/weather.lua
+++ b/weather.lua
@@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { popen = io.popen }
+local math = { floor = math.floor }
local string = { match = string.match }
-- }}}
@@ -32,6 +33,7 @@ function worker(format, station)
["{city}"] = "N/A",
["{wind}"] = "N/A",
["{windmph}"] = "N/A",
+ ["{windkmh}"] = "N/A",
["{sky}"] = "N/A",
["{weather}"] = "N/A",
["{tempf}"] = "N/A",
@@ -62,6 +64,10 @@ function worker(format, station)
string.match(ws, "Relative[%s]Humidity:[%s]([%d]+)%%") or weather["{humid}"]
weather["{press}"] = -- Pressure in hPa
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
return weather