Quick Links


My contribution to Sev

My contribution to Freefall

Random Playlist Generator

Album Checker



Bad Science

External link icon External links, these open in a new tab (Firefox), or window (IE)

Random Album Chooser


14th September 2008

I'm now listening to more of my music on my PC but unfortunately my player of choice, MediaMonkey, doesn't have an "album shuffle" mode. So I wrote myself a program to randomly pick an album and then pass the files to MediaMonkey to play. As usual the basics of the program were written quite quickly, it's all the associated error checking, configuration and general prettifying (though some would debate that!) that take up the time. Why I'm still amazed by this after more than 25 years in the software development business I don't know - eternal optimism perhaps - but there you go.

Anyway to get back to the business at hand, to use this program your music library must be organised at least by album and ideally by artist and album. Fire up the program and point it at your music library and tell it the location of your media player by selecting the settings button Settings icon and browsing to the relevant folder and file. The configuration dialog also allows you to specify the filenames to look for in the album's folder if the cover image isn't embedded in the mp3 files. I've added what I think are the most common names for folder art - well they're the ones I've come across the most. I've allowed new names to be entered and the existing ones reordered to produce the optimum search for any situation. The program also looks for images named the same as the folder and album tag for good measure.

Random album chooser initial screen Random album chooser configuration dialog

Having set up the system, click the shuffle button shuffle button. The program goes away and picks an album. Once its found one it displays both the album folder and it's parent under the assumption that you've got your collection organised by artist. It also displays the album cover like this:

Random album Chooser results

Why? I hear you ask. Well partly it's a visual check that this is the album you want to play, but mainly because I could! Wanting to do it made me look for (and find) a C# tag reading library which I'd failed to find when writing my playlist generator.

When you've been presented with an album you want to hear simply click the album cover image. This will launch your media player and start playing the album at track 1 - assuming you've named your files <Track#>-<Title>, as the files will be added in alphabetical order. I've tested it with Media Monkey, Winamp and Windows Media Player, so I'm confident it'll work with any music player that accepts a list of files on it's command line.

It's not brilliant, but it does the job. I'm making it available online to download. It was written in C# using Visual Studio 2008 on top of .NET 3.5 and is only available for Windows. It uses a C# mp3 tag library (TagLib#) to pull out the cover art (assuming that it exists of course).

There's an issue where I can't locate cover images that aren't embedded in the mp3 file but are referenced by name and that name is different to both the folder name and the value of the album name tag. The relationship between the mp3 and the image is set up in the file, but I can't get at it. The code that looks for an image in the same folder gets round this in some cases - if it's one of the filenames set up in the config file or it's name is the same as the folder or album. I've contacted the developer of the library in case there's something I'm missing. It doesn't affect my use of the application as I've embedded the album art in all (well nearly all) my mp3s, but the completist in me wants to have this bit working too.

There's been one benefit for me in using this - I've found a number of albums in my collection that haven't had the album art assigned correctly. Usually it's been tagged as something other than the front cover. In a couple of cases it's been missing altogether.

So I may well be updating it at some point (but don't hold your breath) and I may even put the code online too (once I've tidied it up). The usual warnings and provisos apply to the program - use at your own risk, there's no support etc. However, if you have any comments or suggestions then I'd be happy to hear from you.

21st September 2008

I found that I'd set up the media player file open dialog incorrectly - causing the application to crash. Totally stupid mistake to make & I'm annoyed I didn't spot it earlier. As I have to upload a fixed version I'm also releasing the extra options to allow navigation of the library from where it lands. This was brought about as many a time I've wanted to listen to the artist it picked but not the particular album. I also decided to remove the "play" icon and simply click on the album art to launch the media player.

19th October 2008

I've been playing with keyboard shortcuts so you can now navigate around the whole application by keyboard alone:

  • Alt+C brings up the configuration dialog.
  • Alt+I brings up the about dialog.
  • Alt+S chooses the album.

In the configuration dialog as well as the shortcut indicated by the underscores you can change the order of the search for cover images by using Alt+Up Arrow or Alt+Down Arrow.

Once an album has been selected Alt+Left Arrow and Alt+Right Arrow will cycle through the albums by that artist.

I've also been playing with opacity and tooltip like windows so the application fades out when it becomes inactive or when moved and when the album art is right clicked a popup window appears with more details (year, bit-rate, number of tracks, total length etc.) about the album.

21st October 2008

Version 2.0: The application is now multi-threaded and I've enabled Esc to abort the search - most useful if you've set the wrong library root. The next and previous album buttons are now disabled properly if there are no other albums by the current artist.


(mailto: album-chooser at forman dot free-online dot co dot uk)