General TC > Programming & Scripting - Unofficial

Astronomy Picture of the Day

(1/1)

roberts:
A site that I regually visit is http://apod.nasa.gov
So just for fun I though to make a downloader to save the picture of the day into /opt/backgrounds so that I may use it as my wallpaper.


--- Code: ---#!/bin/sh
# Download Astronomy Picture of the Day
VIEWER="flpicsee"
URL="http://apod.nasa.gov/apod"
PIC="$(wget -O - $URL/astropix.html 2>/dev/null | grep '<a href="image')"
[ "$?" == 0 ] || exit 1
PIC="${PIC#*\"}" && PIC=${PIC%\">} && EXT="${PIC##*.}"
POD="/opt/backgrounds/astropic.$EXT"
wget -q -O "$POD" $URL/$PIC
[ "$?" == 0 ] || exit 1
[ $(which "$VIEWER") ] && "$VIEWER" "$POD" &

--- End code ---

Note that I have set VIEWER to flpicsee change to your preferred image viewer. Note too that I overwrite each day's picture. I don't want to fill up my limited space. So if you really want to keep a picture rename it!

coreplayer2:
That's way too cool thanks  :)

gadget42:
three reasons for using a decade-old thread...

didn't want to start another new thread...
it was one of three results of searching for "astronomy"...
and more importantly, that webpage is still active(as of today anyways)...
(here is today's APOD: https://apod.nasa.gov/apod/image/2206/ShipTracks_Terra_4892.jpg)

Venus crossed the sun's face 10 years ago. Most people alive will never see the sight again. - space.com - Tom Kerss

snippet from slashdot:
https://science.slashdot.org/story/22/06/06/027208/remembering-the-transit-of-venus-on-its-10th-anniversary

space.com:
https://www.space.com/venus-transit-2012-skywatching-reminiscences

gadget42:
more POTD goodness:
https://www.space.com/34-image-day.html

Navigation

[0] Message Index

Go to full version