Thanks for this - a nice update to my desktop.
Having some trouble getting the correct icon to work... it keeps cycling though different icons.
I'm somewhat of a Gt noob. Any help? Thanks!
Thanks for this - a nice update to my desktop.
Having some trouble getting the correct icon to work... it keeps cycling though different icons.
I'm somewhat of a Gt noob. Any help? Thanks!
Hi mates: After working two weeks finally I set up new scrips working with the nice yahoo icons.
1. Open geek tools
2. WEATHER IMAGE SCRIPT (image)
file://localhost/tmp/weatherYfr.png
Refresh every 30 seconds
3. go to http://www.fr.meteo.yahoo.com set your city (for me is Barcelona, Spain) and copy your url:
http://fr.meteo.yahoo.com/espagne/catalogne/barcelone-753692
4. IMAGE GRAB SCRIPT (Shell)
curl --silent "http://fr.meteo.yahoo.com/united-states/missouri/kansas-city-12786046/" | grep "url('http://l.yimg.com/os/mit/media/m/weather/images/icons/l/"| sed -e "s/\yom-mod yom-weather.*obs-current-weather//" | sed -e "s/\-100567.png.*//" | sed -e "s/[0-9][0-9][a-z]/&-100567.png/" | sed -e "s/\<div.*http/http/" | xargs curl --silent -o /tmp/weatherYfr.png\
Refresh every 30 seconds
Works fine for me in Mavericks.
LOL. BIG_JM
Can you verify this is still working? I've tried it multiple times, even including your exact code and I can't get an image to pull up.
When trying it for my location I use this:
/code
But i'll look in the tmp folder and there are no .png files being written to display. Any ideas?
curl --silent "https://fr.meteo.yahoo.com/united-states/missouri/kansas-city-12786046/" | grep "url('https://s.yimg.com/os/mit/media/m/weather/images/icons/l/"| sed -e "s/\yom-mod yom-weather.*obs-current-weather//" | sed -e "s/\-100567.png.*//" | sed -e "s/[0-9][0-9][a-z]/&-100567.png/" | sed -e "s/\<div.*http/http/" | xargs curl --silent -o /tmp/weatherYfr.png\
At the end the mine.
BIGJM
Jim how do you get the detailed 5 day forecast? Can you post the script.
curl --silent "http://xml.weather.yahoo.com/forecastrss?p=USCA0741&u=f" | grep -E '(High:)' | sed -e 's/<BR \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<br \/>//'
http://edg3.co.uk/snippets/weather-location-codes/
curl --silent "http://xml.weather.yahoo.com/forecastrss?p=USMO0460&u=f" | grep -E '(High:)' | sed -e 's/<BR \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<br \/>//'
Drag a shell to the desktop . . . . .
At the end the mine.
BIGJM
curl --silent https://fr.meteo.yahoo.com/etats-unis/louisiane/baton-rouge-2446480 | grep "url('https://s.yimg.com/os/mit/media/m/weather/images/icons/l/"| sed -e "s/\yom-mod yom-weather.*obs-current-weather//" | sed -e "s/\-100567.png.*//" | sed -e "s/[0-9][0-9][a-z]/&-100567.png/" | sed -e "s/\<div.*http/http/" | xargs curl --silent -o /tmp/weatherYfr.png\
BIGJM: Or Anyone
I have tried many times for the last few days to get the weather script and image to work from the french site to no avail.
I live in Louisiana, Baton Rouge to be exact. Is there any way someone could walk me through the steps.
I followed BIGJM post to the T and cannot get a description or image.
My script is as follows:
curl --silent "https://fr.meteo.yahoo.com/états-unis/louisiane/baton-rouge-2446480/" | grep "url('https://s.yimg.com/os/mit/media/m/weather/images/icons/l/"| sed -e "s/\yom-mod yom-weather.*obs-current-weather//" | sed -e "s/\-100567.png.*//" | sed -e "s/[0-9][0-9][a-z]/&-100567.png/" | sed -e "s/\<div.*http/http/" | xargs curl --silent -o /tmp/weatherYfr.png\
file://localhost/tmp/weatherYfr.png
(PS: the only image i was successful in pulling is the moon, partly cloudy but it never changed and it was at 5pm)
Can someone please tell me what I am doing wrong? Should I be saving weather icons images on my computer as a local host and then have a temp.png set or something? I have no clue how it works.
PLEASE HELP.
It's possible you're having an issue with the é. I tried this (same script without the accent):
Code:curl --silent https://fr.meteo.yahoo.com/etats-unis/louisiane/baton-rouge-2446480 | grep "url('https://s.yimg.com/os/mit/media/m/weather/images/icons/l/"| sed -e "s/\yom-mod yom-weather.*obs-current-weather//" | sed -e "s/\-100567.png.*//" | sed -e "s/[0-9][0-9][a-z]/&-100567.png/" | sed -e "s/\<div.*http/http/" | xargs curl --silent -o /tmp/weatherYfr.png\
and it worked fine for me. I have the moon partially cloud covered too, but that's what the current weather is. Just make sure you set a refresh rate on the script - you don't have to do it more often than once an hour, so every 3600 seconds or more if you want.
yeti
Yeti, Thank you for the quick reply. Am I understanding this correctly in that, that script will not produce any conditions but rather it is the script to pull the image for the weather? So it will remain a blank script but is necessary for the correct image to pull with the image shell. If so, i just copied and pasted your reply script and will see what happens.
Thanks again.
Yes, this script will only download the image to your /tmp folder. You would need another script (just an img script) that you would also run every hour or so to display it. You would need a completely separate script to get conditions.
yeti
on run
set pathName to "/Users/USERNAME/Tools/RAMMeter"
set ramFile to pathName & "/RAMMeter.txt"
set COL_RED to "\\\\x1b[31\\;01m"
set COL_GREEN to "\\\\x1b[32\\;01m"
set COL_YELLOW to "\\\\x1b[33\\;01m"
set COL_RESET to "\\\\x1b[39\\;49\\;00m"
set newline to "\\\\n"
set colour to ""
set echoRAM to ""
do shell script ("top -l 1 | grep 'PhysMem' >" & ramFile)
set myUsedRAM to (do shell script ("grep -E 'PhysMem' " & ramFile & "| awk '{print $8}' | sed 's/M//'"))
set myFreeRAM to (do shell script ("grep -E 'PhysMem' " & ramFile & "| awk '{print $10}' | sed 's/M//'"))
set myTotalRAM to (myUsedRAM + myFreeRAM)
set myPercentRAMIcon to (round ((100 * myUsedRAM / myTotalRAM + 1) / 5)) * 5
set myPercentRAM to round (100 * myUsedRAM / myTotalRAM)
do shell script ("cp " & pathName & "/img/" & myPercentRAMIcon & ".png " & pathName & "/RAMMeter.png")
if myPercentRAM ≤ 50 then
set echoRAM to newline & COL_GREEN & myPercentRAM & "%" & COL_RESET & newline & myUsedRAM & " MB"
else if myPercentRAM ≤ 75 then
set echoRAM to newline & COL_YELLOW & myPercentRAM & "%" & COL_RESET & newline & myUsedRAM & " MB"
else if myPercentRAM > 75 then
set echoRAM to newline & COL_RED & myPercentRAM & "%" & COL_RESET & newline & myUsedRAM & " MB"
end if
do shell script ("echo RAM" & echoRAM)
end run
Looks like the awk print statements in the program are not correct. The first part of the program works if I change the following lines to:
set myUsedRAM to (do shell script ("grep -E 'PhysMem' " & ramFile & "| awk '{print $2}' | sed 's/M//'"))
set myFreeRAM to (do shell script ("grep -E 'PhysMem' " & ramFile & "| awk '{print $6}' | sed 's/M//'"))
Seems Yahoo has added weather codes, but not released the new list in the api documentation.
I'm getting quite a few errors lately, because the api is stating a weather condition that doesn't link up to the icons.
Many people use these apis in their apps, they gotta stop changing them all willy nilly, or at least update their api documentation when they do.
Inspired by some of the Rainmeter desktops I've seen, I've stolen quite a few images and added a couple of my own.
yeti
Image