|
@ -4,35 +4,19 @@ |
|
|
#Date: 14/11/2010 |
|
|
#Date: 14/11/2010 |
|
|
#Description: Generate an sb file containing all the songs in a given language |
|
|
#Description: Generate an sb file containing all the songs in a given language |
|
|
|
|
|
|
|
|
echo "Build songbook file for songs in english (1), french (2)" |
|
|
if [ $# -ne 1 ]; |
|
|
read answer |
|
|
then |
|
|
case "$answer" in |
|
|
echo "Usage: $0 LANG" |
|
|
1) |
|
|
exit 1 |
|
|
cat ./utils/header-en > english.sb |
|
|
fi; |
|
|
for song in songs/*/*.sg; |
|
|
|
|
|
do |
|
|
LANG=$1 |
|
|
if grep -q "selectlanguage{english}" $song |
|
|
|
|
|
then |
|
|
if [ $LANG="english" -o $LANG="french" ]; |
|
|
echo "\t\""`ls $song | sed "s/songs\\///g"`"\"," >> english.sb |
|
|
then |
|
|
fi |
|
|
cp "./utils/header-$LANG" "$LANG.sb" |
|
|
done |
|
|
grep "selectlanguage{$LANG}" songs/*/*.sg | sed 's|songs/\(.*\):.*| \"\1\",|; $ s|,$|\n ]\n}\n|' >> "$LANG.sb" |
|
|
#remove last coma before bracket |
|
|
else |
|
|
truncate --size=-2 english.sb |
|
|
echo "Error: $LANG is not a supported language" |
|
|
#close json values for key "songs" |
|
|
exit 2 |
|
|
echo "]\n}" >> english.sb |
|
|
fi; |
|
|
;; |
|
|
|
|
|
2) |
|
|
|
|
|
cat ./utils/header-fr > french.sb |
|
|
|
|
|
for song in songs/*/*.sg; |
|
|
|
|
|
do |
|
|
|
|
|
if grep -q "selectlanguage{french}" $song |
|
|
|
|
|
then |
|
|
|
|
|
echo "\t\""`ls $song | sed "s/songs\\///g"`"\"," >> french.sb |
|
|
|
|
|
fi |
|
|
|
|
|
done |
|
|
|
|
|
#remove last coma before bracket |
|
|
|
|
|
truncate --size=-2 french.sb |
|
|
|
|
|
#close json values for key "songs" |
|
|
|
|
|
echo "]\n}" >> french.sb |
|
|
|
|
|
;; |
|
|
|
|
|
esac |
|
|
|
|
|