Show HN: Himawari-8 (Whole Earth Geostationary Weather Satellite) Wallpaper Bot
gist.github.com
gist.github.com
The results are cool though as it updates every 10 minutes.
Anyone else do/see anything fun with scripting wallpapers?
Unfortunately I think it's the only one of its kind! It's quite strange looking at the other side of the world all the time, especially since it is night time there. I have thought about adding a 12 hour offset to the bot so that I get to see daytime when it's day in UK.
What you can do if you process your background automatically anyways is overlaying current information, e.g. a weather forecast. YR.no has nice 24h-graphs that work well for that. Both PIL and ImageMagick support various blend modes to make it look nice.
That's a pretty good idea, thanks. Although, whenever I see desktops as dashboards I'm always torn between their utility versus the aesthetic of a clean image. Food for thought...
* I would get rid of the is_connected function. If you are not connected, downloading the file will fail, and you are not doing terribly expensive functions that you'd want to avoid before. And you still have to deal with download errors, because reaching google doesn't mean the server you pull images from is reachable and working. Add error handling for the main download and you are fine.
* Don't put code on module level, but add a "main guard" [0]
* Look at string formatting methods, they might make your URL-building nicer [1][2]
* The removing of the logo would also work with ImageDraw[3] from PIL, no need for numpy
* look into urllib2 (also in the standard library), with urllib2.urlopen you can avoid creating a temporary file on disk (+ it is generally the recommended interface in the stdlib) [4]
* look at os.path.join [5] to combine file path components
* in the loop in Line 45 you are overwriting the name file, which is the inbuild file datatype. If you tried to use that later in the function it wouldn't work anymore...
[0] http://stackoverflow.com/a/19578335
[1] https://docs.python.org/2.7/tutorial/inputoutput.html#fancie...
[2] https://www.python.org/dev/peps/pep-3101/
[3] http://omz-software.com/pythonista/docs/ios/ImageDraw.html
[4] https://docs.python.org/2/library/urllib2.html
[5] https://docs.python.org/2/library/os.path.html#os.path.join
There is also a newer PIL fork, having ones code work with that also is IMHO good form (haven't checked if yours does): https://pillow.readthedocs.org/en/3.0.x/
I will pick up on these and let you know by email if I have any further queries.