2012-03-04 12:39:12 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2013-02-22 01:09:37 +00:00
|
|
|
# Make graphics required for the website but not for the book.
|
2019-08-05 23:25:28 +01:00
|
|
|
# They go into web/tunes/<tunename>, or web/tunes-<instrument>/<tunename>.
|
2012-03-04 12:39:12 +00:00
|
|
|
#
|
|
|
|
|
2019-08-06 08:48:39 +01:00
|
|
|
if [[ $# -ne 1 ]]; then
|
|
|
|
echo "Usage: makeWebGraphics.sh <book dir name>"
|
2012-03-04 12:39:12 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
dir=`pwd`
|
|
|
|
|
|
|
|
booke=$dir/$1
|
2019-08-05 23:25:28 +01:00
|
|
|
basewebdir=$dir/web
|
|
|
|
basetunedir=$basewebdir/tunes
|
2012-03-04 12:39:12 +00:00
|
|
|
graphicsdir=$dir/graphics/$1
|
|
|
|
|
2019-08-06 08:48:39 +01:00
|
|
|
instrumentSuffix="${1##*-}"
|
|
|
|
if [ "$1" != "$instrumentSuffix" ]; then
|
|
|
|
basetunedir="${basetunedir}-${instrumentSuffix}"
|
2019-08-05 23:25:28 +01:00
|
|
|
fi
|
2012-03-04 12:39:12 +00:00
|
|
|
|
2013-02-22 01:09:37 +00:00
|
|
|
# Now, for each tune, make the main tune and tune first line bitmaps.
|
|
|
|
# Do this to temp files and rename into place to make updates as
|
|
|
|
# atomic as possible.
|
2020-02-19 11:14:40 +00:00
|
|
|
find $booke -maxdepth 1 -name "*.abc" |
|
2012-03-04 12:39:12 +00:00
|
|
|
while read filename
|
|
|
|
do
|
|
|
|
name=`basename $filename .abc`
|
2019-08-05 23:25:28 +01:00
|
|
|
tunedir=$basetunedir/$name
|
2020-02-18 15:13:38 +00:00
|
|
|
|
2019-08-05 23:25:28 +01:00
|
|
|
mkdir -p $tunedir
|
|
|
|
|
2023-03-05 12:21:14 +00:00
|
|
|
abcm2ps -g -F singletune -O $tunedir/$name.svg $filename
|
|
|
|
mv $tunedir/${name}001.svg $tunedir/$name.svg
|
|
|
|
$dir/abcfirstline.py $filename > firstline.abc
|
|
|
|
abcm2ps -g -F firstline -O $tunedir/firstline-$name.svg firstline.abc
|
|
|
|
mv $tunedir/firstline-${name}001.svg $tunedir/firstline-$name.svg
|
|
|
|
rm -f firstline.abc
|
2013-07-17 18:28:07 +01:00
|
|
|
|
|
|
|
# Make the web downloadable PDF with the tune title.
|
2019-08-05 23:25:28 +01:00
|
|
|
abcm2ps -E -F singletuneweb -O $tunedir/$name.eps $filename
|
2013-07-17 18:28:07 +01:00
|
|
|
# And make the corresponding PDF.
|
2019-08-05 23:25:28 +01:00
|
|
|
epstopdf --outfile=$tunedir/$name.pdf $tunedir/${name}001.eps
|
|
|
|
rm $tunedir/${name}001.eps
|
2012-03-04 12:39:12 +00:00
|
|
|
done
|