Browse Source

Improve langbook script running time and change to non-interactive mode

remotes/origin/translate_notes
Alexandre Dupas 14 years ago
parent
commit
38ed64db37
  1. 0
      utils/header-english
  2. 0
      utils/header-french
  3. 48
      utils/langbooks.sh

0
utils/header-en → utils/header-english

0
utils/header-fr → utils/header-french

48
utils/langbooks.sh

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

Loading…
Cancel
Save