Skip to content

Instantly share code, notes, and snippets.

@barn
Created June 29, 2012 22:37
Show Gist options
  • Save barn/3021130 to your computer and use it in GitHub Desktop.
Save barn/3021130 to your computer and use it in GitHub Desktop.
#!/bin/bash
for a in *.flac
do
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`
nice -10 flac -c -d "$a" | nice -20 lame -m j -q 0 --vbr-new --preset standard -s 44.1 - "$OUTF"
id3v2 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$OUTF"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment