#!/bin/sh
# Wrap script for search and run Media Player in the host system
# (c) Etersoft 2008
# FIXME: GUI warning

# Get Unix path, do not translate URL
if echo "$1" | grep ".*://" >/dev/null ; then
    UNIXPATH="$1"
else
    UNIXPATH=`winepath "$1"`
fi

PLAYERLIST="vlc gxine xine kmplayer totem"

for i in $PLAYERLIST ; do
	test -n "$MPLAYER" && break
	MPLAYER=`which $i 2>/dev/null`
done
test -z "$MPLAYER" && { echo "No media player is found on your system." ; exit 1 ; }
test -z "$UNIXPATH" && { echo "Use with name of file as first arg." ; exit 1 ; }
$MPLAYER "$UNIXPATH"
