Mercurial > dottes
annotate makeWebGraphics.sh @ 1077:b3c7cdd58b5e build-default-392
Merge with site.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Fri, 11 Mar 2022 16:14:55 +0000 |
parents | 18f0e45207ef |
children |
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 | 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 | 15 basewebdir=$dir/web |
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 | 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. |
1031
18f0e45207ef
Sort LC_ALL=C to get Linux sort to order Beginners as expected.
Jim Hague <jim.hague@acm.org>
parents:
1030
diff
changeset
|
27 find $booke -maxdepth 1 -name "*.abc" | |
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 | 31 tunedir=$basetunedir/$name |
1026
e4d31e094d24
Changes to get Beginners booke building.
Jim Hague <jim.hague@acm.org>
parents:
946
diff
changeset
|
32 |
943 | 33 mkdir -p $tunedir |
34 | |
61
3464d5154f49
Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents:
48
diff
changeset
|
35 tmpname=${name}.tmp |
943 | 36 convert -colors 256 -quality 90 -density 200 $graphicsdir/${name}.pdf $tunedir/${tmpname}.png |
37 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
|
38 |
943 | 39 mv $tunedir/${tmpname}.png $tunedir/${name}.png |
40 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
|
41 |
b61c39beac5f
Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents:
318
diff
changeset
|
42 # Make the web downloadable PDF with the tune title. |
943 | 43 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
|
44 # And make the corresponding PDF. |
943 | 45 epstopdf --outfile=$tunedir/$name.pdf $tunedir/${name}001.eps |
46 rm $tunedir/${name}001.eps | |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
47 done |