mp3Librarian is a collection of tools to help you organize, tag, and propagate your mp3's. Mp3Librarian is made up from three applications:
-mp3librarian - A tool to automatically tag mp3 files that are sorted into albums. It does this by using the location of the file in the file system as the bases for the correct id3tags. It also has other album checking capabilities built in.
-mp3CollectionCreator - A tool to create a listing of albums that are composed of mp3's.
-mp3Grabber - A tool to compare two mp3CollectionCreator files and grab any new albums.
Intro: mp3CollectionCreator is a tool used to create a listing of albums that are composed of mp3's. There are two rules that mp3CollectionCreator uses to for albums to be considered valid.
1) All mp3 files must be fully tagged (correctly).
2) Only 1 album may reside in a directory.
Because of these two rules you do not have to have your files in the same directory/file layout that mp3librarian uses and you could sort your mp3's by year if you wanted. Because of rule #1 mp3CollectionCreator checks all of the files in a directory and if they don't have matching id3 tags, every track etc the album will not be added to the list.
Command line args: Both the root directory for finding albums and the location of the file to list albums need to be passed into the application through the command line arguments. Example: mp3collectioncreator -r /mp3/ -f /mp3/mycollection.txt.
File format: The file format of each line of the resulting file is:
Typical usage: mp3collectioncreator -r /mp3/ -f /mp3/local
Rules: When a new album is found that is not on the local collection mp3Grabber will check with a rules file (if one is passed in with -r) to see if the album should be downloaded. The rules file follows the same format as the mp3CollectionCreator files. In the rules file you can set 4 commands to ignore: genre, group, album and year. If only 1 command is specified then all new albums that have the same command will not be downloaded. For example: if you have Alternative<#@#><#@#><#@#><#@#> then any new album that has Alternative as its genre will not be downloaded. If you specify 2 rules then both rules must match for the album to not be downloaded. Same with 3 and 4 commands. If "//" is the first 2 characters in a line of the rules file then the line is ignored (A comment).
The rules file is very powerful, but for most cases you will probably just want to ignore a genre or a particular group that you do not want. (An example rules file in included in the mp3grabber directory of the source.)
Copying: to download the new album you must specify the copy command to use. The reason for this is that it allows for user to determine how the files are going to be moved from system to system. The copy command is set with -c [string] in the command line arguments. You can use mv, ftp, scp or any other tool that has been predetermined by the owner of the "new" mp3CollectionCreator file and yourself*. scp will be demonstrated here.** The copy command will actually be put into the file /tmp/mp3Grabber and then executed as a script so you can use the normal script rules for the string.
Example: -c "scp -r user@host:\"%dir\" \"/mp3/%genre/%group/%album/\"" There are 5 allowable replacements in the copy command: %dir, %genre, %group, %year, %album. %dir is the location of the new album on the remote machine. The other 4 replacements can be used to place the new album directly in the correct spot in your collection. This allows you to properly sort the local mp3 collection while keeping the remote mp3 collection is sorted a different way.
Typical usage: mp3grabber -l /mp3/local -n /mp3/new -r /mp3/rules -c "mkdir /mp3/%group; scp -r user@host:%dir /mp3/%group/%album/"
* The owner of the local and remote collection is more then likely the same person who wishes to simply mirror part of his/her collection from one machine to another (example being an mp3 server and a portable mp3 player or living room mp3 stereo component)
Base directories: Because you wouldn't want mp3Librarian to recheck every album every single time it is run your root mp3 directory needs to be broken up into 2 directories, "albums" and "new". When you get a new mp3 album you would place it in the "new" directory. Example: "new/Alternative/Staind/Break The Cycle/" mp3Librarian would then be run with the -n (for new) option telling it to go through the new directory checking anything that is found inside of "new". If there are no errors that mp3Librarian can not resolve itself (such as all of the files within an album don't have the same year in their id3tag) the album is moved from the "new" directory into the "albums" directory.** mp3Librarian will output all changes and any errors that are encountered while it goes through the mp3's.
Root Directory: The root directory of "new" and "albums" is configurable and needs to be passed to mp3Librarian using the -r option. For example I store my mp3's in "/mp3/" so I would pass "-r /mp3/"
mp3Librarian as a cron job: If you will be getting new albums all of the time you can have mp3Librarian run as a cron job. mp3Librarian has the ability to log all messages and errors to a log file and execute a script (such as e-mailing you that log file) It can also keep a burn file of any new albums that are moved into the "albums" directory so that you can be sure to back up the mp3's onto CD or other preferred format. See mp3Librarian -h for more logging details.
Generating play lists: Because mp3Librarian has the ability to read id3 tags and moves albums around it also has the ability to generate play list files. The play order in the album play lists are based off of the order of the songs in the albums (as given by the track id3tag).*** One of the wonderful side effects of this is that you can just re-run mp3Librarian to get a working play lists after file have been moved around/added. As mp3Librarian descends through each directory it will make a play list of play lists. For example the Alternative directory will have a play list of all of the Alternative artists play lists. The Staind band will have a play list off all of Staind's albums play lists. The albums will in turn will have the list of mp3's for that album. So if you wish to load up all of your mp3's you can just load the albums.m3u play list and you will get every album with the tracks in the correct order.
Web based play lists: mp3Librarian can also generate play lists that will be use on a website with the -w option. Example: The website is www.foo.com and the mp3s are accessible from "http://www.foo.com/coolalbums/" Staind's Break The Cycle would be located in "http://www.foo.com/coolalbums/Alternative/Staind/Break The Cycle/" To make a play list that conformed to that you would pass "-w http://www.foo.com/coolalbums/"
Typical usage: For normal command line usage (parsing new and then making play lists):
For more advanced cron usage (parsing new and then making play lists):
More: There are other options available. See --help and -d for more options and details.
* It should be noted that storing mp3's based on genre allows for an easier way of managing very large collections that exceed the current hard drive sizes then raiding (Each genre would actually be a link different hard drive).