I had to make a minor change to get it working with the latest version
of mplayer.
Requirements: Lame, mplayer.
To save the script, do this:
sudo
gedit /usr/bin/wma2mp3
then copy paste the code.
Then type:
sudo
chmod a+x /usr/bin/wma2mp3
If you don't have sudo, then just remove sudo and run the commands as
root.
Here is the code:
#!/bin/bash
current_directory=$( pwd )
#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done
#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao
pcm:waveheader $i && lame -m s audiodump.wav -o $i; done
#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done
rm audiodump.wav
The script runs without any arguments, and it will convert all files in the folder.
No comments:
Post a Comment