#!/bin/sh

# This script handles auto-playing of movie CDs/DVDs

# This needs to be updated to read content.ini and handle 
# filenames containing spaces

discpath=/mnt/cdrom

mount /dev/cdrom $discpath
if [ -e $discpath/content.ini ]; then
	VIDEO_FILE=`grep Video= $discpath/content.ini | cut -d = -f 2`
	if [ -e "$discpath/$VIDEO_FILE" ]; then
		mplayer-script "$discpath/$VIDEO_FILE" -vo sdl -fs -osdlevel 0 -cache 16000 &> /tmp/mplayerlog &
	fi
elif [ -d $discpath/video_ts ] || [ -d $discpath/VIDEO_TS ]; then
#	mplayer-script -vo dxr3 -vc mpegpes -DVD 1 &> /tmp/mplayerlog &
#	xine-script -V dxr3 -pfhq dvdnav:// &> /tmp/xinelog &
	xine-script -Vxv -pfhq dvd:// &> /tmp/xinelog &
fi
umount $discpath
