Topic: https://brettterpstra.com/2011/09/05/geeklets-weather-and-forecast/
hide preview

What's next? verify your email address for reply notifications!

Justin 12y, 229d ago

This is fantastic! I wasted hours of my life yesterday trying to figure out the weather image. Once I figure this out it worked perfectly. I'm wondering if there's any way to add the barometric pressure to the current conditions??? I tried looking at the code, but couldn't understand any of it. :) Thanks for this script!

hide preview

What's next? verify your email address for reply notifications!

Wesley 12y, 232d ago

Oddly, everything is working for me but the forecast. Anybody else using this with ML? Wonder if that's broken it.

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 232d ago

It's working fine for me on two ML machines. Are you using the old one, or the one I just posted today? And was it working for you anywhere previously?

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Wesley 12y, 232d ago

Using the one you posted today. Unfortunately, I didn't test the old one. Would it help if I tried that version? If so, where should I find the old version?

hide preview

What's next? verify your email address for reply notifications!

emito 12y, 232d ago

@Jay and @ Brett. This is great!, only one thing I could't manage is to define mycity=location. Where should I place this? And what about the first code mycity = 'City, Sate......"
Thanks everyone!

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 232d ago

There should be a line at the top of the script that already has a location defined. If you're using Jay's function, just change that location to be "location" without the quotes.

hide preview

What's next? verify your email address for reply notifications!

Nick 12y, 250d ago

Then I get the following return:
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 249d ago

It's looking for the base file in this folder:

 /Users/nickthomas/Documents/Geektools/WeatherIcons/weatherparser.rb forecast/unknown.png

Which obviously doesn't exist. What do you have the $basedir setting configured as?

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Nick 12y, 249d ago

Don't know what you mean. I just installed Ruby and then downloaded your zip file. I opened the .glet files and changed the path of each shell. I also changed the zip code to my city in the script.

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 249d ago

<ol>
<li>There's a variable at the top (near the zip code) where you tell it what directory to look for your icons in.</li>
<li>What do you mean by "installed ruby?" Ruby comes with OS X by default, you shouldn't have to install anything unless you're upgrading, in which case you should use a tool like rvm or rbenv...</li>
</ol>

remark link parent

load more (2 remarks)
hide preview

What's next? verify your email address for reply notifications!

Nick 12y, 249d ago

Thanks m8! I just had to delete "/weatherparser.rb forecast" and now it's working like a charm!

The strange thing is that I never changed something in de basedir line. But anyways, the problem is solved! :D

hide preview

What's next? verify your email address for reply notifications!

Nick 12y, 249d ago

This is what I found in the code:
$basedir = '/Users/nickthomas/Documents/Geektools/WeatherIcons/weatherparser.rb forecast'

About Ruby: I didn't knew Ruby is installed by default so I installed it by running the command: brew install ruby.

hide preview

What's next? verify your email address for reply notifications!

Nick 12y, 250d ago

I'm having the same problem as above! Everything works except for the current weather. When I run this command: /Users/nickthomas/Documents/Geektools/WeatherIcons/weatherparser.rb

