Make mp3 encoding optional

This commit is contained in:
Donald Burr 2015-02-22 15:31:32 -08:00
parent 2d2029137a
commit 904c4f8a8a

View file

@ -10,13 +10,21 @@ COOKED_DIR="$D/audio/cooked"
FLAC_DIR="$D/audio/cooked/flac" FLAC_DIR="$D/audio/cooked/flac"
MP3_DIR="$D/audio/cooked/mp3" MP3_DIR="$D/audio/cooked/mp3"
if [ "$1" = "-m" ]; then
ENCODE_TO_MP3=YES
else
ENCODE_TO_MP3=NO
fi
cd "$RAW_DIR" cd "$RAW_DIR"
for DIR in *; do for DIR in *; do
if [ ! -d "$FLAC_DIR/$DIR" ]; then if [ ! -d "$FLAC_DIR/$DIR" ]; then
mkdir -p "$FLAC_DIR/$DIR" mkdir -p "$FLAC_DIR/$DIR"
fi fi
if [ ! -d "$MP3_DIR/$DIR" ]; then if [ "$ENCODE_TO_MP3" = "YES" ]; then
mkdir -p "$MP3_DIR/$DIR" if [ ! -d "$MP3_DIR/$DIR" ]; then
mkdir -p "$MP3_DIR/$DIR"
fi
fi fi
cd "$DIR" cd "$DIR"
echo "working in $DIR" echo "working in $DIR"
@ -42,11 +50,13 @@ for DIR in *; do
else else
echo "...already converted" echo "...already converted"
fi fi
if [ ! -f "$MP3_FILE" ]; then if [ "$ENCODE_TO_MP3" = "YES" ]; then
echo "...converting it to MP3: $MP3_FILE" if [ ! -f "$MP3_FILE" ]; then
lame --quiet --preset studio "$TEMP_OUTFILE" "$MP3_FILE" echo "...converting it to MP3: $MP3_FILE"
else lame --quiet --preset studio "$TEMP_OUTFILE" "$MP3_FILE"
echo "...already converted" else
echo "...already converted"
fi
fi fi
rm -f "$TEMP_OUTFILE" rm -f "$TEMP_OUTFILE"
done done