Skip to content
/ APOD_py Public
forked from kisom/APOD_py

python script to pull down the APOD and, in OS X, GNOME, and fluxbox, set the desktop background.

Notifications You must be signed in to change notification settings

qbit/APOD_py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 

Repository files navigation

apod.py
written by Kyle Isom <coder@kyleisom.net>

ABOUT:
This is a wee little python script to pull down the APOD and, for a few
operating systems / desktop environments, possibly set the desktop 
background. It does handle exceptions, writing useful (usually) error 
messages to stderr. 

PRE-REQUISITES:
- python and the following python modules:
    - argparse
    - OS X: appscript
    - GNOME: gconf

If you are missing any of the python modules, you can try installing the
package python-setuptools and then running:
    sudo easy_install argparse appscript (for OS X, substitute gconf for
                                          GNOME)

DEFAULT BEHAVIOUR:
The default behaviour of the script is to:
    1. load the APOD page and determine what the APOD is.
    2. grab the APOD url.
    3. open a temporary file and save the image there.
    4. determine the filename to save the image as the base name from the 
       APOD (i.e. images/1011/APOD_cool_pic.jpg -> APOD_cool_pic.jpg) and 
       append the date the image was grabbed, i.e. APOD_cool_pic_20101110.
    5. check to see if a file with that name exists in the given path.
    6. if not, save the file. if the file already exists, exit the script.
    7. if the file was saved and the --set flag was passed, check to see
       what OS the host is running. currently only supports setting the
       wallpaper in OS X. 
    8. fin.

The default directory to save images in is ${HOME}/Pictures/apod/
I have no idea if ${HOME} is set in windows. Please note that since I do
not have any win32 systems, I haven't tested this script under windows.
Caveat emptor.


USAGE:
usage: apod.py [-h] [-s] [-p PATH]

APOD script arguments

optional arguments:
  -h, --help            show this help message and exit
  -s, --set             flag to cause the script to set the desktop 
                        background to the downloaded image.
  -p PATH, --path PATH  path to store downloaded images in


I designed this to be a cronjob. My crontab entry looks like this:
15  22  *   *   *  python ${APOD_py}/apod.py -s 

SYSTEMS WHERE BACKGROUND SETTING IS IMPLEMENTED:
    - OS X
    - GNOME
    - fluxbox (via fbsetbg or Esetroot, prefers Esetroot)

    PLANNED:
    - awesomewm

    DO NOT PLAN TO SUPPORT (i.e. do it yourself):
    - win32
    - kde

About

python script to pull down the APOD and, in OS X, GNOME, and fluxbox, set the desktop background.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published