Add astrobin image downloader

This commit is contained in:
Colin Powell
2019-12-04 23:13:59 -05:00
parent 71ad3aa36d
commit 3bbc7f6bb8
2 changed files with 47 additions and 8 deletions

View File

@ -16,16 +16,16 @@ img="$(curl https://www.nationalgeographic.com/photography/photo-of-the-day/ -s
#check to see if there is any wallpaper to download
if [ -n "$img" ]
then
img_base=`echo $img | cut -d/ -f 5`
img_md5=`echo -n $img_base | md5sum | cut -f1 -d" "`
img_base=`echo $img | cut -d/ -f 5`
img_md5=`echo -n $img_base | md5sum | cut -f1 -d" "`
img_file="$img_md5.jpg"
curl "$img" > $img_file
#set the current image as wallpaper
feh --bg-scale $BASEDIR/$img_md5.jpg
#link slim background to new image
rm /usr/share/slim/themes/default/background.jpg
ln -s $BASEDIR/$img_md5.jpg /usr/share/slim/themes/default/background.jpg
curl "$img" > $img_file
#set the current image as wallpaper
# feh --bg-scale $BASEDIR/$img_md5.jpg
# #link slim background to new image
# rm /usr/share/slim/themes/default/background.jpg
# ln -s $BASEDIR/$img_md5.jpg /usr/share/slim/themes/default/background.jpg
else
echo "No Wallpaper today"
fi
@ -52,3 +52,15 @@ then
else
echo "No Wallpaper today"
fi
BASEDIR="$HOME/var/inbox/astrobin/"
# use python script to get astrobin iotd
./get_astrobin_potd.py
date=$(date '+%Y-%m-%d')
#set the current image as wallpaper
feh --bg-scale $BASEDIR/$date.jpg
#link slim background to new image
rm /usr/share/slim/themes/default/background.jpg
ln -s $BASEDIR/$date.jpg /usr/share/slim/themes/default/background.jpg