version 1.1, 2012/08/31 12:33:07
|
version 1.4, 2013/04/03 08:06:45
|
Line 1
|
Line 1
|
#!/bin/sh | #!/usr/local/libexec/pgallerysh |
# |
# |
# THE BEER-WARE LICENSE 2012 |
# THE BEER-WARE LICENSE 2012 |
# <as@paefchen.net> wrote this file. As long as you retain this notice you |
# <as@paefchen.net> 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 |
# 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 |
# 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.3 2012/09/11 16:47:16 as Exp $ |
# |
# |
|
|
. $(dirname $0)/libpgallery | . /usr/local/libexec/libpgallery |
|
|
ARG_TITLE="PGallery" |
ARG_TITLE="PGallery" |
#ARG_FILES= |
|
#ARG_FILETYPES="jpg jpeg png gif tif tiff" |
|
ARG_TNSIZE="180" |
ARG_TNSIZE="180" |
#ARG_TNQALITY="70" |
|
ARG_BIGSIZE="950" |
ARG_BIGSIZE="950" |
#ARG_BIGQALITY="90" |
|
ARG_INDEX="index.html" |
ARG_INDEX="index.html" |
ARG_DIR="." |
ARG_DIR="." |
#ARG_UPDATE=1 |
|
ARG_COPYRIGHT="© $(date +%Y)" |
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() |
# |
# |
usage() |
usage() |
{ |
{ |
cat <<USAGE |
cat <<USAGE |
usage $0: ( [-f <files>] | [-s <suffix>] ) [-d <dir>] [-n <name>] | usage $0: ( [-d <dir>] [-n <name>] [-i <index>] [-C <copyright>] [-I <config>] |
[-t <thumbnail_size>] [-u <thumbnail_quality>] | | -h | -v |
[-b <big_size>] [-c <big_quality>] [-l link] [-e <exif>] | |
[-i <index>] [-C <copyright>] [-F <mailfrom>] [-T <mailto>] | |
[-U] | -h | -v | |
Options: |
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) |
-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 |
-h this page |
-i name index file name (default: $ARG_INDEX) |
-i name index file name (default: $ARG_INDEX) |
-l url gallery link |
|
-n name page title (default: $ARG_TITLE) |
-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 |
-v print version |
-C copyright copyright (html) string (default: $ARG_COPYRIGHT) |
-C copyright copyright (html) string (default: $ARG_COPYRIGHT) |
-F from mail sender (default: $ARG_MAILFROM) | -I config info text file for pgallery. info file paras prefered. |
-I file info text file for pgallery. info file paras prefered. | |
the syntax of the file is MAKE(1) |
the syntax of the file is MAKE(1) |
supported variable: TITLE COPYRIGHT INDEX FILETYPES TNSIZE URL | supported variable: TITLE COPYRIGHT INDEX |
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 | |
USAGE |
USAGE |
exit |
exit |
} |
} |
Line 82 do
|
Line 50 do
|
-n) |
-n) |
ARG_TITLE=$1 |
ARG_TITLE=$1 |
shift;; |
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) |
-d) |
ARG_DIR=$1 |
ARG_DIR=$1 |
shift;; |
shift;; |
# -e) |
|
# ARG_EXIF=$1 |
|
# shift;; |
|
-C) |
-C) |
ARG_COPYRIGHT=$1 |
ARG_COPYRIGHT=$1 |
shift;; |
shift;; |
# -F) |
|
# ARG_MAILFROM=$1 |
|
# shift;; |
|
-I) |
-I) |
ARG_INFOFILE=$1 |
ARG_INFOFILE=$1 |
shift;; |
shift;; |
# -T) |
|
# ARG_MAILTO=$1 |
|
# shift;; |
|
# -U) |
|
# ARG_UPDATE=0;; |
|
-v) |
-v) |
echo $VERSION |
echo $VERSION |
exit;; |
exit;; |
Line 140 cd "$ARG_DIR" || exit 1
|
Line 76 cd "$ARG_DIR" || exit 1
|
if [ "$ARG_INFOFILE" != "" ] |
if [ "$ARG_INFOFILE" != "" ] |
then |
then |
test -f $ARG_INFOFILE || err "info file not found \`\`$ARG_INFOFILE''" |
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 |
do |
v=$(make -f $ARG_INFOFILE -V$n) |
v=$(make -f $ARG_INFOFILE -V$n) |
test "$v" = "" && continue |
test "$v" = "" && continue |
Line 152 fi
|
Line 88 fi
|
for n in $(set | awk -F= '{print $1}') |
for n in $(set | awk -F= '{print $1}') |
do |
do |
echo "$n" | grep -q '^ARG_' || continue |
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 |
done |
|
|
# fix url |
|
if [ "$ARG_URL" != "" ] |
|
then |
|
echo "$ARG_URL" | grep -q '/$' || ARG_URL="${ARG_URL}/" |
|
fi |
|
|
|
title="$ARG_TITLE" |
title="$ARG_TITLE" |
cr="$ARG_COPYRIGHT" |
cr="$ARG_COPYRIGHT" |