I have been working on a script that will automatically transcode my wave files into mp3 files, tag them and as a bonus create a playlist for the files.

You will need these programs installed:

ffmpeg
id3ren
fapg

I am using the folder names and - to tag the mp3 file, by making variables out of the names.

This assumes you have your music library structured in a certain way. I use this structure:
///-.wav

An example:
/Rory Gallagher/Tattoo/01-Tattoo'd Lady.wav

I would like input how to improve it. The id3ren program was the hardest one to get to work properly. If you want to use that program alone, or alter what it is doing, I can help.

Thanks for trying.

EDIT (1/13/12): I found an easier way to deal with spaces in file names, and combined everything into one simple script:

Code:

#!/bin/bash
# This is a script to transcode wave audio files (.wav) to .mp3, using ffmpeg.
# It will also tag the .mp3 files, using the existing folder name and file name.
# As a bonus, it will also create a .pls playlist in the folder containing the mp3 files.
# It uses these programs, which you first must install:
#
# ffmpeg
# id3ren
# fapg
#
#
# This script will only work correctly if you have your music arranged in folders like this:
# ///-.wav
#
# An example:
# /Rory Gallagher/Tattoo/01-Tattoo'd Lady.wav
#
#
# Create two functions to make the $ALBUM and $ARTIST variables, and run them:
echo
function ALBUM {
ALBUM=`basename "$PWD"`
echo "Album = $ALBUM"
sleep 3s
}
ALBUM
# Go up one level in the directory, to get the name of the Artist:
cd ..
echo
function ARTIST {
ARTIST=`basename "$PWD"`
echo "Artist = $ARTIST"
sleep 3s
}
ARTIST
echo
echo
# Go back to the previous folder:
cd "$OLDPWD"
# Replace spaces with underscores:
# dirty hack to make spaces in file names work
oldifs=$IFS; #IFS= Internal Field Separator
IFS=_
# Convert wave files in current directory to mp3 files.
# Make a new folder mp3 using the name of the current folder,
# and move the mp3 files to that folder.
for i in *.wav; do mv "$i" `echo $i | tr ' ' '_'`; ffmpeg -i $i -ab 320k -acodec libmp3lame ${i%.wav}.mp3; mkdir "$ALBUM-mp3"; mv *.mp3 "$ALBUM-mp3"; done
cd "$ALBUM-mp3"
# Tag files using id3ren:
id3ren -tagonly -tagfromfilename -tagtemplate '%n-%s.mp3' -nocomment -noyear -album="$ALBUM" -genre=12 -artist="$ARTIST" *.mp3
# Make a playlist using fapg
fapg --format=pls --output="$ALBUM".pls "$PWD"
# Undo hack from above.
IFS=$oldifs;