Last active
June 24, 2018 07:55
-
-
Save fmarot/9e7f8af34ff784d1fc5fedf44472b73b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#If we do not sleep, the network is not available :( => we should use systemd !!! | |
sleep 8 | |
# inspired by http://disq.us/p/1anwvre | |
# requires to set wallpaper mode as slideshow from ~/wallpaper | |
echo "`date`" >> getBingWallpaper.log | |
cd $(dirname $0) | |
img=$(wget -qO - https://www.bing.com | grep -o "url:.*1920x1080.jpg" | cut -d'"' -f2) | |
[ -z "$img" ] && exit 1 | |
fname=`basename $img` | |
if [ ! -f ~/wallpaper/$fname ]; then | |
echo "file ~/wallpaper/$fname does not exist... yet ;)" | |
echo "file ~/wallpaper/$fname does not exist... yet ;)" >> getBingWallpaper.log | |
wget -P /tmp/ -qN https://www.bing.com$img || exit 1 | |
rm ~/wallpaper/*.jpg | |
mv /tmp/$fname ~/wallpaper | |
else | |
echo "file ~/wallpaper/$fname already exists. Not downloading again..." | |
echo "file ~/wallpaper/$fname already exists. Not downloading again..." >> getBingWallpaper.log | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
2018-06-24 new compatibility with Bing having now more than one resulting image returned by wget command