--- scripts/pgallery/src/pgalleryindex.sh 2012/08/31 12:33:07 1.1 +++ scripts/pgallery/src/pgalleryindex.sh 2013/04/03 08:33:29 1.5 @@ -1,72 +1,41 @@ -#!/bin/sh +#!/usr/local/libexec/pgallerysh # -# THE BEER-WARE LICENSE 2012 +# THE BEER-WARE LICENSE 2012,13 + # wrote this file. As long as you retain this notice you # 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.17 2012/08/29 14:44:04 as Exp $ +# $Paefchen: scripts/pgallery/src/pgalleryindex.sh,v 1.4 2013/04/03 08:06:45 as Exp $ # -. $(dirname $0)/libpgallery +. /usr/local/libexec/libpgallery ARG_TITLE="PGallery" -#ARG_FILES= -#ARG_FILETYPES="jpg jpeg png gif tif tiff" ARG_TNSIZE="180" -#ARG_TNQALITY="70" ARG_BIGSIZE="950" -#ARG_BIGQALITY="90" ARG_INDEX="index.html" ARG_DIR="." -#ARG_UPDATE=1 ARG_COPYRIGHT="© $(date +%Y)" -#ARG_INFOFILE="" -#ARG_MAILTO="" -#ARG_MAILFROM="PGallery <${USER}@${HOST}>" -ARG_URL= -#ARG_EXIF="0x920a 0x829d 0x829a ISO 0x8827 / 0x010f - 0x0110" -#MKAKEFILE=".htmakefile" - # # usage() # usage() { cat <] | [-s ] ) [-d ] [-n ] - [-t ] [-u ] - [-b ] [-c ] [-l link] [-e ] - [-i ] [-C ] [-F ] [-T ] - [-U] | -h | -v +usage $0: ( [-d ] [-n ] [-i ] [-C ] [-I ] + | -h | -v Options: - -b size size from big images in pixel (default: $ARG_BIGSIZE) - -c quality quality from big images 0-100% (default: $ARG_BIGQALITY) -d dir gallery dir (default: $ARG_DIR) - -e exif list of tags in hex. (default: $ARG_EXIF) - see: http://www.exiv2.org/tags.html - -f files gallery images -h this page -i name index file name (default: $ARG_INDEX) - -l url gallery link -n name page title (default: $ARG_TITLE) - -s suffix list of suffix. if no \`\`-f'' defined, used to find images - in \`\`-d'' directoy. case insensitive - (default: $ARG_FILETYPES) - -t size size from thumbnail images in pixel (default: $ARG_TNSIZE) - -u quality quality from thumbnail images 0-100% (default: $ARG_BIGQALITY) -v print version -C copyright copyright (html) string (default: $ARG_COPYRIGHT) - -F from mail sender (default: $ARG_MAILFROM) - -I file info text file for pgallery. info file paras prefered. + -I config info text file for pgallery. info file paras prefered. the syntax of the file is MAKE(1) - supported variable: TITLE COPYRIGHT INDEX FILETYPES TNSIZE URL - TNQALITY BIGSIZE BIGQALITY MAILTO MAILFROM - EXIF - -T mailto send update infos to this address. if not set, no mail delivery - -U no update, new calculation of all images. - normally only new and modified images will calculated + supported variable: TITLE COPYRIGHT INDEX USAGE exit } @@ -82,47 +51,15 @@ do -n) ARG_TITLE=$1 shift;; -# -t) -# ARG_TNSIZE=$1 -# shift;; -# -u) -# ARG_TNQALITY=$1 -# shift;; -# -b) -# ARG_BIGSIZE=$1 -# shift;; -# -c) -# ARG_BIGQALITY=$1 -# shift;; -# -f) -# ARG_FILES=$1 -# shift;; - -l) - ARG_URL=$1 - shift;; -# -s) -# ARG_FILETYPES=$1 -# shift;; -d) ARG_DIR=$1 shift;; -# -e) -# ARG_EXIF=$1 -# shift;; -C) ARG_COPYRIGHT=$1 shift;; -# -F) -# ARG_MAILFROM=$1 -# shift;; -I) ARG_INFOFILE=$1 shift;; -# -T) -# ARG_MAILTO=$1 -# shift;; -# -U) -# ARG_UPDATE=0;; -v) echo $VERSION exit;; @@ -140,7 +77,7 @@ cd "$ARG_DIR" || exit 1 if [ "$ARG_INFOFILE" != "" ] then test -f $ARG_INFOFILE || err "info file not found \`\`$ARG_INFOFILE''" - for n in TITLE INDEX URL COPYRIGHT + for n in TITLE INDEX COPYRIGHT do v=$(make -f $ARG_INFOFILE -V$n) test "$v" = "" && continue @@ -152,14 +89,8 @@ fi for n in $(set | awk -F= '{print $1}') do echo "$n" | grep -q '^ARG_' || continue - eval "$n=\"\$(echo \"\$$n\" | iconv -f ISO-8859-1 -t UTF-8)\"" + eval "$n=\"\$(echo \"\$$n\" | $BIN_ICONV -f ISO-8859-1 -t UTF-8)\"" done - -# fix url -if [ "$ARG_URL" != "" ] -then - echo "$ARG_URL" | grep -q '/$' || ARG_URL="${ARG_URL}/" -fi title="$ARG_TITLE" cr="$ARG_COPYRIGHT"