#!/bin/bash echo "`basename $0`, Spawn 2005 " option=-1 error="cdrom isn't inserted" choice="mplayer -fs" case "$1" in "-h") echo "Usage: " echo " `basename $0` [-x , -a, -h - n ]" echo " script that mounts and plays video file from cdrom; if launched without" echo " options and there's only one DivX, or the like, file on the cd, mplayer" echo " will be launched" echo "" echo "Warning: this script will not work if the files are sorted in subdirectories;" echo " Note: mplayer will be always launched in fullscreen mode" echo "Options: " echo " -a if more than one file, all videos will be played," echo " in alphabetic order" echo " -h display this help and exit" echo " -x change mplayer with your preferred video player" echo " -n if more than one file, choose the number of the file" echo " to be played" exit 0 ;; "") option=0 ;; "-a") option=1 ;; "-x") choice=$2 option=0 ;; "-n") number=$2 option=2 ;; *) `cat $0 -h` echo "" echo "option '$1' not recognized!" exit 1 ;; esac case $3 in "-a") option=1 ;; "-n") number=$4 option=2 ;; "-x") choice=$4 ;; *) ;; esac mount /cdrom cd /cdrom ls case "$option" in "0") if test * = *.avi -o * = *.mpg -o * = *.ogm -o * = *.mpeg ; then case "$choice" in "mplayer") $choice * ;; *) $choice * ;; esac else echo "" echo "$error, or is not a cd containing videos or there are more than one file, try with: " echo " -a or -n , or change your cd! :) " fi ;; "1") $choice * ;; "2") for file in * do case "$number" in "1") $choice "$file" exit 0 ;; *) number=`expr $number - 1` ;; esac done ;; esac