Advertisement
Guest User

apod_ch

a guest
Sep 6th, 2010
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. #!/bin/bash
  2. lastRan=$(head ran)
  3. today=$(date +%j)
  4. if [ $lastRan -ne $today ]; then
  5.  
  6. url=http://apod.nasa.gov/apod/
  7. prefix=ch_
  8. if [ $# -gt 0 ]; then
  9.   url=$1
  10. fi
  11. imageurl=`curl $url 2> /dev/null | grep "<a href=\"image" | cut -d\" -f2`
  12. filename=`echo $imageurl | cut -d/ -f3`
  13. curl http://apod.nasa.gov/apod/$imageurl -o $filename 2> /dev/null
  14. size=`identify $filename | cut -d' ' -f3`
  15.  
  16. cp $filename ./apod/$filename
  17.  
  18. convert chblank.png -resize $size tmp_resize_chblank.png
  19. composite -gravity south tmp_resize_chblank.png $filename $prefix$filename
  20.  
  21. rm tmp*
  22.  
  23. #echo "Composite image created: $prefix$filename"
  24. feh --bg-scale ./$prefix$filename
  25.  
  26. date +%j > ran
  27. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement