--- scripts/pgallery/src/pgallery.sh 2012/08/28 08:43:05 1.4 +++ scripts/pgallery/src/pgallery.sh 2012/08/28 10:44:41 1.5 @@ -5,7 +5,7 @@ # can do whatever you want with this stuff. If we meet some day, and you think # this stuff is worth it, you can buy me a beer in return Aron Schlesinger # -# $Paefchen: scripts/pgallery/src/pgallery.sh,v 1.3 2012/08/28 08:27:25 as Exp $ +# $Paefchen: scripts/pgallery/src/pgallery.sh,v 1.4 2012/08/28 08:43:05 as Exp $ # ARG_TITLE="PGallery" @@ -19,13 +19,14 @@ ARG_INDEX="index.html" ARG_DIR="." ARG_UPDATE=1 ARG_COPYRIGHT="© $(date +%Y)" +ARG_INFOFILE="pgallery.txt" BIN_CONVERT="/usr/local/bin/convert" BIN_EXIFAUTOTRAN="/usr/local/bin/exifautotran" BIN_IMGINFO="/usr/local/bin/imginfo" MKAKEFILE=".htmakefile" -VERSION="pgallery-1" +VERSION="pgallery-1.1" # # usage() @@ -52,6 +53,10 @@ Options: -u quality quality from thumbnail images 0-100% (default: $ARG_BIGQALITY) -v print version -C copyright copyright (html) string (default: $ARG_COPYRIGHT) + -I file info text file for pgallery. info file paras prefered. + the syntax of the file is MAKE(1) + supported variable: TITLE COPYRIGHT INDEX FILETYPES TNSIZE + TNQALITY BIGSIZE BIGQALITY -U no update, new calculation of all images. normally only new and modified images will calculated USAGE @@ -416,6 +421,10 @@ do ARG_COPYRIGHT=$1 shift ;; + -I) + ARG_INFOFILE=$1 + shift + ;; -U) ARG_UPDATE=0 ;; @@ -429,6 +438,21 @@ do esac done +# parese info file +if [ "$ARG_INFOFILE" != "" ] +then + test -f $ARG_INFOFILE || err "info file not found \`\`$ARG_INFOFILE''" + for n in TITLE COPYRIGHT INDEX FILETYPES TNSIZE TNQALITY BIGSIZE BIGQALITY + do + v=$(make -f $ARG_INFOFILE -V$n) + test "$v" = "" && continue + eval "ARG_$n='$v'" + done +fi + +echo $ARG_COPYRIGHT +exit + MY=$(get_my_path) cd "$ARG_DIR" || exit 1 @@ -457,6 +481,46 @@ echo test $(echo $FLIST | wc -w) -eq 0 && err "error: no image found in \`\`$ARG_DIR''" +# find new and to update images +FLIST_NEW= +FLIST_UPDATE= +echo "all: tns" > $MKAKEFILE +targets="" +for file in $FLIST +do + tn="${file}.tn.jpg" + if [ ! -f $tn ] + then + FLIST_NEW="$FLIST_NEW $file" + continue + fi + + targets="$targets $tn" + ( + cat <> $MKAKEFILE +done +echo "tns: $targets" >> $MKAKEFILE +FLIST_UPDATE=$(make -f $MKAKEFILE) +rm $MKAKEFILE + +# update and no new and update images found +if [ $ARG_UPDATE -eq 1 -a "$FLIST_NEW" = "" -a "$FLIST_UPDATE" = "" ] +then + echo nothing to do + exit 1 +fi + +if [ $ARG_UPDATE -eq 1 ] +then + echo new images: $FLIST_NEW + echo update images: $FLIST_UPDATE +fi +exit + # Create make file to rotate und convert all big and thumbnails. # Is needed to define the new real image sizes. echo "all: tns" > $MKAKEFILE @@ -476,7 +540,7 @@ do fi ( - cat <