Mercurial > dottes
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 |
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 |
32 mkdir -p $tunedir | |
33 | |
61
3464d5154f49
Fix temp file name to convert.
Jim Hague <jim.hague@acm.org>
parents:
48
diff
changeset
|
34 tmpname=${name}.tmp |
943 | 35 convert -colors 256 -quality 90 -density 200 $graphicsdir/${name}.pdf $tunedir/${tmpname}.png |
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 | 38 mv $tunedir/${tmpname}.png $tunedir/${name}.png |
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 | 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 | 44 epstopdf --outfile=$tunedir/$name.pdf $tunedir/${name}001.eps |
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 |