[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: wma :-( to mp3



<quote who="Fabio Nigi <nigifabio@gmx.it>">:

[🔎] 20050325113929.485ed9af@fabiolone.dyndns.org

> 
> bello..lungo e incapibile :-)
> da bash-offuscated-code :-)
> 
> però non funziona!:-(

Si che funziona! :-)

Scarica il file attachato, rendilo eseguibile, e dai ./convert.sh

> 
> ..
> Fabio
> 


-----------------------------
	Laurent Dhima
Linux linuxway 2.6.8-1-386 #1 Thu Nov 25 04:24:08 UTC 2004 i686
GNU/Linux


-- 
      Powered by
   ** Gnu/Linux **
     Debian SID
 Linux User #219372
#!/bin/sh

dialog --title "WmaToMp3" --msgbox "Welcome to Wma to Mp3 Converter!!" 9 28
dialog --msgbox "Lets take a minute to setup some options..." 9 28
dialog --title "Pick One" --menu "Step one: Where would like for me to search for files?" 10 60 3 1 "Entire Computer" 2 "Current Directory and all subdirectories" 3 "Current Directory Only" 2>_1.txt
DIR_OPT=$(cat _1.txt)
dialog --title "Pick One" --menu "Step two: What would like for me to convert them to?" 10 60 2 1 "Mp3" 2 "Leave as wav" 2>_1.txt
CONVERT_OPT=$(cat _1.txt)
if [ $CONVERT_OPT = 1 ];
then
dialog --title "Pick One" --menu "Step three: What bitrate would you like to use?" 10 60 4 1 "64 - Poor" 2 "128 - Better" 3 "192 - Recommended" 4 "320 - Insane" 2>_1.txt
BIT_OPT=$(cat _1.txt)
fi
dialog --title "Pick One" --yesno "Step four: Would You like for me to remove the wma files after converting?" 10 40
DEL_OPT=$?
dialog --title "Converting" --infobox "Converting...
This usually takes a while. Just put on another pot of coffee." 10 60

if [ $BIT_OPT = 1 ]; then
BIT_OPT=64
elif [ $BIT_OPT = 2 ]; then
BIT_OPT=128
elif [ $BIT_OPT = 3 ]; then
BIT_OPT=192
elif [ $BIT_OPT = 4 ]; then
BIT_OPT=320
fi

if [ $DIR_OPT = 1 ]; then
find / -name *.wma > wmalist.dat
elif [ $DIR_OPT = 2 ]; then
find . -name *.wma > wmalist.dat
elif [ $DIR_OPT = 3 ]; then
ls *.wma > wmalist.dat
fi

cat wmalist.dat | sed -e "s/ /##/g" > wmalist
rm -rf wmalist.dat

for i in $(cat wmalist)
do
total=$((total+1))
i=$(echo $i | sed -e "s/##/ /g")
##Begin audiodump

mplayer -vo null -vc dummy -af resample=44100 -ao pcm -waveheader ''"$i"'' > audiodump.dat;

if [ $CONVERT_OPT = 2 ]; then
NEWNAME=`echo "$i.wav" | sed -e "s/.wma//g"`
mv "audiodump.wav" ''"$NEWNAME"''
elif [ $CONVERT_OPT = 1 ]; then

##Get song information

title=$(sort audiodump.dat | grep " name: " | sed -e "s/ name: //g")
name=$(sort audiodump.dat | grep " author: " | sed -e "s/ author: //g")
rm audiodump.dat


##Begin Encoding

lame -v -b $BIT_OPT -q 0 --tt "$title" --ta "$name" audiodump.wav ''"$i.mp3"'';
rm audiodump.wav;
NEWNAME=`echo "$i.mp3" | sed -e "s/.wma//g"`;
mv "$i.mp3" ''"$NEWNAME"'';

fi

##Remove file if opted

if [ $DEL_OPT = 0 ]; then
rm -f ''"$i"''
fi

done

dialog --title "All Done!!" --msgbox "I have finished converting all $total of your wma files. Enjoy!!" 10 60

##Clean up
rm _1.txt
rm wmalist
exit 0

Reply to: