#!/bin/sh

# exit if no args
if [ $# = 0 ]; then
   exit 1
fi

# start imp3sh if not running
if [ ! -f "$IMP3RUNDIR/running" ]; then
        /usr/local/bin/imp3start
fi

# play the first arg
echo -n -e "play \"$1\"\n" > $IMP3RUNDIR/in
shift

# remaining arg count
x=$#

# queue any remaining args
for (( i = 0 ; $i < $x ; i++ )) ; do
  echo -n -e "fileq \"$1\"\n" > $IMP3RUNDIR/in
  shift
done

exit 0
