

Show HN: Set NASA APOD as Ubuntu Desktop Background - randomdrake
https://github.com/randomdrake/nasa-apod-desktop

======
slyall
Looks nice. Just a small warning though, a couple of times per year they will
do something fancy with video or JavaScript that will probably break this.

~~~
randomdrake
Thanks for the heads up, slyall. I'll be sure to check so nothing weird
happens.

------
magic_haze
ah, good to see the old regex for <a href="(image. _?)"

I wrote a little parser for this site a while back to display the daily photo
as a desktop gadget, and had to resort to the same hack to get the image out.
It's a shame there isn't a rss feed for this yet.. it is a bit hard to be
believe that in this day and age, thousands of pieces of code around the world
are relying on how one guy decided to write his html.

[Ninja Edit:] For what it is worth, here's the regex I actually ended up
using:

    
    
        ^<a\s*?href\s*?=\s*?['"](image/.+?)\1\s*?>$
    

but obviously, this is equally fragile.

~~~
randomdrake
I plan on using an actual DOM parser on my next pass as I fully stand by and
believe that you should never parse markup with regex.

<http://stackoverflow.com/a/1732454>

------
streptomycin
Congrats!

One quick suggestion: I think it would be more straightforward if you used the
GSettings API through PyGObject rather than running the gsettings command.

~~~
randomdrake
Thanks, streptomycin!

I will definitely check out PyGObject. I didn't even know it existed.

------
eccp
First pull request!

<https://github.com/randomdrake/nasa-apod-desktop/pull/2>

------
junktest
[http://cad.cx/blog/2008/03/27/howto-astronomy-picture-of-
the...](http://cad.cx/blog/2008/03/27/howto-astronomy-picture-of-the-day-for-
gnome/)

------
agscala
So cool! I would really love if there was an OSX version

~~~
Tyr42
Hey, I'm just forking it right now to have that to you. I have it mostly
working, I'm just installing PIL. But apart from resizing everything works.
Check back in 15 minutes.

~~~
randomdrake
Awesome! I'd love to link to yours when/if you get it up and running. I would
very much like to make this in OSX myself, but as I said in another comment: I
still don't have a Macbook.

------
darkstalker
It doesn't need to be a ubuntu/gnome only script, for example to set the
wallpaper on fluxbox:

    
    
      fbsetbg -c $the_file

------
sp332
Do you have to resize it in the script? I think you can just set GNOME to
scale it down by itself.

~~~
randomdrake
The images are quite large (usually over 10MB, at least). Re-sizing them not
only saves space, but ensures your desktop doesn't do anything weird when
trying to scale by itself.

------
spindritf
It works nicely but the image looks squashed vertically on my 1366x768
display.

~~~
gnufs
The size of the image is statically defined in the script: RESOLUTION_X = 1680
RESOLUTION_Y = 1050

Change them to your screen's resolution.

------
haukur
Working on Fedora 17 (GNOME) with two monitors. Very nice!

------
Daviey
Annnnnnd, today it's a youtube video, which fails. :(

------
Jonanin
I would absolutely love this for osx. Good work!

~~~
randomdrake
Thanks very much, Jonanin!

Unfortunately, I'm still saving up for my first Macbook. Otherwise: I'd be all
over this request for you.

------
ktizo
_I just wanted an image, no text as I live in a semi-transparent terminal most
of the time_

This made me think of someone getting stuck living in an airport and writing
this script because they miss the stars.

Which is in no way relevant or particularly useful, admittedly.

~~~
randomdrake
Heh, you're not too far off. When I'm developing, I use Vim with a semi-
transparent terminal. Any text on the background would be terribly
distracting.

I wouldn't say I'm stuck. The images of stars are my own little gateways to
the Universe. I can't ever be "stuck" when I'm looking at them. I have a
fascination with the stars and all things to do with space & quantum physics,
so it works perfectly for me. I guess it's just something I've always been
drawn to. I even have a tattoo which represents these things.

I find the stars and all celestial bodies to be comforting, beautiful, and
quite inspirational. Much more than just a plain background.

~~~
ktizo
I used to have a darkened version of the hubble deep field set as my terminal
background and currently have a satellite photo of martian dunes and one of
those absolutely mental long exposures from the ISS by Don Pettit as some of
my desktop backgrounds. They are lovely, I keep meaning to find out about
getting some prints.
[http://www.flickr.com/photos/nasa_jsc_photo/sets/72157629726...](http://www.flickr.com/photos/nasa_jsc_photo/sets/72157629726792248/)

