improve getMadame.sh

This commit is contained in:
Mathieu Maret 2010-03-11 00:50:28 +01:00
parent de091dfe6a
commit cbca6906ae
1 changed files with 12 additions and 1 deletions

View File

@ -34,6 +34,7 @@ function fixdbus {
echo Dbus fixed OK
}
# please install libnotify-bin to popup notification
function notify {
if [[ -e /usr/bin/notify-send ]]
@ -42,13 +43,20 @@ function notify {
fi
}
fileprefix=$HOME/Images/bonjourmadame-wp-
dirprefix=$HOME/Images
fileprefix=$dirprefix/bonjourmadame-wp-
todaywp=$fileprefix$(date +%y-%m-%d-%H-%M).jpg
while [ $(chkinternet) != "1" ]; do sleep 15; done
echo Internet connection OK
if [[ ! -d $dirprefix ]]
then
echo "Creating $dirprefix";
mkdir $dirprefix;
fi
wget -O - http://www.bonjourmadame.fr | grep -Eo "(http://www.bonjourmadame.fr/photo/[^\"]+)|(http://[0-9]+.media.tumblr.com/tumblr[^\"]+)" | head -n 1 | wget -q -i - -O $todaywp
echo Photo downloaded OK
@ -59,6 +67,9 @@ fixdbus
if [[ -e /usr/bin/xfconf-query ]]
then
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s $todaywp
elif [[ -e /usr/bin/feh ]]
then
feh --bg-scale $todaywp
elif [[ -e /usr/bin/gconftool-2 ]]
then
gconftool-2 --type string --set /desktop/gnome/background/picture_filename $todaywp