[MPlayer-users] problem running mplayer in script

Martin Collins martin at mkcollins.org
Mon May 10 11:17:30 CEST 2004


On Mon, 10 May 2004 02:57:34 -0400
Steve <steve at szmidt.org> wrote:

> I've been trying to get mplayer to play/convert .wma files and it
> only works from the command prompt for some reason. Here's the
> script:
> 
> Dir="~/MyMusic"
> CDir="`pwd`"
> cd $Dir
> i=1
> CmdLine="mplayer -aop list=volume:volume=100"
> 
> find /home/steve/MyMusic/* -name "*.wma"|sort|while read song ; do
>         song="/home/steve/MyMusic/Yes/Union/13-Evensong.ogg"
>         exec $CmdLine "${song}${ext}"
>         i=$(($i+1))
>         exit 0
> done
> cd "$CDir"

Try adding -v to the mplayer command line. Then it will tell you what
it thinks its command line is.
The while read song thing seems a strange way to do it. How about

for i in `find ...`
do
	mplayer ... $i
done

Check out basename and dirname.
You might hit a limit with the find in which case you will need recursion
to walk the directory tree so use a function.

Martin




More information about the MPlayer-users mailing list