changepaper.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/sh
  2. # This Script downloads National Geographic Photo of the day, and sets it as desktop background (gnome, unity)
  3. # Copyright (C) 2012 Saman Barghi - All Rights Reserved
  4. # Permission to copy, modify, and distribute is granted under GPLv3
  5. # Last Revised 22 May 2019
  6. #######################
  7. # For feh, we need display set properly
  8. export DISPLAY=:0.0
  9. export XAUTHORITY=/home/powellc/.Xauthority
  10. # Get daily Astrobin PotD
  11. BASEDIR="$HOME/var/inbox/astrobin/"
  12. python3 ~/.bin/get_astrobin_potd.py
  13. date=$(date '+%Y-%m-%d')
  14. #set the current image as wallpaper
  15. feh --bg-scale $BASEDIR/$date.jpg
  16. #link slim background to new image
  17. rm /usr/share/slim/themes/default/background.jpg
  18. ln -s $BASEDIR/$date.jpg /usr/share/slim/themes/default/background.jpg
  19. echo "Background and slim wallpaper set using Astrobin PotD"
  20. ####### OLD Picture fetching for NatGeo and NASA APoD
  21. #######
  22. #Change directory to where the script resides.
  23. #BASEDIR="$HOME/var/inbox/ng_photos"
  24. #cd $BASEDIR
  25. #######################
  26. #getting the image URL
  27. #img="$(curl https://www.nationalgeographic.com/photography/photo-of-the-day/ -s | grep -oP '(?<="twitter:image:src" content=")\K[^"]*')"
  28. #
  29. ## Check to see if there is any wallpaper to download
  30. #if [ -n "$img" ]
  31. #then
  32. # img_base=`echo $img | cut -d/ -f 5`
  33. # img_md5=`echo -n $img_base | md5sum | cut -f1 -d" "`
  34. # img_file="$img_md5.jpg"
  35. #
  36. # curl "$img" > $img_file
  37. # #set the current image as wallpaper
  38. # #feh --bg-scale $BASEDIR/$img_md5.jpg
  39. # ##link slim background to new image
  40. # #rm /usr/share/slim/themes/default/background.jpg
  41. # #ln -s $BASEDIR/$img_md5.jpg /usr/share/slim/themes/default/background.jpg
  42. #else
  43. # echo "No Wallpaper today"
  44. #fi
  45. # Then grab our APOD image and store it for now
  46. #Change directory to where the script resides.
  47. #BASEDIR="$HOME/var/inbox/apod_photos"
  48. #cd $BASEDIR
  49. ########################
  50. #
  51. ## Get the APoD image from NASA
  52. #img="$(curl https://api.nasa.gov/planetary/apod\?api_key=AdfgdnmmInYgpDMEq3ShMLKjJ7DZ7jyUcgLHWdgw | jq .hdurl | tr -d \")"
  53. #
  54. ##check to see if there is any wallpaper to download
  55. #if [ -n "$img" ]
  56. #then
  57. # img_file=`echo $img | cut -d/ -f 7 | tr -d \"`
  58. # curl $img > $img_file
  59. # #set the current image as wallpaper
  60. # #feh --bg-scale $BASEDIR/$img_file
  61. # ##link slim background to new image
  62. # #rm /usr/share/slim/themes/default/background.jpg
  63. # #ln -s $BASEDIR/$img_file /usr/share/slim/themes/default/background.jpg
  64. #else
  65. # echo "No Wallpaper today"
  66. #fi