Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Show a one-line weather forecast on the desktop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Show a one-line weather forecast on the desktop
Authored by: anika123 on Nov 20, '08 05:07:39PM
I use lynx dump and WU to get instant weather updated every six seconds.

I use this command: lynx -dump -width 120 http://printer.wunderground.com/cgi-bin/findweather/getForecast?query=21719 | /Users/lloncosky/library/scripts/lee/weathergeekA

With this script called weathergeekA:

#!/usr/bin/env perl

# Grab all the lines and put in an array.
@w = <>;

# Keep only certain lines for the current conditions.
@t = grep /^ +(Temperature|Wind|Humidity|Conditions|Updated|Observed|Pressure)/, @w;

# Erase the leading spaces and parenthetical values.
for (@t){s/^ +//;s/\(\)//g};

# I want the temperature line to print on the bottom to make it
# easy to see on the desktop. The temperature is always on the
# second line, so exchange it with the last line.
# ($t[$#t], $t[1]) = ($t[1], $t[$#t]);

# Sometimes there's a windchill line, and sometimes there isn't.
# Add a blank line to the front of the array if there isn't.
unshift @t, "\n" if $#t == 2;

# Print the lines of interest in the order I want.
print join "", @t;



You can change the script to get the facts you want. I have geektool display 8 lines in the bottom left of my desktop. I always have an accurate outdoor temp and wind direction.

[ Reply to This | # ]
Show a one-line weather forecast on the desktop
Authored by: anika123 on Nov 20, '08 05:17:27PM

I forgot to mention. This works best when you use the cookies feature in lynx to select the rapid fire weather station nearest to you. I think you need to install a newer lynx to get the cookies. Then use lynx in the terminal to goto your zipcode weather underground site. Then scroll down and select your favorite local rapid fire station and set it as your default. Thats it. Now whenever lynx dumps the page you will get the weather closest to you.



[ Reply to This | # ]
Show a one-line weather forecast on the desktop
Authored by: loren_ryter on Jan 03, '10 08:34:48AM
that printer. URL no longer works it seems (maybe just temporary but...) This mobile link works instead ok:
/sw/bin/lynx -dump -width 120 http://m.wund.com/cgi-bin/findweather/getForecast?query=48103#conditions | ~/bin/geektool/weathergeek
However I have a perl question... In the perl script above, how can the part that erases "leading spaces and parenthetical values" be modified so that it also kills everything after " / " (space slash space) -- that is all the metric values given? Because my output now looks like this:

Temperature 13.4?F / -10.3?C
Windchill 13?F / -10?C
Humidity 73%
Wind NNW at 3.0 mph / 4.8 km/h
Conditions Clear
Sunset 5:15 PM EST


[ Reply to This | # ]
Show a one-line weather forecast on the desktop
Authored by: anika123 on Jan 03, '10 03:16:04PM

I will work on that. In the mean time see my new python script in the main thread. Its not as good but I had not even looked at the mobile site, thanks for pointing that out. You will have to open the new script and change the weather code to reflect your area. Maybe it is useful to you. If not, look at it in a text editor and change at will. Everything is commented.



[ Reply to This | # ]