#!/bin/bash
#
# streaming - a little script to stream audio to the net
#
# Copyright (C) 2004 Ilja Gerhardt <ilja@so36.de>
#
# This source code is free software; you can redistribute it and/or
# modify it under the terms of the GNU Public License as published 
# by the Free Software Foundation; either version 2 of the License,
# or (at your option) any later version.
#
# This source code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# Please refer to the GNU Public License for more details.
#
# You should have received a copy of the GNU Public License along with
# this source code; if not, write to:
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

: ${DIALOG=dialog}
BT="StreamBOX"
TI=" StreamBOX "

# getting the strings in relation to the settings

[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n

case "$LANGUAGE" in
de|at|ch)
M01="Dieses Script führt mehrere Schritte aus,\ndie für das Streamen ins Netz notwendig\nsind:\n\nEs führt folgende Schritte aus:\n\n1) Sicherstellen das es Netz gibt\n2) Icecast I Server auf localhost starten\n3) Streamen\n\nNach Beeendigung des Scripts solltest Du\nDich auf einer anderen Konsole z.B. [Alt-F3]\nmit dem Kommando [radiochat] auf einen IRC\nServer einloggen\n\nEgocity + ASCII"
M02=" Netzkonfiguration starten? "
M03="Sollen wir das Netz mit dem Kommando netconfig konfigurieren?"
M04=" Streamingserver starten? "
M05="Willst Du den Streamingserver Icecast I starten?"
M06=" Streaming starten? "
M07="Sollen wir das MP3-Streaming starten?"
;;
*)
M01="This script runs several steps which are\nneccesary for streaming to the internet:\n\nThe following steps are run:\n\n1) ensure that the computer is on the internet\n2) start icecast I on localhost\n3) streaming\n\nAfter finishing of the script you should log\ninto an IRC-server e.g. with the command [radiochat]\n\nEgocity + ASCII"
M02=" start the netconfigscript? "
M03="Should we ensure the network-card-config with netcardconfig?"
M04=" start streamingserver? "
M05="Should we start the Icecast I server?"
M06=" start streaming? "
M07="Should we start the MP3-Streaming?"
;;
esac


###############
# show startdialog
$DIALOG --title "$TI" --backtitle "$BT" --cr-wrap --clear --msgbox "$M01" 0 0 
###############
# ask for netcardconfig
value=1
	$DIALOG --backtitle "$BT" --title "$M02" --clear --yesno "$M03" 0 0
	value=$?
	if [ $value == 0 ]
	then
		/usr/sbin/netcardconfig
	fi
##############
# ask for icecast server
value=1
	$DIALOG --backtitle "$BT" --title "$M04" --clear --yesno "$M05" 0 0
	value=$?
	if [ $value == 0 ]
	then
		/usr/sbin/icecaststart
	fi
##############
# ask for streaming script
value=1
	$DIALOG --backtitle "$BT" --title "$M06" --clear --yesno "$M07" 0 0
	value=$?
	if [ $value == 0 ]
	then
		/usr/local/bin/dstream
	fi