I get this:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/ftools.rb:59:in stat': No such file or directory - /Users/nickthomas/Documents/Geektools/WeatherIcons/weatherparser.rb forecast/unknown.png (Errno::ENOENT)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/ftools.rb:59:in
syscopy'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/ftools.rb:89:in copy'
from /Users/nickthomas/Documents/Geektools/WeatherIcons/weatherparser.rb:52:in
set_icon'
from /Users/nickthomas/Documents/Geektools/WeatherIcons/weatherparser.rb:41:in `current'
from /Users/nickthomas/Documents/Geektools/WeatherIcons/weatherparser.rb:90

When I add "forecast" or "time", everything is just fine!

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 250d ago

What do you get when you run ruby -v?

hide preview

What's next? verify your email address for reply notifications!

Joshua 12y, 259d ago

The icon doesn't seem to change depending on the weather or time. Just stays as weathericon.png

Tried playing with different file path formats ( ~ vs /Users etc) in both the geeklet path and .rb config path, played with adding "cloudy" as mentioned in the post to force the image to change, but I get nothing. Just stays the same.

Any idea what I'm doing wrong?

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 259d ago

Run ruby weatherparser.rb from the command line in the folder where it resides and see if there are any errors shown.

hide preview

What's next? verify your email address for reply notifications!

matt 12y, 265d ago

Not sure what I'm doing wrong. It's basically stuck on cloudy though it is not cloudy according to the real weather or wunderground.com. Is there a need to have another shell running the weatherparser.rb? Very confused. Also this: http://imgur.com/6n9DW

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 265d ago

In the path shown in the error, it's looking for "Geektools", whereas the path in your Finder appears to be "GeekTool". Is that the issue?

hide preview

What's next? verify your email address for reply notifications!

Domenica 12y, 303d ago

This is great! I have loved using this, one issue though is the pictures just rotate through and don't match the forecast as @Chi Vu has commented about. Here is a screenshot of me using it. :) I would appreciate why the image is not working. http://www.flickr.com/photo...

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 12y, 303d ago

@Chi Vu and @Domenica, what countries are you in? The API may be returning strings that aren't recognized by the hardcoded presets in the file. Let me know, I have a localizable version that might help.

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Chi Vu 12y, 303d ago

I realized that it was working, but it had no corresponding picture for partly cloudy during the nighttime, therefore it reverted to the daytime picture for the specific forecast, making me think the icons don't work. @Domenica, one thing that helped me when I was configuring the icon however, is to make sure that your image geeklet url ends ".png" instead of the WeatherIcon folder that contains all the icons. For example mine is:
file://localhost/Users/username/Documents/Geeklets/WeatherIcons/weathericon.png

When I set it as "file://localhost/Users/username/Documents/Geeklets/WeatherIcons", it just rotated through the list. Hope this helps!

hide preview

What's next? verify your email address for reply notifications!

Chi Vu 12y, 307d ago

This is by far the best weather geeklet I've come across. I've managed to configure the current weather condition via the comments, but for some reason, the icon doesn't match up to the forecast. Instead, it just rotates through the different pictures based on the intervals I set. Is this because of my image geeklet or is it due to the ruby coding? Any ideas would be appreciated!!

hide preview

What's next? verify your email address for reply notifications!

Myrddyn 12y, 348d ago

I am also having problems with the 'current' command. Below please find the output when running the command from terminal:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/ftools.rb:59:in stat': No such file or directory - /Users/username/Users/username/Documents/Geeklets/WeatherIcons/unknown.png (Errno::ENOENT)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/ftools.rb:59:in
syscopy'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/ftools.rb:89:in copy'
from weatherparser.rb:52:in
set_icon'
from weatherparser.rb:41:in `current'
from weatherparser.rb:84

remark link
hide preview

What's next? verify your email address for reply notifications!

Myrddyn 12y, 348d ago

I got it working, here's what needed to be done on my Lion 10.7.2 system.

The Ruby script I was using had the full path, I shortened it to '~/Documents/Geeklets/WeatherIcons' and the Geeklet commands were modified to this: ruby Users/username/Documents/Geeklets/WeatherIcons/weatherparser.rb time/current/forecast. I hope this helps anyone else having issues getting the current conditions to display.

hide preview

What's next? verify your email address for reply notifications!

Carl Holscher 13y, 76d ago

Everything works great for me except the current as well. My full path is "/Users/holscherct/Documents/geektool/weather/weatherparser.rb current". The forecast and icons work but the current does not and I don't know why. Any suggestions?
Running Lion 10.7.2 and Geektool from MAS downloaded today.

remark link
hide preview

What's next? verify your email address for reply notifications!

J 13y, 70d ago

Is the location defined correctly in the ruby script? maybe there's a typo

remark link parent
hide preview

What's next? verify your email address for reply notifications!

M 13y, 35d ago

Did you put that snippet ABOVE the config section? You need to put it above so it gets defined once mycity = location is hit.

