annotate makeWebGraphics.sh @ 943:d6e2a281cceb build-default-344

Change web page layout. Put tune contents under 'tunes/<name>' or 'tunes-<instrument>/<name>'. That way they won't move if the tune gets moved between Bookes. For now I have not attempted to redirect old URLs.
author Jim Hague <jim.hague@acm.org>
date Mon, 05 Aug 2019 23:25:28 +0100
parents b83b49f2a0a0
children 0f4ba68d6059
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
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
7 if [[ $# -lt 1 ]]; then
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
8 echo "Usage: makeWebGraphics.sh <book dir name> [<instrument 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
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
18 instrument=$2
43
d92717f8130c First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff changeset
19
943
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
20 if [ -n "$instrument" ]; then
d6e2a281cceb Change web page layout.
Jim Hague <jim.hague@acm.org>
parents: 753
diff changeset
21 basetunedir="${basetunedir}-${instrument}"
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