'new' script for automatic game insertion into database
authorShiar <shiar@shiar.org>
Fri, 11 Jan 2008 01:14:46 +0000 (01:14 +0000)
committerShiar <shiar@shiar.org>
Sat, 12 Jan 2008 01:00:43 +0000 (01:00 +0000)
new [new file with mode: 0755]

diff --git a/new b/new
new file mode 100755 (executable)
index 0000000..05509b4
--- /dev/null
+++ b/new
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+cd /var/log/pvpgn/reports
+ls -tgG | head -n 5 | tail -n 4
+read -ep 'report: ' report
+if [ ! "$report" ]; then
+       report=$(ls -t | head -n 1)
+       echo "Report file unspecified; using $report"
+fi
+if [ ! -r "$report" ]; then
+       echo "Report file $report not found"
+fi
+cd - > /dev/null
+echo
+
+read -p 'replay name: ' name
+if [ ! "$name" ]; then name=1x2; fi
+case "$name" in
+[1-9]x[1-9])
+       name=$(date +%Y%m%d)"bn$name"
+       echo "Only postfix specified; using $name"
+       ;;
+esac
+echo
+
+REPLAYPSET='shiar@shiar.demon.nl:sc.rep/replays/'
+echo $REPLAYPSET
+read -p 'replay location: ' replay
+case "$replay" in
+*.rep) ;;
+1 | '')
+       replay="$REPLAYPSET/$name.rep"
+       echo "Using preset replay location $replay"
+       ;;
+*)
+       replay="$replay/$name.rep"
+       echo Not ending in .rep; using $replay
+       ;;
+esac
+echo
+
+cp -ip "/var/log/pvpgn/reports/$report" "../replay/$name.txt" || exit 1
+case "$replay" in
+http:*)
+       wget "$replay" -O "../replay/$name.rep"
+       ;;
+*@* | *:*)
+       scp -p "$replay" "../replay/$name.rep" || exit 1
+       ;;
+*)
+       cp -p "$replay" "../replay/$name.rep" || exit 1
+       ;;
+esac
+
+./pvpgnreport ../replay/$name
+./screpextract ../replay/$name.rep | ./screp -a ../replay/$name.apm
+read -p 'retype replay id? ' gameid
+./screpextract ../replay/$name.rep | ./screp -d $gameid
+
+# UPDATE game SET speed = frames*.042 / extract('epoch' FROM COALESCE(duration, durationguess - '15 sec'));
+