[Digikam-users] Change Gnome desktop background based on digikam db
cave-man
christian at cegetel.net
Sun Jul 4 08:27:50 BST 2010
Here is a shell script reading into digikam database and choose randomly a
Jpeg picture rated at least at 4 and put it to Gnome desktop background.
This script has to be launched into the gnome session of a user having
digikam.
Enjoy.
Christian.
#!/bin/bash
# Find Digikam database location
ficconfdigi=~/.kde/share/config/digikamrc
echo "digikam file: $ficconfdigi"
if [ ! -f $ficconfdigi ];
then
echo "Fichier Digikam non trouve"
exit 1
fi
echo "Fichier Digikam trouve"
dir_db=`grep "Database File Path" $ficconfdigi | awk 'BEGIN { FS = "=" }; {
print $2 }'`
dir_album=`grep "Album Path" $ficconfdigi | awk 'BEGIN { FS = "=" }; { print
$2 }'`
echo "database Dir : $dir_db"
echo "album Dir : $dir_album"
fic_db=`echo $dir_db/digikam4.db`
echo "database fic : $fic_db"
if [ ! -f $fic_d ];
then
echo "Database Digikam non trouve"
exit 1
fi
echo "Database Digikam trouve"
cd $dir_db
sql_cmd="from Images, ImageInformation, Albums where imageid=Images.id and
rating>=4 and album=Albums.id and format='JPG'";
img_choisie=`sqlite3 digikam4.db "select count(*) $sql_cmd; select
relativePath, Images.name $sql_cmd;" | sed "s/|/\//" | awk 'BEGIN { FS=
"="; srand(); }; NR==1 { tata=int(rand()*$1)+1; }; NR==tata { print $1 }'`
echo "img_choisie : $img_choisie"
full_chemin=`echo $dir_album$img_choisie`
echo "img_choisie : $full_chemin"
gconftool-2 -t str --set /desktop/gnome/background/picture_filename
"$full_chemin"
gconftool-2 -t str --set /desktop/gnome/background/picture_options "scaled"
--
View this message in context: http://digikam.1695700.n4.nabble.com/Change-Gnome-desktop-background-based-on-digikam-db-tp2277577p2277577.html
Sent from the digikam-users mailing list archive at Nabble.com.
More information about the Digikam-users
mailing list