#!/bin/env bash

# Functionality for bin/cue burning
# Not well tested, report any bugs

burn_bincue()
{
	# cdrdao does not like speed being set to -1
	if [ "${BBSPEED}" -eq -1 ]; then
		BBSPEEDBAK=${BBSPEED}
		BBSPEED=8
	fi

        if eval "${BB_CDIMAGECMD} write --device \"${BBCDWRITER}\" --driver generic-mmc --speed \"${BBSPEED}\" -v 2 --eject \"${BBBURNDIR}\"/`ls \"${BBBURNDIR}\" | grep [Cc][Uu][Ee]`"; then
                echo $bb_bincue_burn_1
                wait_for_enter                  # Press enter to return to main
        else
                echo $bb_bincue_burn_2
                wait_for_enter                  # Press enter to return to main
        fi

	# Restore old speed setting
	BBSPEED=${BBSPEEDBAK}
	unset ${BBSPEEDBAK}
}
