Browse Source

Add the script that fills cover information semi-automatically.

remotes/origin/translate_notes
Alexandre Dupas 15 years ago
parent
commit
4e28b34e3c
  1. 35
      utils/cover.sh

35
utils/cover.sh

@ -0,0 +1,35 @@
#!/bin/sh
for directory in songs/*; do
images=`ls $directory/*.{jpg,png} 2> /dev/null`
val=`echo $images | wc -w`
for song in $directory/*.sg; do
sg=`basename $song`
sed -i '0,/\\gtab/s//\\cover\n\\gtab/' $song
if [ $val -gt 1 ]
then
i=1
for image in $images; do
img=`basename $image .jpg`
img=`echo $img | sed 's/.png$//'`
echo "Apply $img to $song ? ($i/$val)"
i=$(($i+1))
read answer
case "$answer" in
"y")
sed -i 's/beginsong{\([^}]*\)}\[\([^]]*\)\]/beginsong{\1}[\2,cov='$img']/' $song
break;
;;
"n")
true
;;
esac
done;
elif [ $val -eq 1 ]
then
img=`basename $images .jpg`
img=`echo $img | sed 's/.png$//'`
echo "Applying $img to $sg"
sed -i 's/beginsong{\([^}]*\)}\[\([^]]*\)\]/beginsong{\1}[\2,cov='$img']/' $song
fi;
done;
done;
Loading…
Cancel
Save