#!/bin/bash from="$1" to="$2" set -v if [ -z "$to" ]; then to="`echo $from | sed -e 's/ogg/mp3/'`" fi temp="$to".wav if echo "$to" | grep 'mp3$' -q; then : else to="$to".mp3 fi oggdec -o "$temp" "$from" lame -b 128 "$temp" "$to" ogginfo "$from" | egrep 'TITLE|ARTIST|TRACKNUMBER|TRACKTOTAL|ALBUM' | sed -e 's/^\s*//; s/=\(.*\)$/="\1"/' > "$temp".info . ./"$temp".info id3tag --artist "$ARTIST" --album "$ALBUM" --total "$TRACKTOTAL" --track "$TRACKNUMBER" --song "$TITLE" "$to"