annotate makeWebGraphics.sh @ 953:6f8b1eaedcb5

Add Library transposition dirs in .hgignore, like Morris and Session.
author Jim Hague <jim.hague@acm.org>
date Tue, 06 Aug 2019 20:50:23 +0100
parents 0f4ba68d6059
children e4d31e094d24
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.
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
4 # They go into web/tunes/<tunename>, or web/tunes-<instrument>/<tunename>.
43
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
946
0f4ba68d6059 Fix target generation for transposed booke web items.
Jim Hague <jim.hague@acm.org>
parents: 943
diff changeset
7 if [[ $# -ne 1 ]]; then
0f4ba68d6059 Fix target generation for transposed booke web items.
Jim Hague <jim.hague@acm.org>
parents: 943
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
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
15 basewebdir=$dir/web
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
16 basetunedir=$basewebdir/tunes
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
17 graphicsdir=$dir/graphics/$1
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
18
946
0f4ba68d6059 Fix target generation for transposed booke web items.
Jim Hague <jim.hague@acm.org>
parents: 943
diff changeset
19 instrumentSuffix="${1##*-}"
0f4ba68d6059 Fix target generation for transposed booke web items.
Jim Hague <jim.hague@acm.org>
parents: 943
diff changeset
20 if [ "$1" != "$instrumentSuffix" ]; then
0f4ba68d6059 Fix target generation for transposed booke web items.
Jim Hague <jim.hague@acm.org>
parents: 943
diff changeset
21 basetunedir="${basetunedir}-${instrumentSuffix}"
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
22 fi
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
23
223
0ef955669a9a Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents: 197
diff changeset
24 # 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
25 # 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
26 # 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
27 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
28 while read filename
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
29 do
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
30 name=`basename $filename .abc`
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
31 tunedir=$basetunedir/$name
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
32 mkdir -p $tunedir
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
33
61
3464d5154f49 Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents: 48
diff changeset
34 tmpname=${name}.tmp
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
35 convert -colors 256 -quality 90 -density 200 $graphicsdir/${name}.pdf $tunedir/${tmpname}.png
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
36 convert -colors 256 -quality 90 -density 200 $graphicsdir/firstline-${name}.pdf $tunedir/firstline-${tmpname}.png
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
37
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
38 mv $tunedir/${tmpname}.png $tunedir/${name}.png
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
39 mv $tunedir/firstline-${tmpname}.png $tunedir/firstline-${name}.png
321
b61c39beac5f Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents: 318
diff changeset
40
b61c39beac5f Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents: 318
diff changeset
41 # Make the web downloadable PDF with the tune title.
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
42 abcm2ps -E -F singletuneweb -O $tunedir/$name.eps $filename
321
b61c39beac5f Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents: 318
diff changeset
43 # And make the corresponding PDF.
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
44 epstopdf --outfile=$tunedir/$name.pdf $tunedir/${name}001.eps
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
45 rm $tunedir/${name}001.eps
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
46 done