# change the app id to what you get once registeringĪppid="fYFXXzZMnXm7MQXXqXX1OpXhrAdXXXZd9qA84XXX" # you can choose to download the daily picture In case of not getting an image the script will take a random image from the directory.Copying the image to a directory on your PC.Turning the returned JSON into data that Python can use.Don't use the above id since it's only for demonstration purposes.The app id that you'll get is going to be similar to this one: fY2SW6ZMnXXXXXXXVl31OpXXX8dcbMZXXXX8TG34 To consume it you need to register at: were you'll find a unique identifier, app id, which identifies the app to the service provider. From which we will extract the URL of the image that we are going to copy to a folder on our Linux system. The script downloads the daily pictures from NASA's API. Here I share my way of making the task work. The solution that I came up with is a short Bash script that downloads the daily picture from NASA's API as well as running the script with the crontab utility on my computer. I also wanted the computer to do the boring stuff for me. I wanted to set these pictures as the background for my Linux computer and also to update the display on a daily basis. You can see for yourself in their archive Astronomy Picture of the Day.Īnother example, is this stunning picture from the 31th of July 2020: NASA provides astonishing astronomy pictures on a daily basis. Its code can be consulted at GitHub and use respecting the Apache 2.Download NASA's astronomy picture of the day and set as background on a Linux machine Download NASA's astronomy picture of the day and set as background on a Linux machine Open the file /etc/rc.local with nano: $ sudo nano /etc/rc.localĮdit it by adding the desired command before exit 0, for example to download the APOD add nasa-wallpaper -T gnome -a ||exit 1.Īnother positive point of this application is its open nature. You can also consult the reference online: Run at startup To know all the possible options write $ man nasa-wallpaper o $ nasa-wallpaper -h. It is possible to define advanced parameters such as changing the API key or searching in various fields such as the photographer who took the photo. nasa-wallpaperĪll of the following examples will assume a GNOME desktop environment.Īs I said before, you can choose where to download the background from (APOD and NASA Library), so there are two main options: APODīasic syntax: $ nasa-wallpaper -T gnome -a Download the image of the day of the day itself (logically).Ĭhoose the APOD of a specific day, for example March 27, 1999: $ nasa-wallpaper -d -T gnome -a NASA Image Libraryīasic syntax: $ nasa-wallpaper -T gnome -n Download a random image from the NASA repository.ĭownload a random image with the keyword earth: $ nasa-wallpaper -w earth -T gnome -n.ĭownload a random image with the keyword March and search from the year 2016 onwards: $ nasa-wallpaper -w mars -y 2016 -T gnome -n.ĭownload a random image with the keyword galaxy, looking for the year 2015 onwards and that is taken from California: $ nasa-wallpaper -w mars -y 2015 -l california -T gnome -n. Give execute permissions to the file: $ chmod -x. The program is hosted by the AUR, so just run $ yaourt -S nasa-wallpaper Compiling from code Go to the folder where you downloaded the file and run $ sudo dpkg -i nasa-wallpaper_1.0_all.deb Arch Linux deb file from, at the time of publishing this blog the program is in version 1.0, so the file name is nasa-wallpaper_1.0_all.deb The supported desktop environments are GNOME, Cinnamon, MATE, LXDE, and XFCE for the moment.ĭownload the. In addition, the output of the program always writes data on what the image means or represents, to contribute to astronomical dissemination (in English).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |