[mythtv-users] MythVideo CVS, mplayer, and MythTivo
Brent Graveland
brent at graveland.net
Sat May 31 21:40:50 EDT 2003
John Danner wrote:
> I am planning on adding the ability to specify multiple players based on file
> extension. I wanted to put what I had into cvs so I had just setup a default
> player for the time being.
>
> -John
Why clutter the gui and database with a possible list of 30 extentions?
Leave it as is and add a script that does all the work for you. I've
attached my crappy script that can be modified to suit.
Follow the unix way :) don't bother with extentions - check the file
type. Remember - scripts are not a bad thing.
--
Brent Graveland
brent at graveland.net
-------------- next part --------------
#!/bin/bash
# Brent Graveland, 2003
# Play multimedia files using the appropriate program
trap 'continue' 2
trap 'exit 1' 1 3 15
function play_file() {
type="$1"
file="$2"
case "$1" in
real) realplay "$file";;
wav) play "$file";;
*) mplayer -quiet -stop_xscreensaver "$file";;
esac
}
function play_dev() {
mplayer -cdrom-device /dev/dvd -stop_xscreensaver -quiet -fs $1://1 -alang en
}
while [ $# -gt 0 ]; do
file="$1"; shift
type=unknown
[ "$file" = dvd -o "$file" = vcd ] && play_dev $file
[ ! -f "$file" ] && continue
case "$(file -b "$file" | tr \[A-Z\] \[a-z\])" in
*asf) type=avi;;
mp3*|*layer\ 3*) type=mp3;;
mpeg*|riff*avi) type=mpg;;
realmedia*) type=real;;
ogg*) type=ogg;;
riff*wave*) type=wav;;
*quicktime*) type=mov;;
*) type=other;;
esac
play_file "$type" "$file"
done
More information about the mythtv-users
mailing list