somewhat huge directory restructuring, all non nexuizXX.zip files are stored in trunk...
[divverent/nexuiz.git] / misc / tools / demotc-race-record-extractor.sh
1 #!/bin/sh
2
3 d=$1
4 i=0
5 perl demotc.pl grep "$d" 'all-time fastest lap record with (.*)\n' | while IFS=" " read -r timecode result; do
6         timecode=${timecode%:}
7         result=${result#\"}
8         result=${result%\"}
9
10         echo "Possible record found at $timecode: $result, extracting..."
11
12         minutes=${result%%:*}
13         result=${result#*:}
14         seconds=${result%%.*}
15         result=${result#*.}
16         tenths=$result
17
18         timecode_start=`echo "$timecode - $minutes*60 - $seconds - $tenths*0.1 - 2" | bc -l`
19         timecode_end=`echo "$timecode + 2" | bc -l`
20         i=$(($i + 1))
21         perl demotc.pl cut "$d" "playback-$i.dem" "$timecode_start" "$timecode_end"
22         perl demotc.pl cut "$d" "capture-$i.dem" "$timecode_start" "$timecode_end" --capture
23 done