Introduction
Yamo (Yet another music organizer), manages a music library, moving and renaming song files based on a set of options specified by the user. Yamo is composed of a dynamic library that implements the library manager engine, and a wizard application that allows easy access to the Yamo engine services. Both the library and the wizard are written in C#. Being a library, the Yamo engine can be used even inside third party applications.
Additionally, Yamo can download album art for your music collection, using custom internet sources. Actually, Amazon web service is the only album art provider available, but others can be added expanding a simple Yamo library interface.
Background
The implementation of Yamo started because I, as a WinAmp user, felt the need for an application able to organize my music library in a custom way (WinAmp, at least in its current version, lacks this feature). Other media players like WMP and ITunes already implement a library manager, but neither of them were completely OK for my needs, because they both act in a quite fixed behaviour (i.e. WMP organizes library folders following an Artist/Album pattern, I wanted my library organized by Genre/Album).
Using the wizard
Using the Yamo wizard application is quite straightforward, anyway here is a brief guide on the steps to follow to get Yamo ready to process your music library
Step 1: Music library root
In this step, you simply have to specify what's the root of your music library, and tell Yamo what operations you want to perform on it.
Step 2: Options
Here you can specify all your preferences about the way Yamo will get your library reorganized.
For instance, if you want your songs to be organized first by artist and then by album, like Windows Media Player does, you simply have to write the string Artist/Album in the library folder structure box. If you wish to place songs with no artist information to be placed in a folder named Unknown Artist, add it in round brackets after the Artist tag: Artist(Unknown Artist)/Album. The same thing applies to every other supported tag.
To set your preferences about music file names, write a format string in the filename format box (or choose from the predefined ones). Tags specified inside square brackets will expand to the corresponding piece of information stored in the single file (i.e. the [Track] token will expand to the track number of the song). Every other character specified outside square brackets will be left as it is in the resulting file name.
To get help for these and every other supported options, simply hold your mouse pointer over one of the ? signs in the Options window.
That's it. Now Yamo should be ready to go :)
After the first run, your preferences will be stored in an external options file. If you are going to add several files to your library and want Yamo to organize them, then you probably don't need to change any of your previous choices. In this case, you can start Yamo with the r
option set (for instance by typing Yamo -r
at the command prompt). Yamo will then directly start processing your library with the saved preferences.
Using Yamo in your application
If you want to include the Yamo engine in your code, first of all you need to add a reference to the SharpFactory.Yamo.Core.dll library in your project. Note that this is not the only library you will have to take along in order to use the engine. You'll need the Interop.ShazamMP3.dll and WMFSDKWrapper.dll libraries too (You can find them in the source and binary distributions of Yamo). You don't have to add references to these libraries in your project though.
Once the reference is set, you can start using the engine. The following code is a complete console application that will take as argument the path to a music library and will organize it using some default 'hardcoded' options:
using System;
using SharpFactory.Yamo.Core;
namespace YamoSample
{
class SampleApp
{
[STAThread]
static void Main(string[] args)
{
Options options = new Options();
Engine engine = new Engine();
engine.EngineEvent+=
new EngineEventHandler(engine_EngineEvent);
options.LibraryRoot = args[0];
options.OrganizeMusic = true;
options.FolderOptions.Add(
new FolderOption(FolderType.Genre, "Unknown Genre"));
options.FolderOptions.Add(
new FolderOption(FolderType.Album, "Unknown Album"));
options.FilenameOptions.Add(
new FilenameOption(FilenameComponent.Track));
options.FilenameOptions.Add(
new FilenameOption(" - "));
options.FilenameOptions.Add(
new FilenameOption(FilenameComponent.Title));
options.TagReader = TagReaders.Shazam;
options.DownloadAlbumArt = true;
options.MediaInformationProviders.Add("Amazon");
Console.WriteLine("Press [enter] to stop music " +
"library refactoring.");
System.Threading.Thread.Sleep(1000);
engine.Start(options);
while(engine.IsRunning && Console.In.Peek() == -1)
{
System.Threading.Thread.Sleep(500);
}
if(engine.IsRunning)
{
engine.Stop();
}
}
private static void engine_EngineEvent(
object sender, EngineEventArgs args)
{
{
Console.WriteLine(args.Message);
}
}
}
}
Conclusion
So, that's it. But I want to end with a brief note: I created this program mainly for my personal use. I needed something of this kind, and had fun coding it. I'm now distributing Yamo hoping that someone else finds at least some piece of the code useful, but I don't make any kind of guarantee on the program itself! Yamo was coded in little time, and has more than a pair of bugs, for sure. It works well on my music library (about 2000 files), but if you really want to try it on yours, make sure you take a backup copy of it first! (You should have done it already, anyway ;P).
History
- 31-Oct-05
- 6-Feb-06
- Article
- Code (1.0 Preview)
- Project ported to .NET Framework 2.0 / Visual Studio 2005.
- The ignored file list now works correctly and supports wildcard characters.
- The wizard was ignoring saved folder options (bug fix).
- The engine can now move a set of user specified relevant files along with music files. (In the previous version some relevant files (like album art) were hard coded in the engine.)
- Complete restyling of the wizard.