#!/bin/sh 
# $Id: gmp,v 1.6 2006/02/12 07:02:21 grog Exp $
#
# Play a DVD.
# usage:  gmp image-file track
if [ "$3" != "" ]; then
  export DISPLAY=$3
else
  export DISPLAY=teevee:0
fi
DVD=$1
shift
if [ "$*" != "" ]; then
  track=$1
else
  track=1
fi
if [ ! -f $DVD ]; then
  echo $DVD does not exist
  exit 1
fi
dev=`mdconfig -a -t vnode -f $DVD`
echo DVD device is $dev
xtset gmplayer: $DVD, track $track
nice -20 gmplayer -zoom -x 1280 -y 900 dvd://$track -monitoraspect 16:9 -alang en -framedrop -dvd-device /dev/$dev
mdconfig -d -u `echo $dev | sed 's:md::'`
echo -n "Remove $DVD? "
read reply
if [ "$reply" = "yes" ]; then
  rm $DVD
  echo Removed $DVD
else
  echo Not removing $DVD
fi
xtset `pwd`: Empty slot
