[Digikam-users] Wallpapers from Digikams collections!
Philipp Matthias Hahn
pmhahn at titan.lahn.de
Fri Jun 20 10:02:36 BST 2008
Hello!
On Thu, Jun 12, 2008 at 05:39:03PM +0200, Philipp Matthias Hahn wrote:
> Since I'm not subscribed to his mailing list, please cc: me on replies.
>
>
> Is there some easy way to _automatically_ change my KDE wallpaper
> (background image), choosing from the collections of Digikam?
>
> I have several GiBs of photos and rarely find time to review them. What
> I would like is some way to automatically replace the background image
> with another photo from the collections I manage with digikam. KDEs
> simple slide show doesn't work, since I have a large hierarchy of
> directories. I'd either have to regularly add new directories to it's
> list or would have to place all images in a single directory.
>
> Bonus points to some solution, where I could specify some filters like
> 'only pictures rates with more than 2 stars' or 'only pictures tagged
> with x,y or z'.
The hint with using the sqlite3 command-line tool helped. I'll attach my
solution, so others can use it or extend it. Both files go to
$HOME/.kde/share/apps/kdesktop/programs/
The SQL-query is currently hard-coded to "two stars or above".
BYtE
Philipp
--
/ / (_)__ __ ____ __ Philipp Hahn
/ /__/ / _ \/ // /\ \/ /
/____/_/_//_/\_,_/ /_/\_\ pmhahn at titan.lahn.de
-------------- next part --------------
#! /bin/sh
#
# Depends: imagemagick sqlite3 sed
# Recommends: digikamm
# Description: Randomly choose background images from digikam photo-collections
#
set -e
RC="${HOME}/.kde/share/config/digikamrc"
if ! test -f "${RC}"
then
echo Error: No \"${RC}\" found.
exit 1
fi
eval BASE=`sed -ne 's/Album Path\[.*\]=//p' "${RC}"`
if ! test -d "${BASE}"
then
echo Error: Album Path \"${BASE}\" does not exist.
exit 1
fi
DB="${BASE}/digikam3.db"
if ! test -f "${DB}"
then
echo Error: \"${DB}\" does not exist.
exit 1
fi
if test "$#" -ne 3
then
echo Usage: $0 width height filename
exit 1
fi
W="${1}"
H="${2}"
F="${3}"
#exec >/tmp/digikam.log 2>&1 ; echo $PWD $0 $* ; set -x
SEQ=100
for i in `seq "${SEQ}"`
do
PHOTO=`sqlite3 "${DB}" 'SELECT P FROM (
SELECT A.url || "/" || I.name AS P, random() AS R
FROM Images AS I JOIN
Albums AS A ON I.dirid=A.id JOIN
ImageProperties AS P ON I.id=P.imageid
WHERE P.property="Rating" AND
P.value>=2
ORDER BY R
LIMIT 1
OFFSET 1
);'`
FILE="${BASE}${PHOTO}"
if test -f "${FILE}"
then
exec convert "${FILE}" -resize "${W}x${H}" -size "${W}x${H}" xc:black +swap -gravity center -composite "PNG:${F}"
fi
done
echo Error: No image found after ${SEQ} iterations.
exit 1
-------------- next part --------------
[KDE Desktop Program]
Comment=KDE Digikam Desktop
Comment[de]=KDE-Digikam-Arbeitsfläche
Executable=digikam
Command=$HOME/.kde/share/apps/kdesktop/programs/digikam %x %y %f
PreviewCommand=$HOME/.kde/share/apps/kdesktop/programs/digikam %x %y %f
Refresh=15
More information about the Digikam-users
mailing list