Undid revisions 884 and 883, in effect removing the macosx directory.
[neverball] / import-metadada.sh
1 #!/bin/sh
2
3 level=$1
4 scores=$2
5 author=$3
6 tag=$4
7
8 cat $level | while read sol back shot grad time goal song; do
9         echo -n "$file: "
10         file=data/${sol/.sol/}
11         name=`basename $file`
12         echo "name=$name$tag"
13
14         grep $name $scores > .t
15         read t0 c0 t1 c1 t2 c2 rest < .t
16         rm .t
17         echo "scores $t0 $c0 $t1 $c1 $t2 $c2"
18
19         if [ "$c2" == "$goal" ]; then
20                 c2=$c1
21         fi
22
23         if grep -q '"back"' $file.map; then
24                 echo skip ;
25         else
26                 echo ok ;
27                 ed $file.map <<FIN
28 /"worldspawn"/
29 a
30 "author"    "$author"
31 "levelname" "$name$tag"
32 "version"   "1"
33
34 "back"      "$back"
35 "grad"      "$grad"
36 "shot"      "$shot"
37 "song"      "$song"
38 "time"      "$time"
39 "goal"      "$goal"
40
41 "time_hs"   "$t0 $t2"
42 "coin_hs"   "$c0 $c2"
43 .
44 w
45 q
46 FIN
47         fi
48 done