Mercurial > dottes
annotate makeWebGraphics.sh @ 1026:e4d31e094d24
Changes to get Beginners booke building.
The web pages include prev and next links, so to get those right we
have to make the tune filenames distinct from the main booke names.
So fall back to taking the easy way, and just prefix all tune names with
@ or _.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Tue, 18 Feb 2020 15:13:38 +0000 |
parents | 0f4ba68d6059 |
children | 70e1ff83fe34 |
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. |
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 | 31 tunedir=$basetunedir/$name |
1026
e4d31e094d24
Changes to get Beginners booke building.
Jim Hague <jim.hague@acm.org>
parents:
946
diff
changeset
|
32 |
e4d31e094d24
Changes to get Beginners booke building.
Jim Hague <jim.hague@acm.org>
parents:
946
diff
changeset
|
33 # Already generated? |
e4d31e094d24
Changes to get Beginners booke building.
Jim Hague <jim.hague@acm.org>
parents:
946
diff
changeset
|
34 if [ -f $tunedir/${name}.pdf ]; then |
e4d31e094d24
Changes to get Beginners booke building.
Jim Hague <jim.hague@acm.org>
parents:
946
diff
changeset
|
35 continue |
e4d31e094d24
Changes to get Beginners booke building.
Jim Hague <jim.hague@acm.org>
parents:
946
diff
changeset
|
36 fi |
e4d31e094d24
Changes to get Beginners booke building.
Jim Hague <jim.hague@acm.org>
parents:
946
diff
changeset
|
37 |
943 | 38 mkdir -p $tunedir |
39 | |
61
3464d5154f49
Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents:
48
diff
changeset
|
40 tmpname=${name}.tmp |
943 | 41 convert -colors 256 -quality 90 -density 200 $graphicsdir/${name}.pdf $tunedir/${tmpname}.png |
42 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
|
43 |
943 | 44 mv $tunedir/${tmpname}.png $tunedir/${name}.png |
45 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
|
46 |
b61c39beac5f
Generate different tune PDF for web site download.
Jim Hague <jim.hague@acm.org>
parents:
318
diff
changeset
|
47 # Make the web downloadable PDF with the tune title. |
943 | 48 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
|
49 # And make the corresponding PDF. |
943 | 50 epstopdf --outfile=$tunedir/$name.pdf $tunedir/${name}001.eps |
51 rm $tunedir/${name}001.eps | |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
52 done |