#!/bin/bash

#
# This is a simple shell script that demonstrates how to use artscat to play
# audio data via the aRts.
#
# mpg123 should be installed and is used to play the data to started output
# (option -s), then the data is sent to aRts via artscat, setting the type
# mp3 and the description from the filename
#

MPG123=mpg123
ARTSCAT=artscat
KONSOLE=konsole

for i in $MPG123 $ARTSCAT $KONSOLE
do
  if test -z `which $i`; then
    echo "$0 needs $i to work"
    exit 1;
  fi
done

for file in $*
do
  DESC=$(basename "$file")
  $KONSOLE -vt_sz 30x5 -e bash -c \
  	"$MPG123 -s '$file' | $ARTSCAT -d '$DESC' -t mp3"
done
