#!/bin/sh -e

MUSICHOME=/home/cds/audio/mp3/
if [ $# -lt 1 ] ; then
	echo "Usage: $0 <file>"
	exit
fi
FILE=${MUSICHOME}/$1
if [ ! -f "$FILE" ] ; then
	echo "$0: No such file '${FILE}'"
	exit
fi
if file "${FILE}" | grep -q MPEG ; then
    if `echo "$FILE" | grep -q -i '.aac$'` ; then
        PLAYER=mpv
    else
	PLAYER=mpg321
    fi
else
    if file "${FILE}" | grep -q "Vorbis audio" ; then
	PLAYER=ogg123
    else
	echo "$0: Unknown file type for '${FILE}'"
	exit
    fi
fi
$PLAYER $FILE 2>/dev/null
