mirror of https://github.com/patacrep/patacrep.git
Alexandre Dupas
16 years ago
1 changed files with 35 additions and 0 deletions
@ -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…
Reference in new issue