Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Status
Not open for further replies.
Hey there, hey xtacocorex,

i have been trying to combine the nice layout function (as in group by date) of xtacocorex rss_feed_grabv3.py with the remove_html_tags of the dropbox_feed_grabber.

after hours of crashing into pyhton, i didnt get closer then modding the dropbox_feed_grabber script, having each dropbox decription filed unter its according date. but they are not grouped.

i would appreciate if you could help me out here.

thx for all your shared expertise anyhow

Give me a few, the mods I made to RSS Feed Grab V3 can be put into the Drop Box script. I'll even add sorting. Will let everyone know when its done.

Here is the link to the updated Dropbox script: http://xtacocorex-geektool-scripts.googlecode.com/files/dropboxnewsv3.py

Code:
Options:
  -h, --help            show this help message and exit
  -u, --underline       Underlines the headers, use only with the -g option
  -g, --groupoutput     Group the output by date
  -c COUNT, --count=COUNT
                        line count for output, default is 10
  -w WEBADDRESS, --webaddress=WEBADDRESS
                        url of the feed
  -d, --debug           Enable Debug output
 
Last edited:
Give me a few, the mods I made to RSS Feed Grab V3 can be put into the Drop Box script. I'll even add sorting. Will let everyone know when its done.

Here is the link to the updated Dropbox script: http://xtacocorex-geektool-scripts.googlecode.com/files/dropboxnewsv3.py

Code:
Options:
  -h, --help            show this help message and exit
  -u, --underline       Underlines the headers, use only with the -g option
  -g, --groupoutput     Group the output by date
  -c COUNT, --count=COUNT
                        line count for output, default is 10
  -w WEBADDRESS, --webaddress=WEBADDRESS
                        url of the feed
  -d, --debug           Enable Debug output

thank you very much. i implemented the scripts and learned a bit aobut python on the way. just not nearly enough to complete the task myself.

my desktop info background feels ready and done for now, thanks to you and the help of this forum.
 

Attachments

  • Screen shot 2012-02-29 at 11.37.59 AM.png
    Screen shot 2012-02-29 at 11.37.59 AM.png
    234.7 KB · Views: 679
I had a script awhile back for the date, that would put the appropriate ending for the date, can't figure out what to search for now.. :)

like if it was the 21st it would put 'st' if it was the 3rd it would put the 'rd' if it was the 22nd it would add the 'nd'.
 
Changing leading and/or line breaks

This is the weather script I'm using:

echo Seattle:; curl --silent "http://xml.weather.yahoo.com/forecastrss?p=98101&u=f" | grep -e "Current Conditions" -A 1 | tail -n 1 | sed -e 's/<BR \/>//' && echo && curl --silent "http://xml.weather.yahoo.com/forecastrss?p=98033&u=f" | grep -e "Forecast:" -A 2 | tail -n 2 | sed -e 's/<br \/>//' -e 's/<BR \/>//' | sed "s/\(.*\)\.\ \(.*\)/\1\?\2/" | tr "?" "\n" | sed "s/High\:\ \(.*\)\ Low\:\ \(.*\)/\?H\: \1\ L\:\ \2/" | sed "s/\?\(.*\)/\\1/"

Other than reducing the font size, is there a way to reduce the space between the lines (reduce the leading)?

Also, I'd be interested in putting Seattle and its conditions on one line, "Friday's" forecast on one other line and "Saturday's" forecast on yet another... three lines total.

Thanks for any help.
 

Attachments

  • Screen-shot-2012-03-02-at-9.56.jpg
    Screen-shot-2012-03-02-at-9.56.jpg
    70.3 KB · Views: 441
Last edited:
it could be your font, i cut and pasted your text in a new shell and it's got no extra spaces in between the lines.
Yes, changing the typeface was really the problem. Thanks.
I still wish I could have it on three lines instead of six.
 
Nerdtool script to display month calendar

