#!/bin/sh

USERCONFIG="$HOME/.kanotix-vdr.conf"

# Localisation
export TEXTDOMAINDIR="/usr/share/locale"
export TEXTDOMAIN=kanotix-vdr

if [ ! -e $HOME/vdrip.conf ]; then
   export VDRIP=`Xdialog --inputbox $"VDR Server IP" 10 50 "localhost" 2>&1`
   if [ "$VDRIP" = "" ]; then
	exit;
   fi
   echo $VDRIP > $HOME/vdrip.conf
 else
   export VDRIP=`head -1 $HOME/vdrip.conf`
fi

runxine="0" && runxine=`ps -A|grep -c xine`
[ ! "$runxine" = "0" ] && /usr/sbin/vdr-xine-close
sleep 1

XineFullscreen=""
[ -f "$USERCONFIG" ] && [ "$(grep ^XineFullscreen $USERCONFIG | cut -d= -f2)" -eq 1 ] && XineFullscreen="-f"

export MRL="xvdr:udp://$VDRIP#nocache;demux:mpeg_block"
[ -f "$USERCONFIG" ] && [ "$(grep ^XinePlugin $USERCONFIG | cut -d= -f2)" -eq 1 ] && export MRL="vdr-socket:/"$VDRIP"#demux:mpeg_pes"

xine ${XineFullscreen} -g --no-splash $MRL &

