> >
> > may i make another suggestion: it would be nice to be able to encode
> > a batch of files with one command, without writing a shell script. what
> > would you guys think of changing the default behaviour of lame so that
> > it encodes all the files on it's command line, adding a .mp3 extension
> > to the encoded version. an option should be provided to specify whether
> > or not to delete the original file.
> >
> > btw: anybody on this list buying an empeg car unit?
> >
> > best regards,
> > -gerhard
> > --
>
> the command line parsing in Lame is becoming quite a mess, so I would
> be afraid to try to add this. But if you send me a script that can do
> this I would love to add it to the LAME distribution.
>
> Mark
>
here is a little bash script as a start.
Robert Hegemann
------------------------------------begin-lame.script-------
#!/usr/local/bin/bash
# adapt this for your needs
#################################
mp3coder="lame"
options="-h -k -m f -b 128"
rmsrc=false
helptext="\
$0 [options] <file 1> ... <file n>\n\
\n\
options:\n\
-h this help text\n\
-r remove files after encoding\n\
-o \"<lame options>\" overrides script default options \"${options}\"\n\
\n\
example:\n\
$0 -r -o \"-v -V 0 -b 112\" a*.wav z*.aif\n\
\n\
"
# process command-line options
# this could be extended to fake the
# commandline interface of the mp3encoder
while getopts ":o:r" optn; do
case $optn in
o ) options=$OPTARG # replace default options
;;
r ) rmsrc=true
;;
\? ) printf "$helptext"
exit 1
;;
esac
done
shift $(($OPTIND - 1))
# process input-files
for filename in "$@"; do
case $filename in
*[*?]* ) # means shell couldn�t extend *.wav, etc.
echo "warning: no $filename file(s) found"
;;
*[.][wW][aA][vV] )
name=${filename%[.][wW][aA][vV]}
if $mp3coder $options $filename ${name}.mp3
then
if [ $rmsrc = true ]; then
rm -f $filename
fi
fi
;;
*[.][aA][iI][fF] )
name=${filename%[.][aA][iI][fF]}
if $mp3coder $options $filename ${name}.mp3
then
if [ $rmsrc = true ]; then
rm -f $filename
fi
fi
;;
* )
if $mp3coder $options $filename ${filename}.mp3
then
if [ $rmsrc = true ]; then
rm -f $filename
fi
fi
;;
esac
done
---------------------------------------end-lame.script----------
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )