From: Brett Parker Date: Wed, 26 Jan 2005 21:40:06 +0000 (+0000) Subject: Add a very rough progress meter X-Git-Tag: release-0.9.3~6 X-Git-Url: https://git.sommitrealweird.co.uk/bpgallery.git/commitdiff_plain/382e647023478b1c7f4e7f469cce2b81bf374c0f Add a very rough progress meter Adds a progress type meter while creating the icons, processes (up to) 4 icons at a time using xargs. git-archimport-id: arch@sommitrealweird.co.uk--2005-desktop/bpgallery--mainline--0.9.2--patch-4 --- diff --git a/bpgallery.sh b/bpgallery.sh index 6d38f0f..a088ebf 100755 --- a/bpgallery.sh +++ b/bpgallery.sh @@ -26,31 +26,31 @@ if [[ -z $TITLE ]]; then fi if [[ -z $CONVERTTOOL ]]; then - CONVERTTOOL="/usr/bin/convert" + CONVERTTOOL=convert fi if [[ -z $FINDCOMMAND ]]; then - FINDCOMMAND=/usr/bin/find + FINDCOMMAND=find fi if [[ -z $XARGSCOMMAND ]]; then - XARGSCOMMAND=/usr/bin/xargs + XARGSCOMMAND=xargs fi if [[ -z $ECHOCOMMAND ]]; then - ECHOCOMMAND=/bin/echo + ECHOCOMMAND=echo fi if [[ -z $SORTCOMMAND ]]; then - SORTCOMMAND=/usr/bin/sort + SORTCOMMAND=sort fi if [[ -z $IDENTIFYCOMMAND ]]; then - IDENTIFYCOMMAND=/usr/bin/identify + IDENTIFYCOMMAND=identify fi if [[ -z $HEADCOMMAND ]]; then - HEADCOMMAND=/usr/bin/head + HEADCOMMAND=head fi if [[ -z $WIDTH ]]; then @@ -61,6 +61,10 @@ if [[ -z $IMAGEEXTENSIONS ]]; then IMAGEEXTENSIONS="jpeg jpg gif png"; fi +if [[ -z $WCCOMMAND ]]; then + WCCOMMAND="wc -l" +fi + FINDIMAGESOPTIONS="" for imageext in $IMAGEEXTENSIONS; do @@ -124,7 +128,12 @@ else exit 3 fi -$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace $CONVERTTOOL -resize $WIDTH '{}' 'icons/{}' +totalimages=$($FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --replace echo {} | $WCCOMMAND); +currentimage=0 + +$FINDCOMMAND . $FINDIMAGESOPTIONS | $XARGSCOMMAND -0 --verbose --max-procs=4 --replace $CONVERTTOOL -resize $WIDTH '{}' 'icons/{}' 2>&1 | while read throwout; do echo done: $currentimage/$totalimages images; currentimage=$((currentimage+1)); done + +echo done: $totalimages/$totalimages images cat < index.html