Mercurial > dottes
view makeBookeTunePages.sh @ 321:b61c39beac5f
Generate different tune PDF for web site download.
For website download, generate a tune PDF with the tune title and composer.
Seems a bit silly to download a PDF giving an anonymouse tune.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Wed, 17 Jul 2013 18:28:07 +0100 |
parents | cbe9c10b5a3e |
children | 1a240d1e2032 |
line wrap: on
line source
#!/bin/bash # # Generate the LaTeX for the Booke tune pages (tunes.tex) and the index # of first lines (firstlines.tex). These are generated into the build # directory. # # All EPS and PDF tune graphics must be present already. Run # makeGraphics.sh to make these. # # Restore titles like 'Exploding Potato, The' to the # expected 'The Exploding Potato'. fixtitle() { retval=`echo "$1" | sed -e "s/\(.*\), *\(.*\)/\2 \1/"` } if [ $# != 1 ]; then echo "Usage: makeBookeTunePages.sh <book dir name>" exit 1 fi dir=`pwd` booke=$dir/$1 builddir=$dir/build graphicsdir=$dir/graphics/$1 tunesoutput=$builddir/tunes.tex indexoutput=$builddir/firstlines.tex mkdir -p $builddir rm -f $tunesoutput $indexoutput # Now, for each tune, make the tune graphic and add it, inside a # centre section, so the document. Then add a TOC entry. find $booke -name "*.abc" | sort | while read filename do name=`basename $filename .abc` title=`$dir/abcfield.py --field T --latex $filename` fixtitle "$title" title=$retval subtitle=`$dir/abcfield.py --index 2 --field T --latex $filename` composer=`$dir/abcfield.py --field C --latex $filename` changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"` changetitle="" if [ -n "$changefile" ]; then changetitle=`$dir/abcfield.py --field T --latex $booke/$changefile` fixtitle "$changetitle" changetitle=$retval fi echo -E "\showtune{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$changetitle}" >> $tunesoutput echo -E "\showfirstline{$title}{$graphicsdir/firstline-$name}" >> $indexoutput done