Mercurial > dottes
comparison makeWebGraphics.sh @ 943:d6e2a281cceb build-default-344
Change web page layout.
Put tune contents under 'tunes/<name>' or 'tunes-<instrument>/<name>'.
That way they won't move if the tune gets moved between Bookes.
For now I have not attempted to redirect old URLs.
| author | Jim Hague <jim.hague@acm.org> |
|---|---|
| date | Mon, 05 Aug 2019 23:25:28 +0100 |
| parents | b83b49f2a0a0 |
| children | 0f4ba68d6059 |
comparison
equal
deleted
inserted
replaced
| 942:a774b3b3cad7 | 943:d6e2a281cceb |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # Make graphics required for the website but not for the book. | 3 # Make graphics required for the website but not for the book. |
| 4 # They go into web/<book>. | 4 # They go into web/tunes/<tunename>, or web/tunes-<instrument>/<tunename>. |
| 5 # | 5 # |
| 6 | 6 |
| 7 if [ $# != 1 ]; then | 7 if [[ $# -lt 1 ]]; then |
| 8 echo "Usage: makeWebGraphics.sh <book dir name>" | 8 echo "Usage: makeWebGraphics.sh <book dir name> [<instrument name>]" |
| 9 exit 1 | 9 exit 1 |
| 10 fi | 10 fi |
| 11 | 11 |
| 12 dir=`pwd` | 12 dir=`pwd` |
| 13 | 13 |
| 14 booke=$dir/$1 | 14 booke=$dir/$1 |
| 15 builddir=$dir/web/$1 | 15 basewebdir=$dir/web |
| 16 basetunedir=$basewebdir/tunes | |
| 16 graphicsdir=$dir/graphics/$1 | 17 graphicsdir=$dir/graphics/$1 |
| 18 instrument=$2 | |
| 17 | 19 |
| 18 mkdir -p $builddir | 20 if [ -n "$instrument" ]; then |
| 21 basetunedir="${basetunedir}-${instrument}" | |
| 22 fi | |
| 19 | 23 |
| 20 # Now, for each tune, make the main tune and tune first line bitmaps. | 24 # Now, for each tune, make the main tune and tune first line bitmaps. |
| 21 # Do this to temp files and rename into place to make updates as | 25 # Do this to temp files and rename into place to make updates as |
| 22 # atomic as possible. | 26 # atomic as possible. |
| 23 find $booke -maxdepth 1 -name "*.abc" | sort | | 27 find $booke -maxdepth 1 -name "*.abc" | sort | |
| 24 while read filename | 28 while read filename |
| 25 do | 29 do |
| 26 name=`basename $filename .abc` | 30 name=`basename $filename .abc` |
| 31 tunedir=$basetunedir/$name | |
| 32 mkdir -p $tunedir | |
| 33 | |
| 27 tmpname=${name}.tmp | 34 tmpname=${name}.tmp |
| 28 convert -colors 256 -quality 90 -density 200 $graphicsdir/${name}.pdf $builddir/${tmpname}.png | 35 convert -colors 256 -quality 90 -density 200 $graphicsdir/${name}.pdf $tunedir/${tmpname}.png |
| 29 convert -colors 256 -quality 90 -density 200 $graphicsdir/firstline-${name}.pdf $builddir/firstline-${tmpname}.png | 36 convert -colors 256 -quality 90 -density 200 $graphicsdir/firstline-${name}.pdf $tunedir/firstline-${tmpname}.png |
| 30 | 37 |
| 31 mv $builddir/${tmpname}.png $builddir/${name}.png | 38 mv $tunedir/${tmpname}.png $tunedir/${name}.png |
| 32 mv $builddir/firstline-${tmpname}.png $builddir/firstline-${name}.png | 39 mv $tunedir/firstline-${tmpname}.png $tunedir/firstline-${name}.png |
| 33 | 40 |
| 34 # Make the web downloadable PDF with the tune title. | 41 # Make the web downloadable PDF with the tune title. |
| 35 abcm2ps -E -F singletuneweb -O $builddir/$name.eps $filename | 42 abcm2ps -E -F singletuneweb -O $tunedir/$name.eps $filename |
| 36 # And make the corresponding PDF. | 43 # And make the corresponding PDF. |
| 37 epstopdf --outfile=$builddir/$name.pdf $builddir/${name}001.eps | 44 epstopdf --outfile=$tunedir/$name.pdf $tunedir/${name}001.eps |
| 38 rm $builddir/${name}001.eps | 45 rm $tunedir/${name}001.eps |
| 39 done | 46 done |
