aboutsummaryrefslogtreecommitdiff
path: root/widgets/weather.lua
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2010-04-02 01:08:12 +0200
committerAdrian C. (anrxc) <anrxc@sysphere.org>2010-04-02 01:08:12 +0200
commit448275a3865d1db82a6fc37d60548da8b865e5e0 (patch)
treeed0b9134b26d2002ec289210fb0915f41b26d59f /widgets/weather.lua
parenta9347ec0d033aa08d77fcc75c35d88514f9e84f5 (diff)
downloadvicious-legacy-448275a3865d1db82a6fc37d60548da8b865e5e0.tar.xz
widgets: reuse existing datasets where appropriate
Gmail, mbox, raid, weather and wifi could return the old value in case there isn't new data, no need for N/A to be so common on our wibox.
Diffstat (limited to 'widgets/weather.lua')
-rw-r--r--widgets/weather.lua28
1 files changed, 14 insertions, 14 deletions
diff --git a/widgets/weather.lua b/widgets/weather.lua
index 7a114c0..f54fbc3 100644
--- a/widgets/weather.lua
+++ b/widgets/weather.lua
@@ -17,24 +17,24 @@ local helpers = require("vicious.helpers")
module("vicious.widgets.weather")
+-- Initialize function tables
+local weather = {
+ ["{city}"] = "N/A",
+ ["{wind}"] = "N/A",
+ ["{windmph}"] = "N/A",
+ ["{windkmh}"] = "N/A",
+ ["{sky}"] = "N/A",
+ ["{weather}"] = "N/A",
+ ["{tempf}"] = "N/A",
+ ["{tempc}"] = "N/A",
+ ["{humid}"] = "N/A",
+ ["{press}"] = "N/A"
+}
+
-- {{{ Weather widget type
local function worker(format, warg)
if not warg then return end
- -- Default values
- local weather = {
- ["{city}"] = "N/A",
- ["{wind}"] = "N/A",
- ["{windmph}"] = "N/A",
- ["{windkmh}"] = "N/A",
- ["{sky}"] = "N/A",
- ["{weather}"] = "N/A",
- ["{tempf}"] = "N/A",
- ["{tempc}"] = "N/A",
- ["{humid}"] = "N/A",
- ["{press}"] = "N/A"
- }
-
-- Get weather forceast by the station ICAO code, from:
-- * US National Oceanic and Atmospheric Administration
local noaa = "http://weather.noaa.gov/pub/data/observations/metar/decoded/"