annotate makeWebGraphics.sh @ 872:7377575957b0

Add text to Battle of the Somme, and we now need a compact version.
author Jim Hague <jim.hague@acm.org>
date Tue, 26 Mar 2019 13:51:30 +0000
parents b83b49f2a0a0
children d6e2a281cceb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
1 #!/bin/bash
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
2 #
223
0ef955669a9a Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents: 197
diff changeset
3 # Make graphics required for the website but not for the book.
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
4 # They go into web/<book>.
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
5 #
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
6
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
7 if [ $# != 1 ]; then
223
0ef955669a9a Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents: 197
diff changeset
8 echo "Usage: makeWebGraphics.sh <book dir name>"
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
9 exit 1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
10 fi
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
11
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
12 dir=`pwd`
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
13
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
14 booke=$dir/$1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
15 builddir=$dir/web/$1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
16 graphicsdir=$dir/graphics/$1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
17
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
18 mkdir -p $builddir
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
19
223
0ef955669a9a Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents: 197
diff changeset
20 # Now, for each tune, make the main tune and tune first line bitmaps.
0ef955669a9a Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents: 197
diff changeset
21 # Do this to temp files and rename into place to make updates as
0ef955669a9a Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents: 197
diff changeset
22 # atomic as possible.
753
b83b49f2a0a0 Correct Mac-ism. find -maxdepth n, not find -depth n.
Jim Hague <jim.hague@acm.org>
parents: 748
diff changeset
23 find $booke -maxdepth 1 -name "*.abc" | sort |
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
24 while read filename
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
25 do
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
26 name=`basename $filename .abc`
61
3464d5154f49 Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents: 48
diff changeset
27 tmpname=${name}.tmp
608
b4eb1753c80f Up the resolution of the web graphics.
Jim Hague <jim.hague@acm.org>
parents: 536
diff changeset
28 convert -colors 256 -quality 90 -density 200 $graphicsdir/${name}.pdf $builddir/${tmpname}.png
b4eb1753c80f Up the resolution of the web graphics.
Jim Hague <jim.hague@acm.org>
parents: 536
diff changeset
29 convert -colors 256 -quality 90 -density 200 $graphicsdir/firstline-${name}.pdf $builddir/firstline-${tmpname}.png
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
30
191
2fa3c89a0a8a Change web to use PNG rather than JPG.
Jim Hague <jim.hague@acm.org>
parents: 62
diff changeset
31 mv $builddir/${tmpname}.png $builddir/${name}.png
197
8f352063f277 Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents: 191
diff changeset
32 mv $builddir/firstline-${tmpname}.png $builddir/firstline-${name}.png
321
b61c39beac5f Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents: 318
diff changeset
33
b61c39beac5f Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents: 318
diff changeset
34 # Make the web downloadable PDF with the tune title.
b61c39beac5f Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents: 318
diff changeset
35 abcm2ps -E -F singletuneweb -O $builddir/$name.eps $filename
b61c39beac5f Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents: 318
diff changeset
36 # And make the corresponding PDF.
b61c39beac5f Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents: 318
diff changeset
37 epstopdf --outfile=$builddir/$name.pdf $builddir/${name}001.eps
536
c0130d1ee053 Fix typo in filename to delete.
Jim Hague <jim.hague@acm.org>
parents: 397
diff changeset
38 rm $builddir/${name}001.eps
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
39 done