Media Browser Genre Symlink Generator

I’ve been an adamant user of Media Browser for Windows Media Center 7 for a while now.  It’s a great (free!) plugin that allows you to organize and view your collection of movies and TV shows in a very cool interface.  It has a cover flow (iTunes esk) style of interface that I especially like that has a visual display showing the movie posters (if you have them).

Quick links for this post:

  1. XZeners Media Browser icon packs
  2. MyMovies.xml Genre Generator application (hosted on Google Code)

One feature it has is that it allows me to point the Media Browser app to a folder of Movies. These movies can then be displayed through the Windows Media Center interface.  If the movie is in a folder that contains the correct metadata file (called mymovies.xml) then I can see IMDB style ratings, genre and actor information etc.  In the interface you can then sort by rating, genre etc.  It’s very easy to use.

The problem for me was that I wanted to setup icons for all of my genres folders and have it all display nicely by genre.  The obvious solution was to have all of my movies arranged in genre folders.  However I’m the kind of guy that likes to have everything listed in one nice big flat folder structure, with all movies having their own folder that sit under the one folder called “Movie Collection”.

Having a structure like this makes metadata retrieval easier for programs like Media Center Master.  There are other solutions available but after reading an article about Windows Symbolic links I though that this could be a potentially easy way to save the day.  Those of you who dabble in Linux will know what I’m talking about when I talk about symlinks.  It’s been around forever in Linux but only recently it turns out that Windows started to support symlinks (since Windows Vista!). Awesome.

So the answer was simple. Create a set of genre directories that each contain a bunch of symlinks to the real flat folder structure that I had living somewhere else on my hard drive.  This allowed me to organize a second set of “virtual” folders (aka symlinks) for my movies by genre, while maintaining my flat directory structure somewhere else on the hard drive for metadata purposes.

Now since I’m a lazy programmer, I decided to write a very simple windows application in c# to do the job for me.  It essentially scans one flat directory structure for the mymovies.xml file, finds out what genres each movie belows to, then puts a symlink for each of the genres to that movie in the appropriate genre folder.

For example, this means that when a movie like Avatar is recognized as belonging to 4 genres (Action, Adventure, Fantasy and Sci Fi) then the application will create these genre directories (if they don’t already exist in the target location), then copy a symlink of the Avatar folder and put it into each of the genre directories.  What you end up with is a set of genre directories like below:

Now fire up “Media Browser Configurator” from the “Start > Media Browser” location and configure it to point to that genres directory.  It will use this as the directory from which to source all of your movie goodness by default.

In addition to symlinking all of the genres my application can also allow you to specify the location of an icon pack to be used for those genres. This means that as it creates the genre directories it will check the given location for an icon that matches the name of that genre. For example it’s creating the “Action” directory then it will check the location for a icon named “action”.  If it finds one then it copies it across to the genre folder and renames it to “folder.jpg” which is the required name for Media Browser to pick it up.  The result in Windows Media Center is something like below:

The above example uses a set of icons created by a champion called Xzener.  The icons can be found here at the Media Browser community website.  There are also some others here.

So now to the software. It’s pretty straight forward.  First create the folder “Movie Collection by Genre” (or whatever name you like).  If you’re using icons then get them ready in a folder (extract them from zip or whatever). Then you need to fire up the “Genre Synlinker” app.  Select a source (your flat “Movie Collection” directory structure) and a destination (your “Movie Collection by Genre” folder) for the symlinks. Obviously don’t set the flat structure as your destination!  If you have icons then select this too.  Your app should now look something like below:

Then once you’re confident that everything is setup okay click the “generate” button.  This will create the symlinks and then you’re in business. See the example below:

If you make a mistake or want to re-run the process then just delete all of the genre folders and start again.  You can add new movies to your flat file structure and then just run the Genre Symlinker over the top of the destination genres directory and it will skip any that it’s already created, and just create the new ones.

The software is hosted at Google code here.

Have fun and let me know if you have any feedback.

Leave a comment

3 Comments.

  1. Awesome!This is a perfect idea. Incredible work.No problems with the way the software functions.The only problem i have is that symlinks wont work for network drives and im sure a lot of people using media browser store their video files on some type of server. I know this is not a problem with your program but more of a restriction on how symlinks work.My solution so far is to store the video folder of symlinks on the computer im running media browser. Since that folder takes up no space then HDD space is not an issue, the only inconvenience that will arise is if you have multiple computers running media browser in you house.Im hoping, as a community maybe we can find a work around for this. Since media browser only reconizes video files in folders, simply creating shortcuts wont work.Also to note depending on what OS is being used for server storage, this option may work perfectly. If this program were to be ran on WHS the symlinks may work perfect. My WHS crashes so i have started over on an unRAID server where this option only works with the workaround i described earlier._________________________________Suggestions-I noticed if your (output) folder does not exist the operation fails. Maybe have it check if the folder exists and then prompt the user if they would like the folder created.-For the future maybe, turning the program into a service for an auto update of some sort.Well that’s ll I got for now.Thanks for the program man

    • Hi Brennan. Thanks very much for the great feedback. Yes I agree that many people will use network shares and file servers to store their movie files. My understanding is also that Windows symlinks are limited in this way. Having said this I’ll do some research to see what’s possible.

      Regarding the suggestions, I’ll definitely add in the check for the target folder to see if it exists. Creating a service for the functionality is a great idea. I’ll toy around and see if I can put the functionality into a common library and have both the service and the GUI can tap into that.