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

Bing picture of the day on your desktop. Desktop
Bing has those nice images on www.bing.com and every day they have a new one. I have put together a small python script which fetches today's image and displays it on the desktop.

Note: you will need to manually create the DeskFeed folder inside your Pictures folder.

Here's the script:
#!/usr/bin/env python
import os
import md5
import pprint
import sys
import subprocess
from time import strftime
from urllib import URLopener
from urllib2 import urlopen
from xml.dom.minidom import parseString

# Defines source and destination of image
rss_feed = 'http://feeds.feedburner.com/bingimages';
dst_dir = os.path.expanduser('~/Pictures/DeskFeed/')

SCRIPT = """/usr/bin/osascript<<END
tell application "Finder"
set desktop picture to POSIX file "%s"
end tell
END"""


def set_desktop_background(destination):
  subprocess.Popen(SCRIPT%destination, shell=True)

def parseFeed(rss):
  destination = "%s%s.jpg" % (dst_dir, strftime( "%y-%m-%d"))
  if os.path.exists(destination):
    sys.exit(0)



  try:
    rss_contents = urlopen( rss )
  except:
    print "Failed to read rss feed %s" % rss
    return
  rss_src = rss_contents.read()
  rss_contents.close()
  dom = parseString( rss_src )
  firstitem = dom.getElementsByTagName('item')[0]
  link = firstitem.getElementsByTagName( 'enclosure' )[0].getAttribute('url')
  URLopener().retrieve(link, destination)
  set_desktop_background(destination)


def main():
  parseFeed(rss_feed)

if __name__ == "__main__":
  main()
This, and other useful scripts, are available here.

[crarko adds: I tested this, and it works as described. To actually run the Python script I recommend studying the brief tutorial here. I used the Python Launcher utility from MacPorts to manage the script.]
    •    
  • Currently 1.50 / 5
  You rated: 3 / 5 (26 votes cast)
 
[13,676 views]  

Bing picture of the day on your desktop. | 7 comments | Create New Account
Click here to return to the 'Bing picture of the day on your desktop.' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Bing picture of the day on your desktop.
Authored by: wallybear on Jan 31, '12 09:28:28AM

The script is truncated.

You can get the correct one at the link posted in the hint.



[ Reply to This | # ]
Bing picture of the day on your desktop.
Authored by: crarko on Feb 02, '12 05:29:38AM

Fixed. Geeklog outsmarts me again...

Craig A.



[ Reply to This | # ]
Bing picture of the day on your desktop.
Authored by: The Eck on Jan 31, '12 05:21:42PM

Thank you so much for this script and for the added install help, Craig. I no nothing about scripts or Python and following your directions and those on your links, it ran perfectly the first time. I'm amazed!

-Tod



[ Reply to This | # ]
Bing picture of the day on your desktop.
Authored by: brucio on Jan 31, '12 10:22:10PM

Great tip! Now, how can I get it to display on my secondary monitor instead of my primary one?



[ Reply to This | # ]
Bing picture of the day on your desktop.
Authored by: BiL Castine on Feb 01, '12 09:57:57AM
to set the desktop picture of the second monitor, replace the embedded AppleScript (lines 17 thru 19) with
set tlist to {}
tell application "System Events"
set tlst to a reference to every desktop
set picture of item 2 of tlst to POSIX file "%s"
end tell



[ Reply to This | # ]
Bing picture of the day on your desktop.
Authored by: ViViDboarder on Feb 08, '12 07:41:02AM

Just spent some time doing that myself.

Enjoy: http://tinyw.in/ErLV

Currently, I'm not sure if it handles multiple "spaces". And by I'm not sure... I mean it doesn't.



[ Reply to This | # ]
Bing picture of the day on your desktop.
Authored by: zho40 on Feb 04, '12 07:27:35AM

Great tip. Does Bing provide a higher resolution picture to pull these are all 958x512?



[ Reply to This | # ]