#!/bin/sh
#
# c2007-2013 by Paul Sherman <psherma1@rochester.rr.com> http://www.pcbypaul.com 
# just a teeny wrapper to convert a wma file to an mp3.
#
pth=`dirname "$1"`
fle=`echo "$1" | tr ' ' '_'`
tmpfile=`basename "$fle"`
cp "$1" "/tmp/$tmpfile"
newfile=`echo "$tmpfile" | sed "s/\.wma/\.mp3/g"`
cd /tmp
mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader "$tmpfile" && lame -m s audiodump.wav -o "$newfile" 2>&1 | \
yad --title="Converting..." --window-icon="/usr/share/pixmaps/audio_convert.png" --progress --center --pulsate --auto-close --auto-kill --no-buttons --text="Converting to\n$newfile\n\nThis may take several seconds...\n"
mv "$newfile" "$pth/$newfile"
rm "$tmpfile"
rm audiodump.wav 2>/dev/null
yad --title "Success" --window-icon="/usr/share/pixmaps/audio_convert.png" --center --button="gtk-ok:0" --text="\n  Conversion Complete  \n" --timeout=5

