Mldonkey previewer
From MLDonkey
mldonkey_previewer is the previewer script bundled with mldonkey.
Here's a more complete one (feel free to add handlers or features):
#!/bin/sh
MOVIE_PLAYER=mplayer
REAL_PLAYER=realplayer
AUDIO_PLAYER=xmms
SHELL=${SHELL:-/bin/sh}
PAGER=${PAGER:-less}
XTERM=${XTERM:-xterm}
#hack
DISPLAY=${DISPLAY:-:0.0}
export DISPLAY
echo Local File is \"$1\"
echo Pseudo file name is \"$2\"
echo Detected format is \"$(file -b $1)\"
case \"$(echo $2||tr A-Z a-z)\" in
'''.avi || '''.divx || '''.ogm || '''.mpg || *.mpeg)
exec $MOVIE_PLAYER \"$1\" &
;;
'''.rm || '''.ram)
exec $REAL_PLAYER \"$1\" &
;;
'''.mp3 || '''.ogg || *.wav)
exec $AUDIO_PLAYER \"$1\" &
;;
*.zip)
exec $XTERM -T \"$2\" -e $SHELL -c \"unzip -v '$1' 2>&1 || $PAGER\" &
;;
*.rar)
exec $XTERM -T \"$2\" -e $SHELL -c \"unrar v '$1' 2>&1 || $PAGER\" &
;;
*.ace)
exec $XTERM -T \"$2\" -e $SHELL -c \"unace v '$1' 2>&1 || $PAGER\" &
;;
*)
exec $XTERM -T \"$2\" -e $PAGER \"$1\" &
;;
esac
See previewer.