Pour du graphique, je n'ai pas mais pour du récursif
je te propose ce script simple
# !/bin/bash
CURRENT_DIR=`pwd`;
function check_prog() {
STATUS_EXEC=0;
if [ ! -e /usr/bin/mp3info ]; then
echo "Sorry, mp3info is required"
STATUS_EXEC=1;
fi
if [ ! -e /usr/bin/mpg123 ]; then
echo "Sorry, mpg123 is required"
STATUS_EXEC=1;
fi
if [ ! -e /usr/bin/oggenc ]; then
echo "Sorry, oggenc is required"
STATUS_EXEC=1;
fi
}
function mp3togg() {
cd $1;
for REP in `find -type d` ; do
for i in $REP/*.mp3 ; do
if [ -f "$i" ]; then
echo "$i -> $i.ogg";
# Recuperation du bitrate du fichier mp3:
BIT=`mp3info -x -F -r 'm' "$i" | grep Audio | cut -d" " -f8`;
echo " Bitrate : $BIT";
# Recuperation du taux d'echantillonnage du fichier mp3:
Hz=`mp3info -x -F -r 'm' "$i" | grep Audio | cut -d" " -f10 | cut -d"K" -f1`;
Hz=$[$Hz*1000+100];
echo "Taux d'echantillonnage : $Hz";
# Convertion au format Ogg:
mpg123 -q -s "$i" | oggenc -Qr -b $BIT -C 2 -R $Hz -o "$i.ogg" -;
fi
done
done
}
# Renomme l'extention *.mp3.ogg en *.ogg
function rename_file() {
cd $1;
for REP in `find -type d` ; do
for i in $REP/*.mp3.ogg ; do
if [ -f "$i" ] ; then
rename .mp3.ogg .ogg "$i";
fi
done
done
}
if [ $# -eq 1 ]; then
check_prog;
if [ $STATUS_EXEC -eq 1 ]; then
echo "Program exit";
exit 1;
else
# Appel des fonctions
if [ -d $1 ]; then
mp3togg $1;
rename_file $1;
echo "[ Termine ]";
cd $CURRENT_DIR;
fi
fi
else
echo "Usage : $0 <répertoire>";
fi
Poste le Friday 14 May 2004 14:56:17