#!/bin/sh
#
# burn-shns
#
# Take a directory of SHN files and uncompress them and burn them on a
# CD
#
# $Id: burn-shns,v 2.2 2002/10/23 12:27:19 cepstein Exp $

set -e

# BURN_DIR environment variable sets where .wav files are extracted.
# Default is /var/tmp/burn unless you have it set.
BURN_DIR=${BURN_DIR:-/var/tmp/burn}

test -d $BURN_DIR || mkdir -p $BURN_DIR

if [ $# -eq 0 ]; then
    set `pwd`
fi

cd $BURN_DIR

# Remove any stray .wav, .bin and toc files
rm -f *.wav toc data.bin

echo Burning SHN files in "$@"
unshn "$@" && time cdrecord -v -pad -dao -eject *.wav