For me, the problem is that my AT&T IP here in Los Angeles is being processed as Richardson, TX. Weird.

hide preview

What's next? verify your email address for reply notifications!

Uwe 13y, 75d ago

Use this instead...

file://localhost/Users/uwedenk/Documents/Geektool/WeatherIcons/weathericon.png

The "Set Local Path" button clued me into the correct path.

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Carl Holscher 13y, 75d ago

No dice. I still get a little red "this isn't working" dot and no data.

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Uwe 13y, 75d ago

Well I hate to ask... you did replace the user specific path names and replace them with yours, right? I used the "set local path" button to get my path. You will have to set your own specifics. I this doesn't work I'm sorry. It worked for me.

hide preview

What's next? verify your email address for reply notifications!

Uwe 13y, 78d ago

I am having the same issue as John from Dec 20th. All works fine except the current conditions.

remark link
hide preview

What's next? verify your email address for reply notifications!

Uwe 13y, 78d ago

I got this to work, sry. Just had the path incorrectly coded.

hide preview

What's next? verify your email address for reply notifications!

John 13y, 90d ago

I have gotten everything to work except for the current geeklet, my command is set to "/Users/WeatherIcons/weatherparser.rb current" I have my WeatherIcons folder directly in my users folder. I used the same command except instead of current, I have either forecast or time for the other two geeklets and they work perfectly. Any help would be greatly appreciated.

hide preview

What's next? verify your email address for reply notifications!

Jay 13y, 111d ago

I added the following location code to call instead of hardcoding mycity (mycity = location). It converts your IP address to the city of your IP host. It's close enough for the weather. Now when I travel I always get local weather.

def location
response = Net::HTTP.get_response(URI.parse(URI.escape("http://api.hostip.info/get_xml.php?")))
doc = REXML::Document.new(response.body)
features = doc.root.elements[4]
hostip = features.elements[1]
city = hostip.elements[2].text
return city
end
remark link
hide preview

What's next? verify your email address for reply notifications!

YS 12y, 279d ago

Hi Jay,

is there a way to get a zip code result instead of the city name?

hide preview

What's next? verify your email address for reply notifications!

Pattulus 13y, 91d ago