This may be a dumb question...but I am having trouble using NerdTool to display a month calendar (that is, a shell script of "cal' - no highlighting current date, nothing fancy) - this is a thread for Geektool but I assume if it works in Geektool it should work in NerdTool too..

The problem I have is that when displayed on my desktop, the month calendar is misaligned - this seems to result from the single-digt dates and the empty spaces. You can see this in the attached pictures - the command/code I input was "cal" and the "Justify" one is the result if I click "Justify" in NerdTool for text alignment; the "Center" one is the result if I click "Center" in NerdTool (there are also "Left" and "Right" in NerdTool too and they did not work either; and I have to choose one of these options for text alignment).

So, how can I display a month calendar on my desktop, just like if I type "cal" in Terminal and a perfectly-aligned calendar would come up? Thanks!!!
 

Attachments

  • Jusify.png
    Jusify.png
    78.5 KB · Views: 1,977
  • Center.png
    Center.png
    81.3 KB · Views: 1,960
Is there a way to show image name in addition to the image?

I recently started using geektool and it is great!
i use one image geeklet to show images from a folder on my computer.

is there a way to also show the name of the image that is being displayed?
all my research yielded nothing as to how that might be possible. :(
 
This may be a dumb question...but I am having trouble using NerdTool to display a month calendar (that is, a shell script of "cal' - no highlighting current date, nothing fancy) - this is a thread for Geektool but I assume if it works in Geektool it should work in NerdTool too..

The problem I have is that when displayed on my desktop, the month calendar is misaligned - this seems to result from the single-digt dates and the empty spaces. You can see this in the attached pictures - the command/code I input was "cal" and the "Justify" one is the result if I click "Justify" in NerdTool for text alignment; the "Center" one is the result if I click "Center" in NerdTool (there are also "Left" and "Right" in NerdTool too and they did not work either; and I have to choose one of these options for text alignment).

So, how can I display a month calendar on my desktop, just like if I type "cal" in Terminal and a perfectly-aligned calendar would come up? Thanks!!!


using fixed-width fonts such as Monaco solves the problem!
 
run Nerdtool/Geektool after network is connected

I have my Nerdtool/Geektool scripts set up, in particular, I have a script to fetch the weather forecast information - I set the refresh rate to be 1800 seconds since weather forecast information would not be updated very often.

I also set my Nerdtool to open at login. However, since every time I log in, it takes several seconds for my Macbook to connect to the network, initially I would have no weather forecast info shown on my desktop. This is because when Nerdtool tries to work when I log in, no network is available. Then, given that my refresh rate is 1800, I will have to wait for 30 minutes for the weather script to work again, and then it would pull the weather info.

So, is there a way to let the weather script work only after a network connection is established? Thanks!!
 
Hey everyone, total noob here. I've gotten quite a few scripts running on my own, and my desktop is looking awesome! However, I have a couple of problems with the peripheral battery script below. First, its's consistently underreporting the keyboard battery life by 20%. Trackpad life is correct, which is great, but the keyboard is coming in exactly 20% less than it should. FYI: I'm on Lion, if that matters. Subsystems might have changed since the script that I found was written.

Second problem is that the battery life bars that are displayed are inverted from what I'd like them to be. Basically, I'd like the thicker bars to be for the remaining life in the gauge, with the thinner bars being what's expended.

Can anyone out there give me a hand? I only know enough about terminal commands to be dangerous, so please be gentle. ;)

Code:
KeyboardPercent=`ioreg -c AppleBluetoothHIDKeyboard | grep BatteryPercent | sed 's/[a-z,A-Z, ,|,",=]//g' | tail -1 | awk '{print $1}'`

typeset -i b=5
echo "Peripheral Battery Life:\nKeyboard:\t\t\c"

if [ ${#KeyboardPercent} = 0 ]
then
    echo "Disconnected\c"
else
    if [ $KeyboardPercent -lt 11 ]
    then
        echo "\033[1;31m\c"
    else
        echo "\033[0m\c"
    fi
    while [ $b -le $KeyboardPercent ]
    do
        echo "|\c"
        b=`expr $b + 5`
    done

    while [ $b -le 100 ]
    do
        echo "\033[1;37m|\033[0m\c"
        b=`expr $b + 5`
    done

    echo "\033[0m $KeyboardPercent%\c"

    unset KeyboardPercent
    unset b

fi

echo "\033[0m\nTrackpad:\t\t\c"

TrackpadPercent=`ioreg -c BNBTrackpadDevice | grep BatteryPercent | sed 's/[a-z,A-Z, ,|,",=]//g' | tail -1 | awk '{print $1}'`

if [ ${#TrackpadPercent} = 0 ]
then
    echo "Disconnected\c"
else
    if [ $TrackpadPercent -lt 11 ]
    then
        echo "\033[1;31m\c"
    else
        echo "\033[0m\c"
    fi

    typeset -i b=5
    while [ $b -le $TrackpadPercent ]
    do
        echo "|\c"
        b=`expr $b + 5`
    done

    while [ $b -le 100 ]
    do
        echo "\033[1;37m|\033[0m\c"
        b=`expr $b + 5`
    done

    echo "\033[0m $TrackpadPercent%\c"

    unset TrackpadPercent
    unset b
fi

Here's my current desktop, for anyone that might be interested. Battery meter is in the lower left-hand corner.

https://img.skitch.com/20120310-x9ypdcmm4p1yggsb7dicarsgum.jpg
 
Last edited:
Hey everyone, total noob here. I've gotten quite a few scripts running on my own, and my desktop is looking awesome! However, I have a couple of problems with the peripheral battery script below. First, its's consistently underreporting the keyboard battery life by 20%. Trackpad life is correct, which is great, but the keyboard is coming in exactly 20% less than it should. FYI: I'm on Lion, if that matters. Subsystems might have changed since the script that I found was written.

Second problem is that the battery life bars that are displayed are inverted from what I'd like them to be. Basically, I'd like the thicker bars to be for the remaining life in the gauge, with the thinner bars being what's expended.

Can anyone out there give me a hand? I only know enough about terminal commands to be dangerous, so please be gentle. ;)

Code:
KeyboardPercent=`ioreg -c AppleBluetoothHIDKeyboard | grep BatteryPercent | sed 's/[a-z,A-Z, ,|,",=]//g' | tail -1 | awk '{print $1}'`

typeset -i b=5
echo "Peripheral Battery Life:\nKeyboard:\t\t\c"

if [ ${#KeyboardPercent} = 0 ]
then
    echo "Disconnected\c"
else
    if [ $KeyboardPercent -lt 11 ]
    then
        echo "\033[1;31m\c"
    else
        echo "\033[0m\c"
    fi
    while [ $b -le $KeyboardPercent ]
    do
        echo "|\c"
        b=`expr $b + 5`
    done

    while [ $b -le 100 ]
    do
        echo "\033[1;37m|\033[0m\c"
        b=`expr $b + 5`
    done

    echo "\033[0m $KeyboardPercent%\c"

    unset KeyboardPercent
    unset b

fi

echo "\033[0m\nTrackpad:\t\t\c"

TrackpadPercent=`ioreg -c BNBTrackpadDevice | grep BatteryPercent | sed 's/[a-z,A-Z, ,|,",=]//g' | tail -1 | awk '{print $1}'`

if [ ${#TrackpadPercent} = 0 ]
then
    echo "Disconnected\c"
else
    if [ $TrackpadPercent -lt 11 ]
    then
        echo "\033[1;31m\c"
    else
        echo "\033[0m\c"
    fi

    typeset -i b=5
    while [ $b -le $TrackpadPercent ]
    do
        echo "|\c"
        b=`expr $b + 5`
    done

    while [ $b -le 100 ]
    do
        echo "\033[1;37m|\033[0m\c"
        b=`expr $b + 5`
    done

    echo "\033[0m $TrackpadPercent%\c"

    unset TrackpadPercent
    unset b
fi

Here's my current desktop, for anyone that might be interested. Battery meter is in the lower left-hand corner.

https://img.skitch.com/20120310-x9ypdcmm4p1yggsb7dicarsgum.jpg

Love the wallpaper! Where is that? Where can I get the pic?
 
Love the wallpaper! Where is that? Where can I get the pic?

I get all my wallpaper from Interfacelift.com. :D I've got about 30-40 that it rotates through randomly.

Quick update on my issue. The script appears to be working properly. Running the following terminal command, I'm getting the same BatteryPercent number that GeekTool is reporting.

Code:
ioreg -c IOAppleBluetoothHIDDriver | grep BatteryPercent

So the issue is that for some reason, the driver is reporting a number different than what I'm getting in the Bluetooth menu for the keyboard (which is still reporting 100%). Looking around, this appears to be a Lion bug.

Updated full-res screenshot: https://img.skitch.com/20120311-pspcm9w93e2hwb4xetdd7ttd33.jpg
 
Last edited:
This may not be the most appropriate place to ask for technical assistance, but I don't know where else to ask.

I've just started using GeekTool and I'm having some trouble. I downloaded an iCal Geeklet that didn't work. In my efforts to fix the problem, I ended up with three instances of this Geeklet (which appears blank) that I cannot close or remove at all. Since this started, other bugs have cropped up, like not being able to select other geeklets or make changes to them.

It's a bit of a mess now. I uninstalled GeekTool with AppCleaner and reinstalled it, but all of my old scripts reappeared in spite of that, and the problems persist. Can I do away with my old setup and start fresh to fix these problems?

Running Mac OS X Lion with GeekTool 3.0.3.
 
This may not be the most appropriate place to ask for technical assistance, but I don't know where else to ask.

I've just started using GeekTool and I'm having some trouble. I downloaded an iCal Geeklet that didn't work. In my efforts to fix the problem, I ended up with three instances of this Geeklet (which appears blank) that I cannot close or remove at all. Since this started, other bugs have cropped up, like not being able to select other geeklets or make changes to them.

It's a bit of a mess now. I uninstalled GeekTool with AppCleaner and reinstalled it, but all of my old scripts reappeared in spite of that, and the problems persist. Can I do away with my old setup and start fresh to fix these problems?

Running Mac OS X Lion with GeekTool 3.0.3.

Remove the 3 geektool plist files in the preferences folder that located in your user library folder

~/yourname/library/preferences/

This will reset geektool.
 
Ah, thank you much. I figured it had something to do with deleting some files in the library, I just didn't know where to look.
 
It's a bit of a mess now. I uninstalled GeekTool with AppCleaner and reinstalled it, but all of my old scripts reappeared in spite of that
That's because in most cases, app removal software doesn't do a thorough job of finding and removing files/folders related to deleted apps. For more information, read this. If you just want to delete the app, drag the .app file to the trash. No other software needed. If you want to completely remove all associated files/folders, no removal apps will do the job.

The most effective method for complete app removal is manual deletion:
 
Great

I love your screen shot but you didn't really define much of the way to duplicate it. What do you save the AScript file as?

How do you save am image file gellet?

What are the commands for the shell geeklets??

Yours is one of the best weather shots I have seen and would very much like to duplicate it exactly as you have done. I am very new to Mac so my experience is very limited on how to do many things.




The weather stuff can be tricky. I ended up writing a new Applescript for it, just to try to get a better understanding of it. You really shouldn't need Lynx to get the existing Yahoo Weather info to work though...

I re-wrote my scripts to gather info from the Yahoo Weather API. The advantages are a much simpler parsing routine and a well documented code table for weather conditions. This let me use the Flat Weather icon set to show my weather, rather than pull down the current weather PNG from Yahoo.

Here is the code:

Code:
--Date: 7/20/2010 Email:shomann@gmail.com
--Personal or non-commerical use only.
--Yahoo! Weather API used.

--Enter the location of the weather icon FOLDER on your harddrive as URL:
set iconfolder to "file://localhost/Volumes/media/_users/..."

--Enter the WOEID for your location here
--For more information on the WOEID system go here: http://developer.yahoo.com/geo/geoplanet/guide/concepts.html
--To find your WOEID, try here: http://sigizmund.info/woeidinfo/?woeid=texas

set theLoc to "2400767"

--Set unitlogic to true if you are using metric
set unitlogic to "false"

set shell1 to "curl \"http://weather.yahooapis.com/forecastrss?w="
if unitlogic = "false" then
	set shell2 to "\""
else
	set shell2 to "&u=c\""
end if

set web_content to do shell script (shell1 & theLoc & shell2) as string

set AppleScript's text item delimiters to "\""
--Location
set w_city to text item 14 of web_content
set w_state to text item 16 of web_content

--Units
set w_tempunits to text item 20 of web_content
set w_disunits to text item 22 of web_content
set w_prsunits to text item 24 of web_content
set w_speedunits to text item 26 of web_content

--Begin Current Conditions

--Wind
set w_cur_chill to text item 28 of web_content
set w_winddir to text item 30 of web_content
set w_windspd to text item 32 of web_content

--Atmosphere
set w_humid to text item 34 of web_content
set w_vis to text item 36 of web_content
set w_prs to text item 38 of web_content
set w_prslogic to text item 40 of web_content

--Astronomy
set w_sunrise to text item 42 of web_content
set w_sunset to text item 44 of web_content

-- Condition
set w_curcond_text to text item 46 of web_content
set w_curcond_code to text item 48 of web_content
set w_curcond_temp to text item 50 of web_content
set w_updated to text item 52 of web_content

--Forecast
set w_fore0day to text item 60 of web_content
set w_fore0low to text item 64 of web_content
set w_fore0high to text item 66 of web_content
set w_fore0text to text item 68 of web_content
set w_fore0code to text item 70 of web_content

set w_fore1day to text item 72 of web_content
set w_fore1low to text item 76 of web_content
set w_fore1high to text item 78 of web_content
set w_fore1text to text item 80 of web_content
set w_fore1code to text item 82 of web_content

--Prs logic
if w_prslogic is "1" then
	set w_prssymbol to "▲"
else
	set w_prssymbol to "▼"
end if

tell application "GeekTool"
	
	set command of shell geeklet "w_loc" to "echo '" & w_city & ", " & w_state & "'"
	set command of shell geeklet "w_foreday" to "echo '" & w_fore1day & "'"
	set command of shell geeklet "w_temps0" to "echo '" & w_curcond_temp & w_tempunits & "'"
	set command of shell geeklet "w_temps1" to "echo '" & w_fore0high & "-" & w_fore0low & w_tempunits & "'"
	set command of shell geeklet "w_temps2" to "echo '" & w_fore1high & w_tempunits & "\n" & w_fore1low & w_tempunits & "'"
	set image url of image geeklet "w_icon0" to iconfolder & w_curcond_code & ".png"
	set image url of image geeklet "w_icon1" to iconfolder & w_fore1code & ".png"
	
	set command of shell geeklet "w_updated" to "echo '" & w_updated & "'"
end tell


return "H: " & w_humid & "% | V: " & w_vis & w_disunits & " | W: " & w_winddir & "° at " & w_windspd & w_speedunits & " | P: " & w_prs & w_prsunits & w_prssymbol & "     ◉ " & w_sunrise & " - " & w_sunset

To break it down, I first have the script gather info from Yahoo Weather APIs. Then I assemble the output for the details of the current conditions, including humidity, visibility, wind, pressure, and sunrise/set. At the end of the script, I tell Applescript to reset the icons and temperature fields inside GeekTool.

I can break it down further, but if you want to use this as is, create two image geeklets named w_icon0 (for current conditions) and w_icon1 for tomorrow's conditions. Then create 3 shell geeklets named w_temps0 (current temp) and w_temps1(today's high low) and w_temps2 (tomorrow's temps).

You will need to modify the script to point to your weather icons folder. Search for Flat Weather icons on deviantArt for the icons I used...

Let me know what you think!


----------


The weather stuff can be tricky. I ended up writing a new Applescript for it, just to try to get a better understanding of it. You really shouldn't need Lynx to get the existing Yahoo Weather info to work though...

I re-wrote my scripts to gather info from the Yahoo Weather API. The advantages are a much simpler parsing routine and a well documented code table for weather conditions. This let me use the Flat Weather icon set to show my weather, rather than pull down the current weather PNG from Yahoo.

Here is the code:

Code:
--Date: 7/20/2010 Email:shomann@gmail.com
--Personal or non-commerical use only.
--Yahoo! Weather API used.

--Enter the location of the weather icon FOLDER on your harddrive as URL:
set iconfolder to "file://localhost/Volumes/media/_users/..."

--Enter the WOEID for your location here
--For more information on the WOEID system go here: http://developer.yahoo.com/geo/geoplanet/guide/concepts.html
--To find your WOEID, try here: http://sigizmund.info/woeidinfo/?woeid=texas

set theLoc to "2400767"

--Set unitlogic to true if you are using metric
set unitlogic to "false"

set shell1 to "curl \"http://weather.yahooapis.com/forecastrss?w="
if unitlogic = "false" then
	set shell2 to "\""
else
	set shell2 to "&u=c\""
end if

set web_content to do shell script (shell1 & theLoc & shell2) as string

set AppleScript's text item delimiters to "\""
--Location
set w_city to text item 14 of web_content
set w_state to text item 16 of web_content

--Units
set w_tempunits to text item 20 of web_content
set w_disunits to text item 22 of web_content
set w_prsunits to text item 24 of web_content
set w_speedunits to text item 26 of web_content

--Begin Current Conditions

--Wind
set w_cur_chill to text item 28 of web_content
set w_winddir to text item 30 of web_content
set w_windspd to text item 32 of web_content

--Atmosphere
set w_humid to text item 34 of web_content
set w_vis to text item 36 of web_content
set w_prs to text item 38 of web_content
set w_prslogic to text item 40 of web_content

--Astronomy
set w_sunrise to text item 42 of web_content
set w_sunset to text item 44 of web_content

-- Condition
set w_curcond_text to text item 46 of web_content
set w_curcond_code to text item 48 of web_content
set w_curcond_temp to text item 50 of web_content
set w_updated to text item 52 of web_content

--Forecast
set w_fore0day to text item 60 of web_content
set w_fore0low to text item 64 of web_content
set w_fore0high to text item 66 of web_content
set w_fore0text to text item 68 of web_content
set w_fore0code to text item 70 of web_content

set w_fore1day to text item 72 of web_content
set w_fore1low to text item 76 of web_content
set w_fore1high to text item 78 of web_content
set w_fore1text to text item 80 of web_content
set w_fore1code to text item 82 of web_content

--Prs logic
if w_prslogic is "1" then
	set w_prssymbol to "▲"
else
	set w_prssymbol to "▼"
end if

tell application "GeekTool"
	
	set command of shell geeklet "w_loc" to "echo '" & w_city & ", " & w_state & "'"
	set command of shell geeklet "w_foreday" to "echo '" & w_fore1day & "'"
	set command of shell geeklet "w_temps0" to "echo '" & w_curcond_temp & w_tempunits & "'"
	set command of shell geeklet "w_temps1" to "echo '" & w_fore0high & "-" & w_fore0low & w_tempunits & "'"
	set command of shell geeklet "w_temps2" to "echo '" & w_fore1high & w_tempunits & "\n" & w_fore1low & w_tempunits & "'"
	set image url of image geeklet "w_icon0" to iconfolder & w_curcond_code & ".png"
	set image url of image geeklet "w_icon1" to iconfolder & w_fore1code & ".png"
	
	set command of shell geeklet "w_updated" to "echo '" & w_updated & "'"
end tell


return "H: " & w_humid & "% | V: " & w_vis & w_disunits & " | W: " & w_winddir & "° at " & w_windspd & w_speedunits & " | P: " & w_prs & w_prsunits & w_prssymbol & "     ◉ " & w_sunrise & " - " & w_sunset

To break it down, I first have the script gather info from Yahoo Weather APIs. Then I assemble the output for the details of the current conditions, including humidity, visibility, wind, pressure, and sunrise/set. At the end of the script, I tell Applescript to reset the icons and temperature fields inside GeekTool.

I can break it down further, but if you want to use this as is, create two image geeklets named w_icon0 (for current conditions) and w_icon1 for tomorrow's conditions. Then create 3 shell geeklets named w_temps0 (current temp) and w_temps1(today's high low) and w_temps2 (tomorrow's temps).

You will need to modify the script to point to your weather icons folder. Search for Flat Weather icons on deviantArt for the icons I used...

Let me know what you think!
 
My desktop

Thanks for all your help and other sites here is my desktop. Very pleased :)
 

Attachments

  • desktop.png
    desktop.png
    1.6 MB · Views: 325
Dynamic images

Hey, I've been looking everywhere but I can't seem to find any scripts that would allow me to change an image dynamically. Pretty much what I'm trying to do is two things:

First - Have an image on my desktop change every minute.

Second - Have a large image (like scenery background) change depending on the current weather conditions.

Any ideas anybody? I thought I saw something once quick but I can't find it again.
 
Hi everybody

Having the most frustrating time trying to get the weather image to appear on my desktop and I wonder if someone can help me out.....Here's the script I'm using:

Shell:
curl --silent "http://uk.weather.yahoo.com/england/greater-london/london-44418/" | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /tmp/weather.png

Then the image script:
file:///tmp/weather.png

And I get precisely nothing happening. Anybody able to tell me what I'm doing wrong? Running Snow Leopard & Lion, no joy in either. When I look in /tmp there is no weather image there.

Thanks for any help
 
Hi everybody

Having the most frustrating time trying to get the weather image to appear on my desktop and I wonder if someone can help me out.....Here's the script I'm using:

Shell:
curl --silent "http://uk.weather.yahoo.com/england/greater-london/london-44418/" | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /tmp/weather.png

Then the image script:
file:///tmp/weather.png

And I get precisely nothing happening. Anybody able to tell me what I'm doing wrong? Running Snow Leopard & Lion, no joy in either. When I look in /tmp there is no weather image there.

Thanks for any help
That is because the grep on "forecast-icon" does not return anything. If you look into the HTML source, there is no CSS class forecast-icon. Looking through the source, I found the following as the current weather image url: http://l.yimg.com/os/mit/media/m/weather/images/icons/l/33n-100567.png

I don't know how you'd parse that out since it is contained within the following code:
Code:
<div class="current-weather" style="background:url('http://l.yimg.com/os/mit/media/m/weather/images/icons/l/33n-100567.png') no-repeat scroll 0% 0% transparent; _background-image/* */: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://l.yimg.com/os/mit/media/m/weather/images/icons/l/33n-100567.png', sizingMethod='crop');">


----------

Hey, I've been looking everywhere but I can't seem to find any scripts that would allow me to change an image dynamically. Pretty much what I'm trying to do is two things:

First - Have an image on my desktop change every minute.

Second - Have a large image (like scenery background) change depending on the current weather conditions.

Any ideas anybody? I thought I saw something once quick but I can't find it again.

It is possible to do both of these.
1 - Instead of controlling the script with Geektool, I would use cron with the job set to run every minute. The geeklet would then look at the image file output from the script. Not going to lie though, cron is far nerdier than geektool.

2 - You'd need a script that maps weather conditions to images. You'd then have your weather script output the condition and match it to the image in the map. This image would then get copied to a file that you can then have a geeklet point to.
 
That is because the grep on "forecast-icon" does not return anything. If you look into the HTML source, there is no CSS class forecast-icon. Looking through the source, I found the following as the current weather image url: http://l.yimg.com/os/mit/media/m/weather/images/icons/l/33n-100567.png

I don't know how you'd parse that out since it is contained within the following code:
Code:
<div class="current-weather" style="background:url('http://l.yimg.com/os/mit/media/m/weather/images/icons/l/33n-100567.png') no-repeat scroll 0% 0% transparent; _background-image/* */: none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://l.yimg.com/os/mit/media/m/weather/images/icons/l/33n-100567.png', sizingMethod='crop');">


.


Hi xtacocorex, many thanks for replying.

This is a bit weird, since I've seen several scripts which are all variations on a theme and which look almost identical to the one I posted. My understanding is that the script goes to the URL and grabs the background png which is (or appears to be) the weather image that is pertinent to what the weather is actually doing. If you right click on said image and select "View background image" you can see that it is indeed the image I'm after, so I'm confused.

All I want is a simple way of getting this weather png file onto my desktop every time geektool runs the script, like so many other people seem to have done apparently effortlessly (!). It's very frustrating because I have everything else set up, I just want that image to load and it's all good.

I should add that although I have done some coding and scripting in the past (mostly related to 3d graphics, HTML and some Flash) and I have a vague notion of what this code does, I'm well out of my comfort zone here.

Any help would be much appreciated.

Thanks.
 
Hi xtacocorex, many thanks for replying.

This is a bit weird, since I've seen several scripts which are all variations on a theme and which look almost identical to the one I posted. My understanding is that the script goes to the URL and grabs the background png which is (or appears to be) the weather image that is pertinent to what the weather is actually doing. If you right click on said image and select "View background image" you can see that it is indeed the image I'm after, so I'm confused.

All I want is a simple way of getting this weather png file onto my desktop every time geektool runs the script, like so many other people seem to have done apparently effortlessly (!). It's very frustrating because I have everything else set up, I just want that image to load and it's all good.

I should add that although I have done some coding and scripting in the past (mostly related to 3d graphics, HTML and some Flash) and I have a vague notion of what this code does, I'm well out of my comfort zone here.

Any help would be much appreciated.

Thanks.

You have to use certain Yahoo urls for this shell script to work the url you need is below. Like I said before, the script is looking for "forecast-icon" before it does the regular expressions, if it cannot find that, the script won't progress further.

Code:
http://weather.yahoo.com/england/greater-london/london-44418/?unit=c

The full shell script for you would be the following:
Code:
curl --silent http://weather.yahoo.com/england/greater-london/london-44418/?unit=c | grep "forecast-icon" | sed "s/.*background\\:url(\\'\\(.*\\)\\')\\;\\ _background.*/\\1/" | xargs curl --silent -o /tmp/weather.png

I'm slowly working on an ultimate weather script that will have the option of downloading the weather image. I don't have an ETA on the script though.
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.