#!/bin/bash

# NEWSTYPE is either ARRL or ARN, Always required as parameter 1
#
if [ -z "$1" ]
  then
     echo "No Play type given - ARN or ARRL"
     exit 1
  else
     NEWSTYPE=${1}
     if [ "$NEWSTYPE" != "ARN" ] && [ "$NEWSTYPE" != "ARRL" ]
        then
           echo "Play type must be ARRL or ARN"
           exit 1
     fi
fi

TMPDIR="/tmp"
VOICEDIR="/home/irlp/custom/voice"

# send start announcment
# Add 3 second delay to beginning of text
sleep 3
#/usr/local/bin/voicetransmit KD8TUZ_B $VOICEDIR/${NEWSTYPE}start.dvtool
	ambestream -t "${NEWSTYPE} starting....." -v -4 -my KD8TUZ -d rep.w8rnl.com -bi 7500 -bl 1000 -p 40000 W8RNL  B $VOICEDIR/${NEWSTYPE}start.dvtool
	ambestream -t "$NEWSTYPE News Line." -v -4 -my KD8TUZ -d rep.w8rnl.com -bi 7500 -bl 1000 -p 40000 W8RNL  B $TMPDIR/${NEWSTYPE}RNLB.dvtool
	ambestream -t "${NEWSTYPE} stopped....." -v -4 -my KD8TUZ -d rep.w8rnl.com -bi 7500 -bl 1000 -p 40000 W8RNL  B $VOICEDIR/${NEWSTYPE}stop.dvtool

# Remove all files created by playnews
#rm -f $TMPDIR/$NEWSTYPE*

# Done
exit 0
