#!/bin/bash

#mplayer_music
#foolswood 2012, GPL

#Requires mplayer and xmessage

RUNNING=`ps -e | grep mplayer | grep -v music`

if [ -n "$RUNNING" ]; then
	echo "running mplayer detected"
	echo "loadfile \"$1\" 1" > /tmp/mp_pipe
else
	mkfifo /tmp/mp_pipe
	mplayer -slave -input file=/tmp/mp_pipe "$1" &
	xmessage -button Stop 'Music Is Playing...'
	killall mplayer
	rm /tmp/mp_pipe
fi
