2016-01-07 14:47:02 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-02-19 19:49:13 +01:00
|
|
|
MKDRUMCOMMAND="./lilydrum/makedrum"
|
|
|
|
MKDRUMOPTIONS="--no-log -i ./defs/defs.ly -i ./defs/header_default.ily --drumfile ./lilydrum/lilydrum.ly --pipefile ./bagpipemusic/bagpipe_new.ly -s 18"
|
2016-02-19 14:39:53 +01:00
|
|
|
MUSIC_DIR="./music/"
|
2016-02-20 16:39:11 +01:00
|
|
|
OUT_DIR="./pdf"
|
2016-02-19 14:39:53 +01:00
|
|
|
MKDRUMOPTIONS="$MKDRUMOPTIONS -d $OUT_DIR"
|
2016-01-07 14:47:02 +01:00
|
|
|
|
|
|
|
trap "echo Aborted!; exit;" SIGINT SIGTERM
|
|
|
|
|
|
|
|
another_dir() {
|
|
|
|
d=$1
|
|
|
|
for f in $d/*
|
|
|
|
do
|
|
|
|
if [ -d "$f" ]; then
|
|
|
|
if [ "$f" == "template" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
another_dir $f
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
if [ ! -f "$f" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! "$f" == *.ly ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
$MKDRUMCOMMAND $MKDRUMOPTIONS "$f"
|
|
|
|
done;
|
|
|
|
}
|
|
|
|
|
2016-02-19 14:39:53 +01:00
|
|
|
if [ "$1" == "--all" ]; then
|
2016-01-07 14:47:02 +01:00
|
|
|
echo "Build all"
|
|
|
|
another_dir $MUSIC_DIR
|
|
|
|
elif [ -f "$1" ]; then
|
|
|
|
echo "Build file"
|
|
|
|
$MKDRUMCOMMAND $MKDRUMOPTIONS "$1"
|
|
|
|
elif [ -d "$1" ]; then
|
|
|
|
echo "Build files in directory"
|
|
|
|
another_dir "$1"
|
|
|
|
fi
|
2016-02-19 14:39:53 +01:00
|
|
|
|
2016-02-19 19:49:13 +01:00
|
|
|
# Fix naming
|
2016-02-20 16:39:11 +01:00
|
|
|
for f in $OUT_DIR/music-* ;
|
2016-02-19 14:39:53 +01:00
|
|
|
do
|
2016-02-20 16:39:11 +01:00
|
|
|
#if [[ ! "$f" == *music-* ]]; then
|
|
|
|
# continue;
|
|
|
|
#fi
|
|
|
|
mv "$f" "${f/"music-"}";
|
2016-02-19 14:39:53 +01:00
|
|
|
done;
|