view makeBooke.sh @ 50:e666306c5ab1

Add list of tune first lines. Add a list of tune first lines to the Booke. First, a small Python script to filter a .abc file and spit out just enough to give a graphic of the first line without the title. Then generate these graphics and generate a new section in the Booke with a longtable of tune name and the first line graphic.
author Jim Hague <jim.hague@laicatc.com>
date Sun, 04 Mar 2012 20:16:48 +0000
parents 0e7d2830cb8b
children 6ced110a62aa
line wrap: on
line source

#!/bin/bash
#
# Build the Booke. First assemble the book LaTeX, then build it
# into a PDF.
#
# All EPS and PDF tune graphics must be present already. Run
# makeGraphics.sh to make these.
#

if [ $# != 1 ]; then
    echo "Usage: makeBooke.sh <book dir name>"
    exit 1
fi

dir=`pwd`

booke=$dir/$1
builddir=$dir/build
graphicsdir=$dir/graphics/$1
output=dottes.tex
outputpdf=dottes.pdf
outputa4=dottesona4.tex
outputa4pdf=dottesona4.pdf

mkdir -p $builddir

cp buildno.txt $builddir
if [ -r $booke/subtitle.txt ]; then
    cp $booke/subtitle.txt $builddir
else
    touch $builddir/subtitle.txt
fi
if [ -r $booke/intro.txt ]; then
    cp $booke/intro.txt $builddir
else
    touch $builddir/intro.txt
fi
cp dottes.tex.header $builddir/$output

# 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
        title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"`
        name=`basename $filename .abc`
        echo -E "\begin{center}" >> $builddir/$output
        echo -E "\includegraphics[width=\textwidth]{$graphicsdir/$name}" >> $builddir/$output
        echo -E "\addcontentsline{toc}{subsection}{$title}" >> $builddir/$output
        echo -E "\end{center}" >> $builddir/$output
    done

cat dottes.tex.firstlines >> $builddir/$output

find $booke -name "*.abc" | sort |
    while read filename
    do
        title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"`
        name=`basename $filename .abc`
        echo -E "$title & \raisebox{-.25\height}{\includegraphics[width=8cm]{$graphicsdir/firstline-$name}} \\\\" >> $builddir/$output
    done

cat dottes.tex.footer >> $builddir/$output

cp $outputa4 $builddir

cd $builddir
pdflatex $output
pdflatex $output
pdflatex $outputa4

mv $outputpdf $dir/$1.pdf
mv $outputa4 $dir/${1}-booklet.pdf

cd $dir