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 echo Dbus fixed OK
} }
# please install libnotify-bin to popup notification # please install libnotify-bin to popup notification
function notify { function notify {
if [[ -e /usr/bin/notify-send ]] if [[ -e /usr/bin/notify-send ]]
@ -42,13 +43,20 @@ function notify {
fi fi
} }
fileprefix=$HOME/Images/bonjourmadame-wp- dirprefix=$HOME/Images
fileprefix=$dirprefix/bonjourmadame-wp-
todaywp=$fileprefix$(date +%y-%m-%d-%H-%M).jpg todaywp=$fileprefix$(date +%y-%m-%d-%H-%M).jpg
while [ $(chkinternet) != "1" ]; do sleep 15; done while [ $(chkinternet) != "1" ]; do sleep 15; done
echo Internet connection OK 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 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 echo Photo downloaded OK
@ -59,6 +67,9 @@ fixdbus
if [[ -e /usr/bin/xfconf-query ]] if [[ -e /usr/bin/xfconf-query ]]
then then
xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s $todaywp 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 ]] elif [[ -e /usr/bin/gconftool-2 ]]
then then
gconftool-2 --type string --set /desktop/gnome/background/picture_filename $todaywp gconftool-2 --type string --set /desktop/gnome/background/picture_filename $todaywp