mirror of
https://github.com/flynx/photobook.git
synced 2025-10-29 02:10:08 +00:00
better defaults and more stable sorting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2855a9126d
commit
fd34ebd9b2
@ -1 +0,0 @@
|
|||||||
Some text
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Some text
|
|
||||||
@ -127,13 +127,10 @@ shopt -s nullglob extglob
|
|||||||
|
|
||||||
# defaults...
|
# defaults...
|
||||||
|
|
||||||
TEMPLATE_PATH=templates/
|
IMAGE_DIR=${IMAGE_DIR:=pages/}
|
||||||
|
IMAGE_HIRES_DIR=${IMAGE_HIRES_DIR:=}
|
||||||
IMAGE_DIR=pages/
|
CAPTION_DIR=${CAPTION_DIR:=captions/}
|
||||||
|
TEMPLATE_DIR=${TEMPLATE_DIR:=templates/}
|
||||||
CAPTIONS=captions/
|
|
||||||
|
|
||||||
#IMAGE_HIRES_DIR=
|
|
||||||
|
|
||||||
TEXT_FORMATS='.*\.txt$'
|
TEXT_FORMATS='.*\.txt$'
|
||||||
IMAGE_FORMATS='.*\.(jpeg|jpg|png|pdf|svg|eps)$'
|
IMAGE_FORMATS='.*\.(jpeg|jpg|png|pdf|svg|eps)$'
|
||||||
@ -176,13 +173,15 @@ printhelp(){
|
|||||||
echo "Arguments:"
|
echo "Arguments:"
|
||||||
echo " -h --help - print this help and exit."
|
echo " -h --help - print this help and exit."
|
||||||
echo " --templates=PATH"
|
echo " --templates=PATH"
|
||||||
echo " - path to search for templates (default: $TEMPLATE_PATH)."
|
echo " - path to search for templates (default: $TEMPLATE_DIR)."
|
||||||
echo " --single-image-tpl=NAME"
|
echo " --single-image-tpl=NAME"
|
||||||
echo " - single image default template (default: ${IMAGE_SPREAD[1]})."
|
echo " - single image default template (default: ${IMAGE_SPREAD[1]})."
|
||||||
echo " --double-image-tpl=NAME"
|
echo " --double-image-tpl=NAME"
|
||||||
echo " - double image default template (default: ${IMAGE_SPREAD[2]})."
|
echo " - double image default template (default: ${IMAGE_SPREAD[2]})."
|
||||||
echo " --text-spread-tpl=NAME"
|
echo " --text-spread-tpl=NAME"
|
||||||
echo " - text spread default template (default: ${IMAGE_SPREAD[0]})."
|
echo " - text spread default template (default: ${IMAGE_SPREAD[0]})."
|
||||||
|
echo " --captions=PATH"
|
||||||
|
echo " - path to search for captions (default: $CAPTION_DIR)."
|
||||||
echo
|
echo
|
||||||
echo "Parameters:"
|
echo "Parameters:"
|
||||||
echo " PATH - path to root pages directory (default: $IMAGE_DIR)"
|
echo " PATH - path to root pages directory (default: $IMAGE_DIR)"
|
||||||
@ -222,7 +221,7 @@ while true ; do
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
--templates)
|
--templates)
|
||||||
TEMPLATE_PATH=$2
|
TEMPLATE_DIR=$2
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
@ -241,6 +240,11 @@ while true ; do
|
|||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--captions)
|
||||||
|
CAPTION_DIR=$2
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
# handle unknown options...
|
# handle unknown options...
|
||||||
-*|--*)
|
-*|--*)
|
||||||
@ -280,7 +284,7 @@ getCaption(){
|
|||||||
local name=`basename "${2%.*}"`
|
local name=`basename "${2%.*}"`
|
||||||
|
|
||||||
local captions=(
|
local captions=(
|
||||||
"$CAPTIONS/${name}.txt"
|
"$CAPTION_DIR/${name}.txt"
|
||||||
"${spread}/${name}.txt"
|
"${spread}/${name}.txt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -571,7 +575,7 @@ handleSpread(){
|
|||||||
# get...
|
# get...
|
||||||
template="${template[0]%.*}.tex"
|
template="${template[0]%.*}.tex"
|
||||||
if ! [ -e "$template" ] ; then
|
if ! [ -e "$template" ] ; then
|
||||||
template="$TEMPLATE_PATH/${template[0]%.*}.tex"
|
template="$TEMPLATE_DIR/${template[0]%.*}.tex"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -593,11 +597,11 @@ getTemplate(){
|
|||||||
if ! [ -z $TEMPLATE ] ; then
|
if ! [ -z $TEMPLATE ] ; then
|
||||||
TEMPLATE=${TEMPLATE/$SPREAD\//}
|
TEMPLATE=${TEMPLATE/$SPREAD\//}
|
||||||
TEMPLATE=${TEMPLATE/[0-9]-/}
|
TEMPLATE=${TEMPLATE/[0-9]-/}
|
||||||
TEMPLATE="$TEMPLATE_PATH/${TEMPLATE[0]%-${TYPE}.*}.tex"
|
TEMPLATE="$TEMPLATE_DIR/${TEMPLATE[0]%-${TYPE}.*}.tex"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ -z $TEMPLATE ] ; then
|
if [ -z $TEMPLATE ] ; then
|
||||||
TEMPLATE="$TEMPLATE_PATH/${TYPE}.tex"
|
TEMPLATE="$TEMPLATE_DIR/${TYPE}.tex"
|
||||||
fi
|
fi
|
||||||
if ! [ -e $TEMPLATE ] ; then
|
if ! [ -e $TEMPLATE ] ; then
|
||||||
return
|
return
|
||||||
@ -638,10 +642,12 @@ echo %----------------------------------------------------------------------
|
|||||||
echo %
|
echo %
|
||||||
|
|
||||||
l=$(ls "$IMAGE_DIR/" | wc -l)
|
l=$(ls "$IMAGE_DIR/" | wc -l)
|
||||||
|
|
||||||
c=0
|
c=0
|
||||||
d=0
|
d=0
|
||||||
for spread in "${IMAGE_DIR}"/* ; do
|
SPREADS=("$(ls "${IMAGE_DIR}" | sort -n)")
|
||||||
|
for spread in ${SPREADS[@]} ; do
|
||||||
|
spread="${IMAGE_DIR}/${spread}"
|
||||||
|
|
||||||
# skip non-spreads...
|
# skip non-spreads...
|
||||||
if ! [ -d "$spread" ] ; then
|
if ! [ -d "$spread" ] ; then
|
||||||
continue
|
continue
|
||||||
@ -666,11 +672,13 @@ for spread in "${IMAGE_DIR}"/* ; do
|
|||||||
echo % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
echo % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
fi
|
fi
|
||||||
SKIP_FIRST=1
|
SKIP_FIRST=1
|
||||||
|
|
||||||
# skip temporarily disabled...
|
# skip temporarily disabled...
|
||||||
if [ -z ${spread/-*/} ] ; then
|
if [[ "${spread}" =~ -.* ]] ; then
|
||||||
echo "% spread: ${spread/-/}: skipped..." | tee >(cat >&2)
|
echo "% spread: ${spread/-/}: skipped..." | tee >(cat >&2)
|
||||||
echo %
|
echo %
|
||||||
continue
|
continue
|
||||||
|
# print helpful info...
|
||||||
else
|
else
|
||||||
printf "Spread ($c/$l): ${spread/-/} \r" >&2
|
printf "Spread ($c/$l): ${spread/-/} \r" >&2
|
||||||
echo "% spread: ${spread/-/}"
|
echo "% spread: ${spread/-/}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user