#!/bin/sh

##################################################################################
##										##
##			Script queimador de ISOs				##
##										##
## Realizado por: Antonio Sanchez «guadafan» <introlinux@gmail.com> e		##
##		  Miguel Anxo Bouzada «miguelbf» <mbouzada@gmail.com>		##
## Para: GALPon MiniNo <minino@galpon.org>					##
## Licencia: Este script divulgase SEN NINGUNHA GARANTÍA e baixo a licenza	##
## pública xeral GPL/GNU	 						##
##										##
## Dependencias: cdrskin → que a su vez depende de: libisofs(6) y libburn(4)	##
##               Zenity							##
##										##
##################################################################################

case $LANG in
	es*)
		TIT1="X-burn-iso"
		MSG1="IMPORTANTE\nSi utiliza discos regrabables
y tienen algún contenido
serán borrados automáticamente.\n
Asegúrese de que utiliza el disco correcto.\n
			¿Desea continuar?"
		TIT2="Seleccione un archivo"
		MSG2="Velocidad de grabación"
		MSG3="Grabando"
		MSG4="\n\nPor favor espere...\nEsta tarea puede tardar varios minutos.\n"
		;;
	gl*)
		TIT1="X-burn-iso"
		MSG1="IMPORTANTE\nSi utiliza discos regravabeis
e si teñen algún contido
serán borrados automáticamente.\n
Asegurese de que utiliza o disco correcto.\n
			Desexa continuar?"
		TIT2="Seleccione un ficheiro"
		MSG2="Velocidade de gravación"
		MSG3="Gravando"
		MSG4="\n\nPor favor agarde...\nEsta tarefa pode tardar varios minutos.\n"
		;;
	*)
		TIT1="X-burn-iso"
		MSG1="WARNING\nIf you use rewritable discs and if
they have some content will be deleted
automatically.\n
Make sure you use the correct disc.\n
			Continue?"
		TIT2="Select a file"
		MSG2="Speed Record"
		MSG3="Recording"
		MSG4="\n\nPlease wait...\nThis may take several minutes.\n"
		;;
esac

if [ -z "$@" ]; then
	ficheroISO=`zenity --file-selection --title="$TIT2"`
	echo "$ficheroISO tomada desde diálogo zenity"
else
        ficheroISO=`echo $1`
	echo "$ficheroISO tomada desde arrastrar y soltar"
fi

if [ -z "$ficheroISO" ]; then
	exit
fi

zenity --question --title "$TIT1" --text="$MSG1"

case $? in
	0)
#		veloc=$(zenity --scale --title "$TIT1" --text "$MSG2" --min-value=1 --max-value=24 --value=4 --step 1);echo $veloc
#		if [ -z "$veloc" ]; then
#   			exit
#		fi
#		cdrskin -v -blank=as_needed -eject -speed=$veloc "$ficheroISO" | \
#		zenity --title="$TIT1" --progress --pulsate --text="$MSG3 `basename $ficheroISO` ...$MSG4"

		cdrskin -v -blank=as_needed -eject "$ficheroISO" | \
		zenity --title="$TIT1" --progress --pulsate --text="$MSG3 `basename $ficheroISO` ...$MSG4"
		;;
	1) exit ;;	#NO
	255) exit ;;  #ESC
esac

