.
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; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
ImageMagick is Copyright (C) 1999-2004 ImageMagick Studio LLC.
"
exit 0
fi
if [ ! -e ./sphinx.cfg ]
then
echo "Error: configuration file sphinx.cfg not found"
exit 1
fi
source ./sphinx.cfg
if [ ! -e $DESCRIPTOR_FILE ]
then
echo "Error: descriptor file $DESCRIPTOR_FILE not found"
exit 1
fi
if [ ! -e $TH_DIR ]
then
mkdir $TH_DIR
fi
set +o noclobber
rm -f $INDEX_FILE $TH_INDEX_FILE
# Create indexes' header
echo "
Photographs by $AUTHOR
$HEAD_TAGS
Photographs by $AUTHOR
" | tee $TH_INDEX_FILE > $INDEX_FILE
# Read the descriptor file, create thumbnails, complete indexes
line=""
n_pic=0
current_title="Top"
while [[ "$line" != EOF* ]]
do
read line
if [[ "$line" == EOF* ]]
then
break
elif [[ $line == TITLE\ * ]]
then
# Title of a section
current_title=${line#TITLE }
echo "
$current_title
" | tee -a $TH_INDEX_FILE >> $INDEX_FILE
else
# Picture description
file_list[$n_pic]="${line%% *}"
descr_list[$n_pic]="${line#* }"
title_belong[$n_pic]="$current_title"
echo "${descr_list[$n_pic]}
" >> $INDEX_FILE
echo "" >> $TH_INDEX_FILE
echo -n "$PIC_DIR${file_list[$n_pic]}: "
if [ ! -e $PIC_DIR${file_list[$n_pic]} ]
then
echo "(Warning) picture file does not exist"
else
if [ -e $TH_DIR$TH_PREFIX${file_list[$n_pic]} ]
then
echo "thumbnail already exists"
else
echo "generating thumbnail"
convert -antialias -geometry 120x60 $PIC_DIR${file_list[$n_pic]} $TH_DIR$TH_PREFIX${file_list[$n_pic]}
fi
fi
let n_pic++
fi
done < $DESCRIPTOR_FILE
echo "
thumbnails
" >> $INDEX_FILE
echo "
no thumbnails
" >> $TH_INDEX_FILE
echo "
$MESSAGE
Album automatically created by sphinx v$VERSION on $DATETIME.
" | tee -a $TH_INDEX_FILE >> $INDEX_FILE
# Create frames
let last_pic=$n_pic-1
for ((i=0; i < n_pic; i++))
do
if [ "$i" -eq 0 ]
then
prev_link=""
next_link=""
elif [ "$i" -eq "$last_pic" ]
then
prev_link=""
next_link=""
else
prev_link=""
next_link=""
fi
echo "
${title_belong[$i]}: ${descr_list[$i]} - Photograph by $AUTHOR
$HEAD_TAGS
$prev_link
$next_link
$prev_link
$next_link
" > ${file_list[$i]/%.*/.html}
done
chmod 644 *.html $PIC_DIR* $TH_DIR*
chmod 711 $PIC_DIR $TH_DIR
exit 0