Mercurial > dottes
annotate makeWeb.sh @ 218:1a9d937b7765
Force Horn in F output to be in treble clef.
Some lower tunes with the odd high note ended up in bass clef. This crap horn
player doesn't do bass clef.
author | Jim Hague <jim.hague@laicatc.com> |
---|---|
date | Thu, 21 Feb 2013 07:23:49 +0000 |
parents | a8a46fd79d5c |
children | 0ef955669a9a |
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 |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
7 if [ $# -lt 1 -o $# -gt 2 ]; then |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
8 echo "Usage: makeWeb.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 |
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 title=$1 |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
19 booke=$1 |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
20 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
21 buildno=`cat buildno.txt` |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
22 subtitle= |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
23 intro= |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
24 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
|
25 subtitle=`cat $bookedir/subtitle.txt` |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
26 fi |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
27 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
|
28 intro=`cat $bookedir/intro.txt` |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
29 fi |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
30 |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
31 if [ -n "$2" ]; then |
217
a8a46fd79d5c
Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
212
diff
changeset
|
32 # Remove any transposition tag from title. |
a8a46fd79d5c
Fix up problems in Horn in F transposition.
Jim Hague <jim.hague@laicatc.com>
parents:
212
diff
changeset
|
33 title="${title/-*/} ($2)" |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
34 subtitle="${subtitle} ($2)" |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
35 fi |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
36 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
37 mkdir -p $webdir |
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 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
|
40 -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
|
41 -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
|
42 |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
43 # 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
|
44 # 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
|
45 cp $1-*.pdf $webdir |
45
689026e2de0c
Web. Add download links for book.
Jim Hague <jim.hague@laicatc.com>
parents:
43
diff
changeset
|
46 |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
47 # 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
|
48 find $bookedir -name "*.abc" | sort | |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
49 while read filename |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
50 do |
122
295ba8275ab4
Make output larger where possible.
Jim Hague <jim.hague@laicatc.com>
parents:
110
diff
changeset
|
51 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
|
52 name=`basename $filename .abc` |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
53 |
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
|
54 # 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
|
55 # 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
|
56 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
|
57 |
43
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
58 # Copy tune PDF from common graphics. |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
59 cp $graphicsdir/${name}.pdf $webdir |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
60 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
61 # And copy the ABC. |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
62 cp $filename $webdir |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
63 |
197
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
64 # Generate the tune web page. |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
65 tunepage=${name}.html |
8f352063f277
Finish first version of newly tarted up website.
Jim Hague <jim.hague@acm.org>
parents:
191
diff
changeset
|
66 |
202
540511b14c73
Handle '&' appearing in HTML output from tune titles.
Jim Hague <jim.hague@acm.org>
parents:
199
diff
changeset
|
67 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
|
68 -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
|
69 |
202
540511b14c73
Handle '&' appearing in HTML output from tune titles.
Jim Hague <jim.hague@acm.org>
parents:
199
diff
changeset
|
70 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
|
71 -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
|
72 done |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
73 |
d92717f8130c
First go at producing a very simple website.
Jim Hague <jim.hague@laicatc.com>
parents:
diff
changeset
|
74 cat dottes.html.footer >> $webdir/$output |