Mercurial > dottes
comparison makeWeb.sh @ 586:daa3b76bd11f
More abcfield.py updates and mark it Python 3.
- Move title fixups into Python.
- Move key display name expansion into Python.
- Add Dottes-specific header continuation line format. None of the usual
tools appears to support the official +: continuation.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Mon, 31 Oct 2016 23:48:45 +0000 |
parents | 0206ab9fd6ba |
children | afc031477784 |
comparison
equal
deleted
inserted
replaced
585:0a2fc73ba5ec | 586:daa3b76bd11f |
---|---|
4 # to be already built. This generates the MusicXML and the page HTML | 4 # to be already built. This generates the MusicXML and the page HTML |
5 # and shuffles other files ino the right place. | 5 # and shuffles other files ino the right place. |
6 # | 6 # |
7 | 7 |
8 #set -x | 8 #set -x |
9 | |
10 # Restore titles like 'Exploding Potato, The' to the | |
11 # expected 'The Exploding Potato'. | |
12 fixtitle() | |
13 { | |
14 retval=`echo "$1" | sed -e "s/\(.*\), *\(.*\)/\2 \1/"` | |
15 } | |
16 | |
17 # Format a key in ABC (G, Gmin, etc.) in standard presentation format. | |
18 fixkey() | |
19 { | |
20 letter=${1:0:1} | |
21 accidental=${1:1:1} | |
22 if [ "$accidental" != "#" -a "$accidental" != "b" ]; then | |
23 accidental="" | |
24 mode=${1:1:3} | |
25 else | |
26 mode=${1:2:3} | |
27 fi | |
28 mode=${mode,,} | |
29 mode=${mode/ //g} | |
30 if [ "$mode" = "m" -o "$mode" = "min" ]; then | |
31 mode="Minor" | |
32 elif [ "$mode" = "mix" ]; then | |
33 mode="Mixolydian" | |
34 elif [ "$mode" = "dor" ]; then | |
35 mode="Dorian" | |
36 elif [ "$mode" = "phr" ]; then | |
37 mode="Phrygian" | |
38 elif [ "$mode" = "lyd" ]; then | |
39 mode="Lydian" | |
40 elif [ "$mode" = "loc" ]; then | |
41 mode="Locrian" | |
42 else | |
43 mode="Major" | |
44 fi | |
45 retval="${letter}${accidental} ${mode}" | |
46 } | |
47 | 9 |
48 if [ $# -lt 2 -o $# -gt 3 ]; then | 10 if [ $# -lt 2 -o $# -gt 3 ]; then |
49 echo "Usage: makeWeb.sh <book dir name> <master book dir name> [<instrument name>]" | 11 echo "Usage: makeWeb.sh <book dir name> <master book dir name> [<instrument name>]" |
50 exit 1 | 12 exit 1 |
51 fi | 13 fi |
103 while read filename | 65 while read filename |
104 do | 66 do |
105 name=`basename $filename .abc` | 67 name=`basename $filename .abc` |
106 | 68 |
107 # Extract items to substitute in the web page. | 69 # Extract items to substitute in the web page. |
108 title=`$dir/abcfield.py --field T $filename` | 70 title=`$dir/abcfield.py --field T --display $filename` |
109 fixtitle "$title" | 71 subtitle=`$dir/abcfield.py --index 2 --field T --display $filename` |
110 title=$retval | |
111 subtitle=`$dir/abcfield.py --index 2 --field T $filename` | |
112 fixtitle "$subtitle" | |
113 subtitle=$retval | |
114 composer=`$dir/abcfield.py --field C $filename` | 72 composer=`$dir/abcfield.py --field C $filename` |
115 changefile=`$dir/abcfield.py --field N --starts "Change:" $filename` | 73 changefile=`$dir/abcfield.py --field N --starts "Change:" $filename` |
116 changetitle="" | 74 changetitle="" |
117 changevisibility="no" | 75 changevisibility="no" |
118 if [ -n "$changefile" ]; then | 76 if [ -n "$changefile" ]; then |
119 changetitle=`$dir/abcfield.py --field T $bookedir/$changefile` | 77 changetitle=`$dir/abcfield.py --field T --display $bookedir/$changefile` |
120 changevisibility="yes" | 78 changevisibility="yes" |
121 | |
122 fixtitle "$changetitle" | |
123 changetitle=$retval | |
124 fi | 79 fi |
125 credit=`$dir/abcfield.py --field N --starts "Credit:" $filename` | 80 credit=`$dir/abcfield.py --field N --starts "Credit:" $filename` |
126 creditvisibility="no" | 81 creditvisibility="no" |
127 if [ -n "$credit" ]; then | 82 if [ -n "$credit" ]; then |
128 creditvisibility="yes" | 83 creditvisibility="yes" |
129 fi | 84 fi |
130 lastchanged=`hg log --limit 1 --template "{date|shortdate}" $masterbookedir/${name}.abc` | 85 lastchanged=`hg log --limit 1 --template "{date|shortdate}" $masterbookedir/${name}.abc` |
131 key=`$dir/abcfield.py --field K $filename` | 86 key=`$dir/abcfield.py --field K --display $filename` |
132 fixkey $key | |
133 key=$retval | |
134 | 87 |
135 # Copy the ABC into the web. | 88 # Copy the ABC into the web. |
136 cp $filename $webdir | 89 cp $filename $webdir |
137 | 90 |
138 # Generate MusicXML into the web. | 91 # Generate MusicXML into the web. |