Organising my music collection
I wanted to organise all the random music files that I have lying around on all my computers, and keep them in one location that was consistently backed up and that I could reach them from any networked connection in the world.
I have three sets of music file types:
- Lossless FLAC and ALC files, ripped from my CDs
- OGG files that are compressed files from the FLACs
- MP3 files from the FLAC files, including random singles from online music stores.
There are three goals:
- Have a consistent directory layout for all files
- Have metadata in the music files
- Set all files with album cover art for every music file
- Make it so that iTunes and most popular music players get the correct information on their displays.
Here's how I've been tackling these tasks:
Consistent directory structure
Each album is structured by Artist, Album, Music file:
./the_avalanches/since_i_left_you/04-frontier_psychiatrist.mp3
All filenames and directory names are lower case (a-z), numerical (0-9) and the three characters:
- a period, or full stop: .
- a dash: -
- an underscore: _
For albums, the filename is a zero-padded track number, a dash, and the name of the song. Nominally spaces are replaced by an underscore, and the dash acts as a field separator.
Three types of music file:
- Classic album, with one band/artist and a collection of music tracks.
- Singles.
- Classical music tracks.
- Compilation albums, which have individual artist/track combinations.
I used the linux ''find'' command to root out the mp3's I had around on my drive.
find -type f -name "*.mp3"
To get a file count, pipe it through the command ''wc''
find -type f -name "*.mp3" | wc -l
tr A-Z a-z
Cover finding album art:
http://mookooh.org/coverfinder/
Various options for editing tags in music files:
Taglib
Located at http://developer.kde.org/~wheeler/taglib.html and installed on a Mac with:
sudo port install taglib-sharp
From: http://www.macosxhints.com/article.php?story=20050820184012686
If you are submitting tags to CDDB or other online source hold to the convention used by the iTunes Music Store (and Amazon) for classical music.
That convention is:
- Composer = Composer (Bach, Brahms, etc)
- Artist = Orchestra, Conductor, Featured Performer
- Album = [Composer]: Album Name [Special attributes such as Live, Box
- Set, etc]
- Grouping = Name of the Work (Symphony number 1 etc.)
- Name = Name of the Movement (Allegro molto etc.)
So This Album would be:
- Composer=Mendelssohn, Felix (1809-1847)
- Artist=London Symphony Orchestra, Claudio Abbado
- Album=Mendelssohn: 5 Symphonies; 7 Overtures [BOX SET]
- [Each symphony then gets a Group, and each movement is entered in the Name]
And don't forget the [Disc number] of [Total discs]!
From http://www.1-script.com/forums/ID3v2-cover-art-insertion-with-Perl-article94943--6.htm
my $mp3 = Audio::TagLib::MPEG::File->new($outfile);
my $id3v2 = $mp3->ID3v2Tag(1);
$id3v2->setArtist(Audio::TagLib::String->new($artist));
$id3v2->setAlbum(Audio::TagLib::String->new($album));
$id3v2->setTitle(Audio::TagLib::String->new($title));
$id3v2->setYear($date);
$id3v2->setTrack($track);
$id3v2->setGenre(Audio::TagLib::String->new($genre));
if (open(PICFILE, "$flacdir/cover.jpg")) {
$filesize = (-s PICFILE);
binmode(PICFILE);
read(PICFILE, $imgdata, $filesize);
close(PICFILE);
my $imgbv = Audio::TagLib::ByteVector->new();
$imgbv->setData($imgdata,$filesize);
my $bv = Audio::TagLib::ByteVector->new("APIC");
my $field =
Audio::TagLib::ID3v2::AttachedPictureFrame->new($bv, "UTF8");
$field->setPicture($imgbv);
$field->setTextEncoding("UTF8");
$field->setMimeType(Audio::TagLib::String->new("image/jpeg"));
$field->setType("Other");
$field->setDescription(Audio::TagLib::String->new("Cover
(front)"));
$id3v2->addFrame($field);
}
$mp3->save();
BINGO!!! This is what I've been looking for - a very similar workflow for me:
http://www.mfischer.com/2007/11/21/mp3-metadata-tagging/