#!/bin/sh

mod=$1
if [ "$mod" = "" ] ; then
   mod=0
fi

#first, if a cd is playing, pause/unpause it
case "$mod`cdinfo`" in
	0paused*)
		exec cdstop
		;;
	0play*)
		exec cdstop
		;;
esac

if [ "$mod" = "0" -o "$mod" = "1" ] ; then
        xmmsstatus=`xmmsstatus`
        if [ "$xmmsstatus" != none ] ; then
            exec xmms --stop
        fi
fi

#if not, try getting xmms to unpause/pause the mp3 track

#if not, the last chance we have is to play a stopped cd. Nothing will happen if there is nothing in the cdplayer.
cdstop
