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.
This commit is contained in:
parent
6d91dcbd16
commit
2351348471
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
#
|
||||||
|
# Write out a modified version of a .abc file with just the data
|
||||||
|
# to print the first line of the music only.
|
||||||
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def process(inf):
|
||||||
|
print "X:1"
|
||||||
|
for line in inf:
|
||||||
|
line = line.strip()
|
||||||
|
start = line[:2]
|
||||||
|
if start[0] != "|" and start[1] == ":":
|
||||||
|
if start[0] in ["M", "K", "L"]:
|
||||||
|
print line
|
||||||
|
elif start[0] != "%":
|
||||||
|
print line
|
||||||
|
if line[-1] != "\\":
|
||||||
|
break
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
for arg in sys.argv[1:]:
|
||||||
|
try:
|
||||||
|
inf = open(arg, "r")
|
||||||
|
process(inf)
|
||||||
|
finally:
|
||||||
|
inf.close()
|
||||||
|
else:
|
||||||
|
process(sys.stdin)
|
|
@ -0,0 +1,12 @@
|
||||||
|
% -----
|
||||||
|
|
||||||
|
\newpage
|
||||||
|
\section{List of tune first lines}
|
||||||
|
|
||||||
|
You know the feeling. Everyone has just launched into a well-loved tune.
|
||||||
|
You've heard it before, but don't remember the name. So here's a list of
|
||||||
|
tune first lines to help you figure out what it is in time to join in.
|
||||||
|
|
||||||
|
\setlength\LTleft{0pt}
|
||||||
|
\setlength\LTright{0pt}
|
||||||
|
\begin{longtable}{lr}
|
|
@ -1,3 +1,5 @@
|
||||||
|
\end{longtable}
|
||||||
|
|
||||||
% -----
|
% -----
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
\usepackage{helvet}
|
\usepackage{helvet}
|
||||||
\usepackage{newcent}
|
\usepackage{newcent}
|
||||||
\usepackage{fancyhdr}
|
\usepackage{fancyhdr}
|
||||||
|
\usepackage{longtable}
|
||||||
|
|
||||||
% ----- Common variables
|
% ----- Common variables
|
||||||
|
|
||||||
|
|
10
makeBooke.sh
10
makeBooke.sh
|
@ -50,6 +50,16 @@ find $booke -name "*.abc" | sort |
|
||||||
echo -E "\end{center}" >> $builddir/$output
|
echo -E "\end{center}" >> $builddir/$output
|
||||||
done
|
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
|
cat dottes.tex.footer >> $builddir/$output
|
||||||
|
|
||||||
cp $outputa4 $builddir
|
cp $outputa4 $builddir
|
||||||
|
|
|
@ -21,9 +21,18 @@ find $booke -name "*.abc" | sort |
|
||||||
while read filename
|
while read filename
|
||||||
do
|
do
|
||||||
name=`basename $filename .abc`
|
name=`basename $filename .abc`
|
||||||
|
|
||||||
|
# Make the tune graphic.
|
||||||
abcm2ps -j0 +c -n -E -O $graphicsdir/$name.eps $filename
|
abcm2ps -j0 +c -n -E -O $graphicsdir/$name.eps $filename
|
||||||
# Make $name.eps so we can build with LaTeX.
|
# Make $name.eps so we can build with LaTeX.
|
||||||
mv $graphicsdir/${name}001.eps $graphicsdir/${name}.eps
|
mv $graphicsdir/${name}001.eps $graphicsdir/${name}.eps
|
||||||
# And make the corresponding PDF for pdflatex.
|
# And make the corresponding PDF for pdflatex.
|
||||||
epstopdf --outfile=$graphicsdir/$name.pdf $graphicsdir/${name}.eps
|
epstopdf --outfile=$graphicsdir/$name.pdf $graphicsdir/${name}.eps
|
||||||
|
|
||||||
|
# and make the first line graphic.
|
||||||
|
$dir/abcfirstline.py $filename > firstline.abc
|
||||||
|
abcm2ps +c -M +Q -E -O $graphicsdir/firstline-$name.eps firstline.abc
|
||||||
|
mv $graphicsdir/firstline-${name}001.eps $graphicsdir/firstline-${name}.eps
|
||||||
|
rm firstline.abc
|
||||||
|
epstopdf --outfile=$graphicsdir/firstline-$name.pdf $graphicsdir/firstline-${name}.eps
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue