How to play DVDs in Linux/DVD play script

This is a pretty hand script to play the longest track on a DVD, using MPlayer

It also has some other fetures
 * Play a specific track
 * Usage: DVD -t #
 * List all tracks, and ask which track to play
 * Usage: DVD -a

This script requires
 * lsdvd
 * MPlayer


 * 1) !/bin/bash


 * 1) DVD->MPlayer
 * 2) Version: v0.01
 * 3) Creater: Jeff Israel
 * 4) Licese: GPL
 * 5) Description:
 * 6) 	Plays longest track of dvd or track selected by user
 * 7) Usage:
 * 8) 	dvd {mplayer parameters}
 * 9) 	dvd -a {mplayer parameters}
 * 10) 	dvd -t [0-9] {mplayer parameters}
 * 11) Options
 * 12) 	Have mplayer play lsdvd's longest track
 * 13) 		Option: blank
 * 14) 	Prints this help message
 * 15) 		Option: -h or --help
 * 16) 	Enter track number
 * 17) 		Option: -t
 * 18) 		Usage: -t [#]
 * 19) 	Interactiv: Displays lsdvd output, and ask for track number
 * 20) 		Option: -a
 * 21) 		Usage: -a
 * 1) 		Usage: -t [#]
 * 2) 	Interactiv: Displays lsdvd output, and ask for track number
 * 3) 		Option: -a
 * 4) 		Usage: -a


 * 1) echo $0
 * 2) echo $@
 * 3) echo $#
 * 4) echo $1
 * 5) echo $0

if | $1 == '--help' ;then echo ' Description: Plays longest track of dvd or track selected by user
 * 1) Help output
 * 1) Help output

Usage: dvd {mplayer parameters} dvd -a {mplayer parameters} dvd -t [0-9] {mplayer parameters} /not enabled yet

Options Have mplayer play lsdvds longest track Option: blank Prints this help message Option: -h or --help Enter track number Option: -t Usage: -t [#] Interactiv: Displays lsdvd output, and ask for track number Option: -a Usage: -a '	exit 0 fi

[ -n "$(which lsdvd)" ] || die 'lsdvd not installed' [ -n "$(which mplayer)" ] || die 'mplayer not installed'
 * 1) Checks for 'lsdvd', and 'mplayer' installed
 * 1) Checks for 'lsdvd', and 'mplayer' installed


 * 1) echo $@
 * 2) params=$@
 * 3) echo $params
 * 4) paramShift=${params[@]}
 * 5) echo $paramShift
 * 6) set $paramShift
 * 7) echo ${paramShift[0]}
 * 8) shift
 * 9) shift
 * 10) echo $paramShift
 * 11) shift
 * 12) echo $paramShift


 * 1) The program....
 * 1) The program....

echo "======================================================================" if $@ == *'-a'* ; then #Interactive track entry x=1 lsdvd | more while [ $x ]; do		echo -n "Enter the track you want (^C to quit): " read trackEntry echo "you entered _ $trackEntry _" if | $trackEntry == [0-9][0-9] ; then trackNum=$trackEntry break else echo "Input error, needs to be a number....." fi done elif $@ == *'-t'* ; then  #Manually entered track set -- $* for i	do if $1 == '-t' ; then shift; echo "Track set to: $1, by you"; trackNum=$1 shift; else params="$params $1"; #echo "boo: $1"; shift; fi done echo "the params w/ -t: $params"; echo "======================================================================" else #Autochecking for the longest track echo "checking for longest track..." discinfo=`lsdvd 2>/dev/null` trackNum=`echo "$discinfo" | grep '^Longest track: ' | sed 's/.*: 0*//'` #echo "lsdvd says: track num $trackNum" if -n $trackNum ; then echo "track set to $trackNum, by lsdvd" echo "ready to play..." echo "======================================================================" else echo "No track number!" echo "U didn't enter one, and lsdvd didn't find one." echo "Did u put a disk in?" echo "======================================================================" exit 0 fi fi

echo echo

if -n $trackNum ; then echo "Now playing track: $trackNum" mplayer "dvd://$trackNum" fi
 * 1) Run mplayer...
 * 1) Run mplayer...

echo echo "======================================================================" echo "bye bye...."

#echo "No track number!" #echo "U didn't enter one, and lsdvd didn't find one." #echo "Did u put a disk in?"
 * 1) if -z $trackNum ; then
 * fi