This is a great idea/feature. Do I need to change anything or is it enough to paste the code at the bottom of the document (that's what I did).

It sound like I have to replace the hardcoded mycity variable. I tried to replace it with your code exchange 'city' for 'mycity'. Since this didn't work I just put your snippet at the bottom. By now you can tell that I got no clue of ruby and so, if you find the time to help me out on this one I'd be very thankful.

remark link parent
hide preview

What's next? verify your email address for reply notifications!

J 13y, 70d ago

If you still need help,: mycity = location
exactly like that. you're setting mycity to be the function called "location" (as defined by Jay) which returns the city as it calls the function. so you just set mycity = "function name" which is called 'location' in this case

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Patrick Welker 13y, 70d ago

Thanks J, I've just read it and appended the variable and the definition at the bottom of the document. It seems to work. No error, although I can't try it now since I won't travel in the next months.

hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 111d ago

Brilliant!

hide preview

What's next? verify your email address for reply notifications!

W 13y, 122d ago

I'm having an issue getting this to work. I enter in the path to the specific folder like this: /Users/***********/WeatherIcons/ with the last part being the specific command in each shell and I get the failure icon on all 3. Any Idea as to what I am doing wrong?

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 121d ago

Lots of things to question. First, if you execute the full path you're using in your GeekTool command on the command line, what do you get?

remark link parent
hide preview

What's next? verify your email address for reply notifications!

W 13y, 121d ago

I got it to work. The weather icons folder was in the folder i was directing it to. Once i changed it to the correct path it worked. I just gave up and asked before I spent much time trouble shooting. Thank you though.

hide preview

What's next? verify your email address for reply notifications!

Justin Rey 13y, 134d ago


Here are the pics. Adding/removing geektool on the menu bar did nothing though.

remark link
hide preview

What's next? verify your email address for reply notifications!

Justin Rey 13y, 134d ago
remark link parent
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 134d ago

That's really odd. Do you have the individual geeklets set to "always on top" or anything like that?

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Justin Rey 13y, 134d ago

Everything's on 'Set locale environment', however when I check 'keep on top', Mission Control won't show any of my Geeklets but it would always be on top of everything whenever I'm not on M.ctrl, ultimately disrupting whatever I'm doing.

remark link parent

load more (1 remarks)
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 134d ago

Ok, so I was able to replicate this on my Mac Pro (was only running GT on my Air before). I'll play with it and let you know if I find anything. Beyond that, you might want to contact the support link on the Mac App Store and see what they have to say.

hide preview

What's next? verify your email address for reply notifications!

Justin Rey 13y, 134d ago

Hey Brett! Is there any way to make my Geeklets disappear whenever I use Mission Control?

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 134d ago

You mean so they're not visible while all of the desktops are shrunk in Mission Control? That already happens for me with GeekTool…

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Justin Rey 13y, 134d ago

Yeah, apparently mine's not the same case as yours. Can you help me? :D

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 134d ago

Are you using the MAS version of GeekTool?

remark link parent

load more (2 remarks)
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 134d ago

I'm afraid I can't be of much help. If it doesn't happen for me, and there's no option for setting desktop level, I don't know what to tell you. Maybe send a screenshot of what you're seeing?

One question... do you show GeekTool in the menubar? Mine doesn't, wonder if that makes a difference at all?

hide preview

What's next? verify your email address for reply notifications!

Justin Rey 13y, 134d ago

Yup. Running 3.0.2. on Lion 10.7.2. Beta.

hide preview

What's next? verify your email address for reply notifications!

Ben 13y, 145d ago

The icons don't seem to display correctly according to time of day. I haven't really ever messed with Ruby, but I see that you have it set from 19:00 to 08:00 to show the "nighttime_icons" version of the icons. This doesn't seem to work quite right. Do I have to set a timezone some where in the weatherparser.rb file? I have my zipcode set already.

remark link
hide preview

What's next? verify your email address for reply notifications!

ttscoff 13y, 145d ago

Do the nighttime icons show up at all? Mine sometimes need a kickstart (manual refresh) before they start updating. If that's not the case and you think something is up with timezones, run this at the command line:

 ruby -e 'puts Time.now'

That will show you what time your default Ruby install thinks it is… some adjustments may be necessary to the script from there.

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Ben 13y, 131d ago

The one that seems to provide an issue is the nighttime partly cloudy. I corrected the times to account for daylight time here (thanks DST!), but still get a sun when it's "partly cloudy" out. What could I add to the parser file to fix this? I added the 'partlycloudy' line to the nighttime_icons = line and created a new png file to accommodate for the nt_partlycloudy call, to no result. I hope this makes sense. I'm a super noob to Ruby.

Thanks!

hide preview

What's next? verify your email address for reply notifications!

Ana 13y, 170d ago

My desktop icons seem to go under my geeklets, how can bring them to be over the geeklets...is that possible?

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 170d ago

Not sure, I've never had that problem. Is it above your icons but below your windows? There's an "always on top" setting, so check that, but otherwise I wonder whether you're running PathFinder's desktop or anything else that would be masking the original desktop layer?

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Ana 13y, 170d ago

how do I find out if I'm running PathFinder's desktop?

I'm using this look, the beach scene, http://desktopspotting.com/...

the bottom part of the sand and the clock and date, everything, is somehow going above my desktop icons...any icons that are where that sand is, are behind the sand so I cant see them...

remark link parent
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 169d ago

Are you running Path Finder? It does sound to me like you need to check some of your geeklets "always on top" setting in the inspector.

hide preview

What's next? verify your email address for reply notifications!

Ana 13y, 170d ago

how do I find out if I'm running PathFinder's desktop?

I'm using this look http://desktopspotting.com/...

the bottom part of the sand and the clock and date, everything, is somehow going above my desktop icons...any icons that are where that sand is, are behind the sand so I cant see them...

hide preview

What's next? verify your email address for reply notifications!

Bob 13y, 175d ago

Thanks for sharing these. They're almost idiot-proof, but it took me a minute to realize I needed to put "ruby" before the path in the "Command" field.

hide preview

What's next? verify your email address for reply notifications!

Tim Lahey 13y, 181d ago

I love this. I'm quite glad to stop using the different menu bar apps for the weather. With this, I can get current and forecast weather right on my desktop in an nice format.

Do you have a recommendation for a fog icon? I just ran across fog and the parser pulled the unknown icon. Cloudy kind of works, but isn't quite right.

hide preview

What's next? verify your email address for reply notifications!

Sebastian 13y, 185d ago

Really nice Geeklet. Thanks for sharing!

hide preview

What's next? verify your email address for reply notifications!

Paul 13y, 185d ago

How do the fonts in the screenshot look so good? When I set this up the anti-aliasing looks terrible.

(I'm using Helvetica Neue btw).

hide preview

What's next? verify your email address for reply notifications!

Thomas 13y, 186d ago

First let me say: This is the best weather applet I have seen. Period.
But then: The "current" doesn't seem to work with my city (Bonn, Germany). Have they changed anything at weatherunderground?

Thanks a million!

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 186d ago

I don't know, offhand. I'll try to do a little testing with European cities when I have a chance.

hide preview

What's next? verify your email address for reply notifications!

Stephan 13y, 196d ago

Is there a way for the calls to Weather Underground to use the system proxy settings? My laptop moves between work and home and while at work I'm behind a proxy. I'm sure I could modify the calls to use a proxy but a more elegant solution would be for it to just look at the system proxy settings and thus use a proxy if one's configured.

Thanks!

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 196d ago

I'm sure there's a way, but I don't know what it is offhand.

hide preview

What's next? verify your email address for reply notifications!

David Ferguson 13y, 196d ago

I created a site a while back that makes grabbing weather info for GeekTool really easy. It's gtwthr.com. It performs basically the same task as your script, but runs remotely. You would simply create a shell script geeklet and set the command to curl a url. The url consists of the location id and the data element you want. It also works with icons.

hide preview

What's next? verify your email address for reply notifications!

Brad Ovenell-Carter (@Braddo) 13y, 196d ago

Are you a Geektool user? Geeklets: weather and forecast. Good stuff. http://j.mp/qlLu1C

hide preview

What's next? verify your email address for reply notifications!

HelgeG 13y, 196d ago

Nice geeklet! To make it run under Ruby 1.9.x, I changed require 'ftools' to require 'fileutils', and the File.copy... calls to FileUtils.cp.... FTools is deprecated in Ruby 1.9.

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 196d ago

Good call, I should put in a check for that...

hide preview

What's next? verify your email address for reply notifications!

Dr. Drang 13y, 197d ago

Y'know, Brett, keeping up with you is becoming a pain in the ass. I decided to use NerdTool rather than GeekTool on the strength of this post of yours from back in February. NerdTool just became Lion compatible a couple of weeks ago, and now I'm wondering if I should switch back to GeekTool.

Seriously, I'd like to hear what you see as the strengths and weaknesses of GT and NT and why you've chosen one over the other.

remark link
hide preview

What's next? verify your email address for reply notifications!

Brett 13y, 197d ago

I haven't done an honest comparison between NT and GT since the Lion upgrade. I grabbed GeekTool to see what was up in the new version, but these geeklets were written for NerdTool originally. Now that GeekTool supports ANSI colors and does a decent job of font smoothing, the only valid comparison (in my eyes) would be memory footprint, which seems negligible in both cases.

I grabbed the Lion build of NerdTool, too, but haven't even loaded it up yet. I'd been going Nerd/GeekTool free since Lion for various reasons. Reasons I have realized are less important than having nerd fun. I'd be curious to hear any comparisons you have, though.

hide preview

What's next? verify your email address for reply notifications!