#!/bin/bash
-# default = 4. 0 = highest quality.
-VBR_QUALITY="-V4"
+# default = 4
+# 0 = highest quality.
+VBR_QUALITY="-V0"
LAME_OPTS="--noreplaygain ${VBR_QUALITY} --add-id3v2 --pad-id3v2 \
--ignore-tag-errors"
+METAFLAC="metaflac"
print_usage()
{
OUTF=`echo "$a" | sed s/\.flac$/.mp3/g`
-ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`
-TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`
-ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`
-GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`
-TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`
-DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`
+ARTIST=`${METAFLAC} "$a" --show-tag=ARTIST | sed s/.*=//g`
+TITLE=`${METAFLAC} "$a" --show-tag=TITLE | sed s/.*=//g`
+ALBUM=`${METAFLAC} "$a" --show-tag=ALBUM | sed s/.*=//g`
+GENRE=`${METAFLAC} "$a" --show-tag=GENRE | sed s/.*=//g`
+TRACKNUMBER=`${METAFLAC} "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`
+DATE=`${METAFLAC} "$a" --show-tag=DATE | sed s/.*=//g`
flac -c -d "$a" | lame ${LAME_OPTS} \
- --tt "$TITLE" --tn "${TRACKNUMBER:-0}" --ta "$ARTIST" \
- --tl "$ALBUM" --ty "$DATE" --tg "${GENRE:-12}" \
+ --tt "$TITLE" \
+ --tn "${TRACKNUMBER:-0}" \
+ --ta "$ARTIST" \
+ --tl "$ALBUM" \
+ --ty "$DATE" \
+ --tg "${GENRE:-12}" \
- "$OUTF"
# default = 3.
OGG_QUALITY="4"
OGGENC_OPTS="-q ${OGG_QUALITY}"
+METAFLAC="metaflac"
print_usage()
{
OUTF=`echo "$a" | sed s/\.flac$/.ogg/g`
-ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g`
-TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g`
-ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g`
-GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g`
-TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`
-DATE=`metaflac "$a" --show-tag=DATE | sed s/.*=//g`
+ARTIST=`${METAFLAC} "$a" --show-tag=ARTIST | sed s/.*=//g`
+TITLE=`${METAFLAC} "$a" --show-tag=TITLE | sed s/.*=//g`
+ALBUM=`${METAFLAC} "$a" --show-tag=ALBUM | sed s/.*=//g`
+GENRE=`${METAFLAC} "$a" --show-tag=GENRE | sed s/.*=//g`
+TRACKNUMBER=`${METAFLAC} "$a" --show-tag=TRACKNUMBER | sed s/.*=//g`
+DATE=`${METAFLAC} "$a" --show-tag=DATE | sed s/.*=//g`
flac -c -d "$a" | oggenc ${OGGENC_OPTS} \
- -t "$TITLE" -N "${TRACKNUMBER:-0}" -a "$ARTIST" \
- -l "$ALBUM" -d "$DATE" -G "${GENRE:-12}" \
+ -t "$TITLE" \
+ -N "${TRACKNUMBER:-0}" \
+ -a "$ARTIST" \
+ -l "$ALBUM" \
+ -d "$DATE" \
+ -G "${GENRE:-12}" \
-o "$OUTF" -