#!/bin/bash # convert music files to mp3 # need command line mplayer and lame # Michael.ZhanShi@Gmail.com musicdir="/Users/eickgadias/Music" for wmafile in "$@" do filename=$(echo $(basename "$wmafile") | sed 's/\.[^.]*//') #wavfile=/tmp/"$filename".wav echo "Begin decoding $wmafile ..." #mkfifo "$wavfile" mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader "$wmafile" 1>/dev/null 2>/dev/null if [ $? -ne 0 ] then echo "Decoding failed" echo rm -f audiodump.wav continue fi echo "Begin encoding in mp3..." lame -h -b 192 audiodump.wav "$musicdir/$filename.mp3" 1>/dev/null 2>/dev/null if [ $? -ne 0 ] then echo "Encoding failed" echo rm -f audiodump.wav "$musicdir/$filename.mp3" continue fi #open "$musicdir/$filename.mp3" rm -f audiodump.wav echo done exit 0