I’ve written a Ruby script called bbc-weather.rb that parses the BBC weather RSS for a particular location and formats the data for conky. Here’s an example:
To use it insert the following in your .conkyrc:
${execpi 600 ruby /path/to/bbc-weather.rb 4197}
This will refresh every hour. Replace 4197 with the number of your local weather station. You can find this by looking at the BBC weather URL which is of the form weather/forecast/XXXX. You also need to define two colours for the script to use, in the options section before TEXT, like so:
color1 white color2 grey
You might also need the following, as conky limits the about of text it will read from a sub-process:
text_buffer_size 2048


Posts
Love your script, thank you! Is there any way to make it show F instead of C in temperature?
May 3, 2011 @ 5:30 pm
I’ve updated the script so you can pass ‘c’ or ‘f’ as a second argument to put temperatures in centigrade or fahrenheit.
May 8, 2011 @ 12:46 pm
hi mate having trouble with this script
bbc-weather.rb:45: syntax error, unexpected $end, expecting keyword_end
“#{(9 * val.to_i) / 5 + 32}°F”
tried adding a few ends but no luck? is there a small error possibly?
November 26, 2011 @ 7:26 pm
sorted just add
# encoding: utf-8
at the top of the script and its working like a charm now thanks!
November 26, 2011 @ 7:31 pm
Thanks! I updated the script.
November 29, 2011 @ 7:22 am
It breaks for negative temparatures: I changed (\d+) to (-?\d+) in three places.
February 8, 2012 @ 3:55 am
Thanks for that. I’ve updated the script. Can’t test it at the moment (thankfully)
February 14, 2012 @ 8:25 pm