National Geographic's Photo Of the Day

I am a fan of National Geographic photos on their site, and I also get bored of by my desktop background after a while. So I decided to create a script to download National Geographic photo of the day, and using it as my desktop background. I am using it over Gnome3 (I am using Fedora as I think it’s more stable than Ubuntu, and I like Gnome3 way better than Unity), but if you are a Unity user it should work for you as well. You can find the script here:

https://github.com/samanbarghi/ngphotodownloader

Although National Geographic posts a photo everyday, not all the photos come with a high quality format. So the script checks whether a wallpaper format exists or not. If so, it downloads the photo into the same directory the script resides.

 

Setup

All you need to do is  create a directory for your wallpaper and put the script in there, e.g.:

cd ~/Pictures/
git clone https://github.com/samanbarghi/ngphotodownloader.git NGWallpapers

Simply run the script to get the Photo of the day. But doing that manually everyday is not fun. Here cron comes handy. You need to run the script at least once each day, to automate the process you can use cron to download the script and set it as your desktop background:

0 12 * * * sh /home/yourusername/Pictures/NGWallpapers/ngwallpaper.sh

In my case since I am running the script on my laptop, and my laptop is not always on; I call the script every 3 hours to make sure it runs at least once each day. Don’t worry about duplicates, the script will not download the image if it already exists in the directory. The overhead of the script on cpu/memory/network is negligible, so don’t worry about calling the script 8 times a day:

00 */3 * * * sh /home/yourusername/Pictures/NGWallpapers/ngwallpaper.sh

Enjoy!