cat <<EOF
audiorip: a CD-ripping script
-h: this help message
+-B: audiobook mode.
-d [cdrom device]
-s [start track]
-e [end track]
end_track=0
no_cdparanoia=0
cd_dev=/dev/cdrom
-while getopts "d:e:hNs:" flag
+lame_bitrate=256
+lame_q=2
+flac=1
+while getopts "Bd:e:hNs:" flag
do
case $flag in
+ B) lame_bitrate="96"
+ lame_q="2"
+ flac=0
+ ;;
+
d) cd_dev=$OPTARG;;
e) end_track=$OPTARG
lossless_dir="${base_dir}/${trailing_dir} [LL]"
echo "base_dir = \"${base_dir}\""
echo "lossless_dir = \"${lossless_dir}\""
-mkdir -p "${lossless_dir}"
+[ $flac == 1 ] && mkdir -p "${lossless_dir}"
############# cdparanoia ###############
if [ ${no_cdparanoia} -eq 0 ]; then
fi
############# mp3 ###############
-wav_to_mp3 256 2
+wav_to_mp3 $lame_bitrate $lame_q
+
############# flac ###############
-mv *.wav "${lossless_dir}/"
-cd "${lossless_dir}"
-flac *.wav
-flac -t *.flac && rm -f *.wav
+if [ $flac == 1 ]; then
+ mv *.wav "${lossless_dir}/"
+ cd "${lossless_dir}"
+ flac *.wav
+ flac -t *.flac && rm -f *.wav
+else
+ rm -f *.wav
+ exit 0
+fi