Random astronomy picture of the day

Not sure where to put this, I found a script on t'internet for downloading today's APOD and setting it as the gnome background.  I then modified it to:
a) fix it to work with gif images as well as jpgs.
b) add xfce4 compatibility
c) get a random image instead of todays image
#!/bin/bash
#Filename: apodwallpaper
#Location: ${HOME}/.bin
#Purposes: Downloads NASA Astronomy Picture of the Day and displays it as the
# GNOME background
#Author(s): acvwJosh of Ubuntu Forums, modified by Colin Dean <http://cad.cx>
## Modified by deicist of ARCH linux forums: added xfce4 support, added .gif support, added random support
## requires athena-jot package from AUR
##random stuff goes here
##start date is a cutoff year to get images after. I use this because most pre-2000 images are too small to make good desktops
STARTDATE="2000";
NOW=$(date +%Y);
randYear=$(jot -r 1 $STARTDATE $NOW);
randMonth=$(jot -r 1 01 12);
randDay=$(jot -r 1 01 28);
getDate=$(date -d $randYear/$randMonth/$randDay +%y%m%d);
#change this if you want the image to be in a different directory
FILENAME=apodwallpaper
APODWALLPAPER=${HOME}/.${FILENAME}
#remove directory if it exists
rm -rf ${APODWALLPAPER}
mkdir -p ${APODWALLPAPER} && cd ${APODWALLPAPER}
# download image from apod site
wget -A.gif -A.jpg -R.txt -r -l1 --no-parent -nH http://apod.nasa.gov/apod/ap$getDate.html
# move image from obscure folder to main folder, rename image
find ./apod -name "*.gif" -or -name "*.jpg" | while read line ; do
mv "$line" "${FILENAME}.jpg"
done
#######uncomment next 3 lines for gnome
#gconftool-2 -t string -s /desktop/gnome/background/picture_filename "blank.jpg"
#gconftool-2 -t string -s /desktop/gnome/background/picture_filename "${APODWALLPAPER}/${FILENAME}.jpg"
#gconftool-2 -t string -s /desktop/gnome/background/picture_options "zoom"
######uncomment next line for xfce4 -primary display
#xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s ""
#xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s "${APODWALLPAPER}/${FILENAME}.jpg"
#xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-style -s 3
#uncomment next line for xfce4 -secondary display
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor1/image-path -s ""
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor1/image-path -s "${APODWALLPAPER}/${FILENAME}.jpg"
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor1/image-style -s 3
# Uncomment ONE of the following for use with feh (thanks to SkonesMickLoud)
#feh --bg-tile "${APODWALLPAPER}/${FILENAME}.jpg"
#feh --bg-center "${APODWALLPAPER}/${FILENAME}.jpg"
#feh --bg-scale "${APODWALLPAPER}/${FILENAME}.jpg"
#feh --bg-seamless "${APODWALLPAPER}/${FILENAME}.jpg"
#get rid of cruft
rm -rf apod robots.txt
Last edited by deicist (2009-03-26 22:29:14)

If you'd like to add it, the following works with feh:
# Uncomment ONE of the following for use with feh:
#feh --bg-tile "${APODWALLPAPER}/${FILENAME}.jpg"
#feh --bg-center "${APODWALLPAPER}/${FILENAME}.jpg"
#feh --bg-scale "${APODWALLPAPER}/${FILENAME}.jpg"
#feh --bg-seamless "${APODWALLPAPER}/${FILENAME}.jpg"
Also, line 26 should read rm -rf ${APODWALLPAPER} as ${APODWALLPAPER} is a dir, and most users would (probably) want to avoid confirming the removal of it every time.
I also get this error, even though everything seems to work:
./apodwallpaper.sh: line 15: jot: command not found
./apodwallpaper.sh: line 16: jot: command not found
./apodwallpaper.sh: line 17: jot: command not found
Jot isn't in the repos or AUR, is there an alternative?
Last edited by SkonesMickLoud (2009-03-26 17:39:51)

Similar Messages

  • NASA's Astronomy Picture of the Day & iCal

    I have set up an automator workflow to have NASA's Astronomy Picture of the Day (APOD) as my desktop image. It would automatically change each day via iCal. AWSOME PICTURES, by the way.
    I have a snag . . . iCal isn't running the workflow . . . I had to use spotlight & click on the application to start the workflow today.
    To originally set this up, I selected "iCal Alarm" from the plug-in list so that Automator can create an appointment for this workflow as a daily event. I chose 3:00 AM as the start time.
    I checked iCal preferences, and found the "day" start & end times where 8 AM & 6 PM. Could this be the reason why the workflow didn't start when I turned my computer at 5 AM today?
    Also, I'm Wireless, & connect to the internet manually each time . . . I'm wondering if the workflow gets snagged because I don't have an internet connection automatically with start-up?
    KenMackay
    1.25 GHz Power Mac G4; 1.33 GHz G4 iBook   Mac OS X (10.4.3)  

    The Automator, as plug in, and iCal works perfectly at the alotted time. The only snag is that I have to be internet connected at the time the program is sheduled to run. I am wireless, & opt to manually "click in" to the internet at each start up. So, if I start up the computer
    ii after the scheduled workflow start
    , the Automator kicks in immediately to play catch up, but quites as soon as it can't connect to the URL . I can't connect to the internet fast enough, manually, to accommodate the Automator workflow.
    I'm wondering if I have my wireless connection
    ii connect
    at start up, Automator won't be interupted & the APOD will appear at start up, even if I start my computer a little
    ii after
    the iCal workflow start.
    Kenmackay
    1.25 GHz Power Mac G4; 1.33 GHz G4 iBook   Mac OS X (10.4.2)  

  • Grab picture of the day with Spry?

    Hi,
    I want to grab the picture of the day from:
    nasa APOD site
    and make that picture spry-fade in on my web page. Since I
    don't know how big the picture will be I need the frame to auto
    size or use spry shrink/grow to set pixel size??
    Not sure how to proceed.

    You can only request AJAX data from the same domain as your
    Spry page.
    Therefore, you will need to use a server side component to
    get the APOD image and then use that for your data source.
    You can use their RSS feed to get the URL, but they don't
    provide the image height and width, so you will have to make it a
    standard size, or let your CSS layout autosize for it.

  • Picture of the day (Thread)

    Please share your pictures of the day!
    You can share as much as you like. You can share your music as pictures, your trip, your bike etc.
    For great start, my picture is here!
    Houkkalammi lake in Lempäälä, Finland. 16.11.2014.

    Hey there.
    I enjoy a lot to make photos... so here my another set.
    1. Spotify in our Municipality center / commune :) Spotify <3
    2. Our village at it's best ;)
    Don't you think Finland is cozy place? :P
    Greetz!

  • Bing Animated pictures of the day won't run on firefox, picture is different. Why?

    After a Firefox update, somewhere in the last 3 to 4 months when it comes up on my home page, which is Bing, if the picture of the day is a short video loop, which occurs 3 to 5 times a month, the video will not play. I have activated the control that says if a picture is a video, play it but this makes no difference. I have checked this out by running Internet Explorer, which also has Bing as my home page, and the short video loops run. I have also noticed that if the picture of the day is a video loop, the picture on Firefox is a different view of the same photo that is on Internet Explorer besides also not animating. Why is this? The latest video loop on Bing was yesterday (February 11). It did not animate on Bing and is a different view of the scene.

    Did you check the Bing settings for the home page?
    *http://www.bing.com/account/homepage
    Videos and panoramas:
    *Choose what happens when the homepage image is a video or panorama.
    **Play automatically
    **Don't play automatically
    **Show a still image

  • Picture of the Day

    Does anyone know what happened to the app "Picture of the Day?"  I believe it was a National Geographic app, but it disappeared from everywhere..thanks for the help!

    It may have been removed by the creator or the Apple iTunes team for various reasons.

  • Contacts randomly deleting themselves throughout the day ios7

    With the new update of iOS 7.0.3 it worked fine for a few days than one day it just randomly deleted my contacts and when i went to settings i saw my icloud had my settings turned off and i flipped it on and they all came back. this happened a few times and than it started to only delete the contacts that are over 5 or 6 months old or older (only keeping my recent contacts) than all my old ones would just randomly pop back up. Now its starting to delete them all and i could go to settings click icloud turn off my contacts switch and turn it back on and they would come back in a few minutes. Now they are just all gone, all my text messages and conversations are still there and instead of the name above the convo its just their number. I logged onto my icloud from my laptop and my contacts are still there they just wont sync back up with my phone. I dont understand why they would delete themselves in the first place. I'm out of ideas on this anyone else have any input?

    I'm syncing to iCloud. I've experienced the bug where iCloud will turn itself off in settings and it will appear that you've lost all of your contacts until you turn it back on, but this is different. Several times a week for the last 3 weeks or so I'll receive an iMessage from someone who is a contact and regularly messages me, and their message will show up as coming from a phone number.

  • My Iphone 4 32GB started having this issue when I downloaded the 2 last 6.1.X... VOICE CONTROL pops-up even when I sleep and calls random people just by the sound of the snoring... in FACETIME even more annoying. I confirm that it does this day and night

    My Iphone 4 32GB started having this issue when I downloaded the 2 last 6.1.X... VOICE CONTROL pops-up even when I sleep and calls random people just by the sound of the snoring... in FACETIME even more annoying. I confirm that it does this day and night

    Turn off Voice Control.
    Otherwise, basic troubleshooting from the User's Guide is reset, restart, restore (first from backup then as new).

  • My MacBook Pro got wet and I lost all of my childs photos from the day she was born. Is there anyway I could get these pictures back from my iCloud? I actually care more for getting the photos back than I do my laptop. Please help! Thank you!

    My MacBook Pro got wet and I lost all of my childs photos from the day she was born. Is there anyway I could get these pictures back from my iCloud? I actually care more for getting the photos back than I do my laptop. Please help! Thank

    Welcome to the Apple community khnkOliver.
    I assume these photos, or at least not all of them weren't in photo stream.
    You should be able to recover your photos from a back up.

  • Entire days of pictures are not loaded on iCloud, while most of the days are loaded. Weeks has passed, while I was connected to wireless, so I dont understand why still emtire days are missing...

    Entire days of pictures are not loaded on iCloud, while most of the days are loaded. Weeks has passed, while I was connected to wireless, so I dont understand why still entire days are missing...

    I noticed an entire series of its always sunny in philadelphia is missing from my apple tv "purchased" section where i can stream it directly from itunes...I just purchased the new season and not showing at all

  • TS4436 how do I find out the day I took a picture

    how do I find out the day I took a picture?

    If you mean the metadata embedded to a phone, many photo applications support this, such as iPhoto, Adobe Lightroom.

  • Why does my 4s shut off randomly throughout the day

    My 4s has been shutting off randomly through out the day; this happen 3 - 6 times daily.....help

    Most likely it's broken, but it MAY have a corrupt operating system. So try Restoring it using iTunes.

  • I want to write a script or Automator workflow/app that emails a random shortcut of the day to three recipients. The source is from an Excel spreadsheet. One column is the shortcut, and the second column is the definition. Anyone have experience?

    I want to write a script or Automator workflow/app that automatically emails a random shortcut of the day to three recipients. The source is from an Excel spreadsheet. One column is the shortcut, and the second column is the definition. Anyone have similar experience and know that this would work?

    I have had a first stab at the script, below.  It uses a file to store the shortcuts and command [descriptions].  You should be able to see from the script annotations how to add a new one.  (I populated 1-4 with real data, but got lazy after that, so you have a few placeholders to work with first.
    As I have noted, once you are happy that you have all the data in the file, you can comment out part of the script for ongoing use.  (BTW, my reluctance to use Excel is that I don't currently have it installed and I don't want to offer wrong advice.  If you have Numbers, I do have that and could probably modify to work with a spreadsheet from there.  This might be especially useful if you have the data already sitting in Excel.)
    A few things came-up whilist I was writing the script:
    1.     Currently, all recipients will not only get the same tip at the same time, but they will see the names and email addresses of the others who receive them.  It is possible to modify this.
    2.     I have added a property gRandomCheck which keeps track of which shortcut has already been used (since the last time the script was compiled.  This will prevent the same tip being sent more than once.    When all tips have been sent once, the script will alert you and not send anything until reset.  It does not check on a per-addressee basis (which would be a refinement).  (If you add a new addressee at this stage, the whole process will start again, and you may not really want this to be the behaviour.)
    3.     The way that I have built the list, commandList, is deliberately cumbersome - it's for the sake of clarity.  If you prefer, you can construct the whole list as {{shortcut:"X", command:"X"}, {shortcut:"Y", command:"Y"}}
    Have a look - I am sure you will have questions!
    SCRIPT STARTS HERE  Paste the following lines (thru the end) into a new AppleScript Editor document and press RUN
    --The property gRandomCheck persists between runs and is used to stop sending the same hint twice.
    property gRandomCheck : {}
    --I am defining a file on the desktop.  It doesn't have to be in this location
    set theFolder to path to desktop
    set commandFile to (theFolder as text) & "CommandFile.csv"
    --(* Unless you need to change the file contents you do not need to write to it each time.  Remove the "--" on this line and before the asterisk about 18 lines below
    --Follow this format and enter as many records as you like on a new line - each with a unique name
    set record1 to {shortcut:"Z", command:"Undo"}
    set record2 to {shortcut:"R", command:"Record"}
    set record3 to {shortcut:"⇧R", command:"Record Toggle"}
    set record4 to {shortcut:"⌘.", command:"Discard Recording & Return to Last Play Position"}
    set record5 to {shortcut:"X", command:"x"}
    set record6 to {shortcut:"X", command:"x"}
    set record7 to {shortcut:"X", command:"x"}
    set record8 to {shortcut:"X", command:"x"}
    set record9 to {shortcut:"X", command:"x"}
    set record10 to {shortcut:"X", command:"x"}
    set record11 to {shortcut:"X", command:"x"}
    set record12 to {shortcut:"X", command:"x"}
    set record13 to {shortcut:"X", command:"x"}
    --Make sure you add the record name before randomCheck:
    set commandList to {record1, record2, record3, record4, record5, record6, record7, record8, record9, record10, record11, record12, record13}
    --This part writes the above records to the file each time.
    set fileRef to open for access commandFile with write permission
    set eof of fileRef to 0
    write commandList to fileRef starting at eof as list
    close access fileRef
    --remove "--" here to stop writing (see above)*)
    --This reads from the file
    set fileRef to open for access commandFile with write permission
    set commandList to read fileRef as list
    close access fileRef
    --Here's where the random record is chosen
    set selected to 0
    if (count of gRandomCheck) is not (count of commandList) then
              repeat
                        set selected to (random number from 1 to (count of commandList))
                        if selected is not in gRandomCheck then
                                  set gRandomCheck to gRandomCheck & selected
                                  exit repeat
                        end if
              end repeat
    else
              display dialog "You have sent all shortcuts to all recipients once.  Recompile to reset"
              return
    end if
    --This is setting-up the format of the mail contents
    set messageText to ("Shortcut: " & shortcut of record selected of commandList & return & "Command: " & command of record selected of commandList)
    tell application "Mail"
      --When you're ready to use, you probably will not want Mail popping to the front, so add "--" before activate
      activate
      --You can change the subject of the message here.  You can also set visible:true to visible:false when you are happy all is working OK
              set theMessage to (make new outgoing message with properties {visible:true, subject:"Today's Logic Pro Shortcut", content:messageText})
              tell theMessage
      --You can add new recipients here.  Just add a new line.  Modify the names and addresses here to real ones
                        make new to recipient with properties {name:"Fred Smith", address:"[email protected]"}
                        make new to recipient with properties {name:"John Smith", address:"[email protected]"}
      --When you are ready to start sending, remove the dashes before "send" below
      --send
              end tell
    end tell

  • TS2755 Earlier in the day I could send pictures via iMessage and now I can't.  Why?

    I don't understand what is going on with my imessage.  I sent a picture on my iphone and ipad mini earlier in the afternoon.  Now here it is hours later and I can't send a picture on either device.  What the heck is going on and why can I only send texts.  I had to log off wifi on my phone just to send a freaking photo.  HELP!
    Mike

    michaelb18 wrote:
    I had to log off wifi on my phone just to send a freaking photo.
    Mike
    I think that explains it.
    Either you're on a different WiFi setup or if you're on the same one, it has lost some of the quality (speed and/or clarity) it had earlier in the day.
    Something about your WiFi setup is now different.

  • Motorola Krave ZN4 keeps saying Verizon Wireless randomly throughout the day

    I have a Motorla Krave ZN4 that keep saying Verizon Wireless randomly throughout the day since my daughter played with my phone. I can't figure out what she hit to cause this so I can make it stop.

    nice one,, here I was looking at maybe the wall paper / background on display was removed  and the standard Verizon Logo came back up as the default.. ... thank you . Snn5 will step back and let  you handle.

Maybe you are looking for