diff options
| author | Paul Buetow (mars.fritz.box) <paul@buetow.org> | 2013-12-27 13:07:33 +0100 |
|---|---|---|
| committer | Paul Buetow (mars.fritz.box) <paul@buetow.org> | 2013-12-27 13:07:33 +0100 |
| commit | 3d23d6bc29dcbf714c916281091ebc594d3bc667 (patch) | |
| tree | 5bb44dc17eac4e77595081f2d9d43949539a9807 /src | |
| parent | 190f2bac98fa819096c928811aa0c0d94255a804 (diff) | |
some version which does not work yet
Diffstat (limited to 'src')
| -rwxr-xr-x | src/photoalbum | 50 | ||||
| -rw-r--r-- | src/photoalbum.default.conf | 4 |
2 files changed, 44 insertions, 10 deletions
diff --git a/src/photoalbum b/src/photoalbum index d020446..fec60ab 100755 --- a/src/photoalbum +++ b/src/photoalbum @@ -1,7 +1,6 @@ #!/bin/bash -source photoalbum.conf - +declare -r ARG="${1}" ; shift declare -r VERSION='PHOTOALBUMVERSION' function createdirs () { @@ -27,7 +26,7 @@ function template () { } function scale () { - cd ${INCOMING} && find ./ -type f | sort | while read photo; do + cd ${INCOMING_DIR} && find ./ -type f | sort | while read photo; do if [ ! -f "../photos/${photo}" ]; then # Flatten directories / to __ @@ -54,7 +53,7 @@ function scale () { cd .. } -function generate () { +function makedist () { local num=${1} ; shift local name=page-${num} local -i i=0 @@ -126,8 +125,41 @@ function generate () { done } -createdirs -scale -find ./html -type f -name \*.html -delete -generate 1 -template index index . +function init () { + [ ! -d "${INCOMING_DIR}" ] && mkdir "${INCOMING_DIR}" && echo "Created ${INCOMING_DIR}" + [ -d ./dist ] && rm -rf ./dist && echo Cleaned up ./dist + mkdir ./dist && echo Created ./dist +} + +function generate () { + if [ ! -d "${INCOMING_DIR}" ]; then + echo "ERROR: You may run init first, no such directory: ${INCOMING_DIR}" >&2 + exit 1 + fi + + createdirs + scale + find ./html -type f -name \*.html -delete + makedist 1 + template index index . +} + +if [ -f ~/.photoalbumrc ]; then + source ~/.photoalbumrc +else + source /etc/default/photoalbum +fi + +case "${ARG}" in + init) + init + ;; + generate) + generate + ;; + *) + usage + ;; +esac + + diff --git a/src/photoalbum.default.conf b/src/photoalbum.default.conf index defd59e..e38b2ad 100644 --- a/src/photoalbum.default.conf +++ b/src/photoalbum.default.conf @@ -6,5 +6,7 @@ declare -i GEOMETRY=800 declare -i MAXPREVIEWS=100 declare -r TITLE='A simple Photoalbum' -declare -r INCOMING=./incoming +declare -r INCOMING_DIR=./incoming + +declare -r TEMPLATE_DIR=/usr/share/photoalbum/templates |
