Skip to content
Snippets Groups Projects
Commit 6128d37d authored by Toke Eskildsen's avatar Toke Eskildsen
Browse files

Closes #31 (Better progress status)

parent 24639697
No related branches found
No related tags found
No related merge requests found
...@@ -167,6 +167,7 @@ OSD_DIRECT="http://github.com/openseadragon/openseadragon/releases/download/v1.0 ...@@ -167,6 +167,7 @@ OSD_DIRECT="http://github.com/openseadragon/openseadragon/releases/download/v1.0
START_PATH=`pwd` START_PATH=`pwd`
pushd `dirname $0` > /dev/null pushd `dirname $0` > /dev/null
ROOT=`pwd` ROOT=`pwd`
if [ -e "quack.settings" ]; then if [ -e "quack.settings" ]; then
echo "Sourcing user settings from quack.settings in `pwd`" echo "Sourcing user settings from quack.settings in `pwd`"
source "quack.settings" source "quack.settings"
...@@ -198,6 +199,13 @@ IMAGE_TEMPLATE="$ROOT/web/image_template.html" ...@@ -198,6 +199,13 @@ IMAGE_TEMPLATE="$ROOT/web/image_template.html"
IMAGELINK_TEMPLATE="$ROOT/web/imagelink_template.html" IMAGELINK_TEMPLATE="$ROOT/web/imagelink_template.html"
DRAGON="openseadragon.min.js" DRAGON="openseadragon.min.js"
export IMAGE_COUNTER="$ROOT/quack.imagecounter.temp.$$"
export TEMPDIR_LOCK="$ROOT/quack.lock.$$"
if [ -d $TEMPDIR_LOCK ]; then
echo "Removing hopefully stale lock folder $TEMPDIR_LOCK"
rm -rf $TEMPDIR_LOCK $IMAGE_COUNTER
fi
function usage() { function usage() {
echo "quack 1.2 beta - Quality Assurance oriented ALTO viewer" echo "quack 1.2 beta - Quality Assurance oriented ALTO viewer"
echo "" echo ""
...@@ -392,9 +400,23 @@ function makeImages() { ...@@ -392,9 +400,23 @@ function makeImages() {
exit exit
fi fi
# This is multi threaded so we need to synchronize the counter update
# and we need to use a file to holde the counter as environment variables
# are not updated across threads. Rather ugly.
# http://stackoverflow.com/questions/8231847/bash-script-to-count-number-of-times-script-has-run
mkdir $TEMPDIR_LOCK 2> /dev/null
while [[ $? -ne 0 ]] ; do
sleep 0.1
mkdir $TEMPDIR_LOCK 2> /dev/null
done
CREATED_IMAGES=`cat $IMAGE_COUNTER`
CREATED_IMAGES=$((CREATED_IMAGES+1))
echo "$CREATED_IMAGES" > $IMAGE_COUNTER
rm -rf $TEMPDIR_LOCK
# Even if TILE="true", we create the full main presentational image as it # Even if TILE="true", we create the full main presentational image as it
# might be requested for download # might be requested for download
if shouldGenerate "$FORCE_QAIMAGE" "$DEST_IMAGE" "QA"; then if shouldGenerate "$FORCE_QAIMAGE" "$DEST_IMAGE" "QA (${CREATED_IMAGES}/${TOTAL_IMAGES}"; then
gm convert "$SOURCE_IMAGE" -quality $IMAGE_DISP_QUALITY "$DEST_IMAGE" gm convert "$SOURCE_IMAGE" -quality $IMAGE_DISP_QUALITY "$DEST_IMAGE"
fi fi
...@@ -701,8 +723,8 @@ function makePreviewPage() { ...@@ -701,8 +723,8 @@ function makePreviewPage() {
return return
fi fi
TOTAL_PROCESSED=$((TOTAL_PROCESSED+1)) CREATED_PAGES=$((CREATED_PAGES+1))
echo " - ${P##*/} (${TOTAL_PROCESSED}/${TOTAL_IMAGES})" echo " - ${P##*/} (${CREATED_PAGES}/${TOTAL_IMAGES})"
local ALTO_FILE="${BASE}${ALTO_EXT}" local ALTO_FILE="${BASE}${ALTO_EXT}"
processALTO "$SRC_FOLDER" "$DEST_FOLDER" "$ALTO_FILE" $IMAGE_WIDTH $IMAGE_HEIGHT processALTO "$SRC_FOLDER" "$DEST_FOLDER" "$ALTO_FILE" $IMAGE_WIDTH $IMAGE_HEIGHT
...@@ -955,9 +977,11 @@ function makeIndex() { ...@@ -955,9 +977,11 @@ function makeIndex() {
echo "Quack starting at `date`" echo "Quack starting at `date`"
copyFiles copyFiles
pushd "$SOURCE" > /dev/null pushd "$SOURCE" > /dev/null
TOTAL_IMAGES=`ls -R $IMAGE_GLOB 2> /dev/null | wc -l` export TOTAL_IMAGES=`ls -R $IMAGE_GLOB 2> /dev/null | wc -l`
TOTAL_PROCESSED=0 CREATED_PAGES=0
export CREATED_IMAGES=0
popd > /dev/null popd > /dev/null
makeIndex "" "" "$SOURCE" "$DEST" makeIndex "" "" "$SOURCE" "$DEST"
rm -r $IMAGE_COUNTER
echo "All done at `date`" echo "All done at `date`"
echo "Please open ${DEST}/index.html in a browser" echo "Please open ${DEST}/index.html in a browser"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment