#!/usr/bin/perl -w
# Copyright 2005 Jean-Michel Fayard jmfayard_at_gmail.com
#
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public
#   License as published by the Free Software Foundation; either
#   version 2 of the License, or (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; see the file COPYING.  If not, write to
#   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#   Boston, MA 02111-1307, USA.

# Changelog:
#	17/01/2005  Initial version

use strict;
use Image::Kimdaba;

# As an example, I wanted to always have my best pictures 
# (I set the keyword +++ for that) in a specified folder
# linked to the folder where the KDE screensaver take
# his pictures for the diaporama
my $folder=getRootFolder();
parseDB( "$folder" );

my @BESTOF=matchAnyOption( "Keywords"=> ["+++"] ) ;
@BESTOF=sort @BESTOF;
my $destdir = "/autre/Photos_special/+++/WallPapers";
unlink <$destdir/*> ;
for my $i (0..@BESTOF-1) {
    (my $dest = $BESTOF[$i] ) =~ s/^.*\./$i./;
    symlink $BESTOF[$i], "$destdir/$dest";
}
