Re: The old Brian Wolven weather script
"Jochen Ritzel" <[email protected]> Thu, 01 Oct 2009 16:01:51 +0200
| Newsgroups | gmane.comp.windows.shells.litestep |
|---|---|
| Message-ID | <op.u04jxdififobub@w00t> |
Am 29.09.2009, 21:38 Uhr, schrieb Hale, Paul <paul.hale-X7qyDxFx8/lR5dUNPGT/[email protected]>: > Does anyone here still use Brian's weather script from about 2 years > ago? It appears to have stopped working since weather.com changed > something on their end. > > > If not, what do you guys use for weather in litestep? > I wrote a script in Lua that fetches the data from Yahoo! Weather. It requires luasocket, http://luaforge.net/projects/luasocket/ It's pretty simple and shot actually, the code is here: http://bitbucket.org/THC4k/litestep-ots3/src/tip/Data/luaext/Lua/yahoo/weather.lua The Script only loads the data, it doesnt display anything. You have to write a script that displays them on a label. In my Blank Theme i do this to show data, in `weatherdata:load()`: http://bitbucket.org/THC4k/litestep-ots3/src/df4cb3b5b1e2/Data/defaulttheme/Neu/scripts/buttons/Weather.lua Here is the basic idea, completely untested and written in my mail client ;-) ---- --[[ needs xlabel and timer litestep modules loaded ]]-- require "lsmodule" require "yahoo.weather" local weather_label = lsmodule.xlabel.weather_label -- some xlabel to display stuff location = "GMXX0087" -- my hometown ;-) unit = "C" lsmodule.every( "10m", function() -- every 10 minutes local ok, data = pcall(weather.fetch, location, unit) -- try to load the forecast if ok then local str = ('Condition: %s<br>Temperature: %s °%s'):format(data.condition.text, data.condition.temp, data.units.temperature) -- data holds the forecast weather_label:settext( str ) -- set it as text on the xlabel else -- errors happen, inet connection down, server busy or whatever lslua.message_box( 'Loading weather failed with', data ) end end ):start() ---- Dunno if you're using Lua at all, but i can never resist the opportunity for a shameless plug ;-) --------------------------------------------------------------------- Can't Unsubscribe? Check http://desktopian.org/listunsub.html LS List Homepage: http://wuzzle.org/list/litestep.php Get the LS FAQ: http://lsfaq.shellfront.org