#!/bin/sh
#
# This script is meant to make it easier to play log
# files generated by the keepaway players
# It expects the logdraw files to be in the
# directory with the same name as the logfile prefix.
#
# Gregory Kuhlmann (University of Texas at Austin) 2005
#

# Top-level Keepaway directory ** SET THIS OPTION **
keepaway_dir=~/keepaway-0.5
# Top-level RCSSJava directory
rcssjava_dir=`pwd`

#################################

log=$keepaway_dir/logs/$1
classpath=$rcssjava_dir/antlrall.jar:$rcssjava_dir/rcssjava.jar

if (( $#==0 ))
then
  echo "Usage: $0 <logfile prefix>"
  echo "(e.g. $0 200508301333-my.computer.edu)"
  exit
fi

if [ -f $log.rcg ]
then
  log_file="$log.rcg"
elif [ -f $log.log ]
then
  log_file="-s $log.log"
else
  echo "No log file found: $log.{rcg,log}"
  exit
fi

if [ -d $log ]
then 
  for draw_log in `find $log -name \*.log`
  do
    draw_logs="$draw_logs -d $draw_log"
  done
fi

cmd="java -cp $classpath rcssjava.logplayer.LogPlayer $draw_logs $log_file"
echo $cmd
$cmd
