Mercurial > dottes
annotate makeWeb.sh @ 223:0ef955669a9a
Make transposed tunes use the original audio.
The aim of MIDI and MP3 is to allow the user to hear what a tune sounds
like. For transposed bookes, I think this should be reused from the main
booke page, because hearing it at the transposed pitch isn't a major help.
And in fact given the way cello transposition is done, the sound won't
be transposed anyway. And Jane hasn't complained.
This will speed up building the bookes by removing audio generation,
the slowest process, from the transposed bookes.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Fri, 22 Feb 2013 01:09:37 +0000 |
parents | a8a46fd79d5c |
children | 1e4443d58177 |
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 # |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
3 # Build the website. The common items and the web items are assumed |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
4 # to be already built. |
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 |
223
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
7 if [ $# -lt 2 -o $# -gt 3 ]; then |
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
8 echo "Usage: makeWeb.sh <book dir name> <master 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 |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
14 bookedir=$dir/$1 |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
15 webdir=$dir/web/$1 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
16 graphicsdir=$dir/graphics/$1 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
17 output=index.html |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
18 booke=$1 |
223
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
19 masterbooke=$2 |
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
20 title=$booke |
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
21 instrument=$3 |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
22 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
23 buildno=`cat buildno.txt` |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
24 subtitle= |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
25 intro= |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
26 if [ -r $bookedir/subtitle.txt ]; then |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
27 subtitle=`cat $bookedir/subtitle.txt` |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
28 fi |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
29 if [ -r $bookedir/intro.txt ]; then |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
30 intro=`cat $bookedir/intro.txt` |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
31 fi |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
32 |
223
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
33 if [ -n "$instrument" ]; then |
217
a8a46fd79d5c
Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
212
diff
changeset
|
34 # Remove any transposition tag from title. |
223
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
35 title="${title} ($instrument)" |
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
36 subtitle="${subtitle} ($instrument)" |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
37 fi |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
38 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
39 mkdir -p $webdir |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
40 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
41 sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \ |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
42 -e "s/@TITLE@/$title/" -e "s/@INTRO@/$intro/" \ |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
43 -e "s/@BOOK@/$booke/" dottes.html.header > $webdir/$output |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
44 |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
45 # Copy in the book PDFs. Like the graphics, Midi etc. these are assumed |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
46 # to be already generated. |
199
b8d18ccdc6e4
Fix up typo from last commit of this file.
Jim Hague <jim.hague@acm.org>
parents:
197
diff
changeset
|
47 cp $1-*.pdf $webdir |
45
689026e2de0c
Web. Add download links for book.
Jim Hague <jim.hague@laicatc.com>
parents:
43
diff
changeset
|
48 |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
49 # Now, for each tune, make the tune graphic and sound. |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
50 find $bookedir -name "*.abc" | sort | |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
51 while read filename |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
52 do |
122
295ba8275ab4
Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents:
110
diff
changeset
|
53 title=`$dir/abcfield.py --field T --html $filename` |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
54 name=`basename $filename .abc` |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
55 |
212
9502f4883006
When listing titles for web, straighten out ones of the form 'Something, The'.
Jim Hague <jim.hague@laicatc.com>
parents:
202
diff
changeset
|
56 # Restore titles like 'Exploding Potato, The' to the |
9502f4883006
When listing titles for web, straighten out ones of the form 'Something, The'.
Jim Hague <jim.hague@laicatc.com>
parents:
202
diff
changeset
|
57 # expected 'The Exploding Potato'. |
9502f4883006
When listing titles for web, straighten out ones of the form 'Something, The'.
Jim Hague <jim.hague@laicatc.com>
parents:
202
diff
changeset
|
58 title=`echo $title | sed -e "s/\(.*\), *\(.*\)/\2 \1/"` |
9502f4883006
When listing titles for web, straighten out ones of the form 'Something, The'.
Jim Hague <jim.hague@laicatc.com>
parents:
202
diff
changeset
|
59 |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
60 # Copy tune PDF from common graphics. |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
61 cp $graphicsdir/${name}.pdf $webdir |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
62 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
63 # And copy the ABC. |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
64 cp $filename $webdir |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
65 |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
66 # Generate the tune web page. |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
67 tunepage=${name}.html |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
68 |
223
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
69 # If the title contains HTML character entities, escape |
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
70 # initial '&' in the title - it means things to sed. |
202
540511b14c73
Handle '&' appearing in HTML output from tune titles.
Jim Hague <jim.hague@acm.org>
parents:
199
diff
changeset
|
71 sed -e "s/@TITLE@/${title//&/\&}/" \ |
223
0ef955669a9a
Make transposed tunes use the original audio.
Jim Hague <jim.hague@acm.org>
parents:
217
diff
changeset
|
72 -e "s/@MASTERBOOKE@/${masterbooke}/" \ |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
73 -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
74 |
202
540511b14c73
Handle '&' appearing in HTML output from tune titles.
Jim Hague <jim.hague@acm.org>
parents:
199
diff
changeset
|
75 sed -e "s/@TITLE@/${title//&/\&}/" \ |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
76 -e "s/@TUNE@/${name}/" dottes.html.tuneindex >> $webdir/$output |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
77 done |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
78 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
79 cat dottes.html.footer >> $webdir/$output |