Converting archived recordings into a movie library


Once you start archiving recorded television from your Windows Media Center, it will not take long until you realize that having them all placed into the video folder is suboptimal. Of course, you can open a browser and search IMBD to figure out what a movie is all about, but would it not be much nicer to  get this information without turning on your notebook? A clean way to achieve this is to put your movies into the Windows Media Center movie library, but doing this requires some additional work to gather the required metadata such as cover image, movie title, description, release date, and so on.

windows-media-center-video Windows Media Center – My Videos: Simple but not elegant

Before you start searching for meta data, it is a good idea to take a closer look at how the movie library actually works. Once you put a movie DVD in your machine, Windows Media Center generates a hash code from the content of the disc. This so-called DVDID is then used to query a web service for the proper metadata for the disc. If the metadata for the DVDID is available, Windows Media Center downloads it and caches it on your local hard disk. That way, when you put in the same DVD at some later point in time, the metadata is already available locally and does not have to be downloaded again. This reduces network traffic and  improves the responsiveness of the movie library.

windows-media-center-library

Windows Media Center – Movie Library: Elegant but requires some work

However, since the DVDID is derived from the contents of the original DVD, it is not possible to generate it from recorded television. To mitigate this, some enthusiasts have started to gather the DVDIDs for their own movie collection and they freely share them on the web. So one possible route to take is to try to find the DVDID for your movies by running web searches or joining websites devoted to DVDID sharing. Yet, when going down this route, sooner or later you will find a recording that is not sold on DVD or that nobody else has bought – so your out of luck, right? No, not really.

windows-media-center-metadata

Metadata Example: A DVDID definition (left) with an associated cache entry (right)

Due to the local caching of metadata, you can fool the movie library into loading an arbitrary description of your choice. To do this, you simply have to generate an arbitrary DVDID that you associate with a manually created metadata entry in the local cache. The first step, thereby, is to organize your movie collection in such a way that each movie file is contained within its own folder. Once this is done, you create an XML file with an arbitrary name that ends with .dvdid.xml in each of the folders.  In this file, you define the movie name and DVDID as shown on the left side of the example above. Then you create another XML file with the name of the DVDID that you assigned and you fill in all necessary details as shown on the right side of the example. Finally, you copy the metadata file into the cache directory which is usually found in the current user’s application data directory, i.e. C:\Users\<username>\AppData\Roaming\Microsoft\Ehome\DvdInfoCache. In order to associate a DVD cover with your movies, simply copy the corresponding cover file into the movie’s directory and rename it to folder.jpg. That’s it.

dvd-library-manager

DVD Library Manager: A free, flexible, convenient metadata editor

Clearly, if you have a large movie collection, manually executing these steps can be too time-consuming. Fortunately, there are several Windows applications that can largely automate the process. An excellent free tool is Florin Birsan’s DVD Library Manager. Besides from generating DVDID and metadata files with matching names, it can also run queries on Amazon and a few other web services to gather metadata including cover images. DVD Library Manager works well, even if you are not looking for English titles, since the tool can switch to French, German, and Japanese services as well. Unfortunately, the files that are generated by DVD Library Manager have two possible short comings.

First, DVD Library Manager sets direct references to the folder.jpg files in the largeCoverParams and smallCoverParams nodes. Although this might seem to be a good idea at a first glance, explicitly specifying references hinders portability of your metadata and is a likely cause of image loading issues. The reason for this is that the movie library is very fragile when it comes to loading images. If one of the referenced images is missing, the library does not show a single cover image for any of your movies. This makes it hard to determine the metadata file that is causing the problem. However, if both nodes are not contained in the XML file or if they are empty, the movie library will attempt to load the folder.jpg file from the folder containing the movie automatically. Thus, removing the reference is always safer.

Second, when you are creating metadata files with non-ascii characters such as a German Umlaut, for example, the movie library will sometimes choke on the metadata file in cases where it cannot figure out the correct XML encoding automatically. If this happens, the movie library will try to replace the seemingly broken metadata file with a freshly downloaded one. However, since the DVDID is actually an invalid id, downloading the file will not be possible. Consequently, the library will replace the seemingly broken file with an empty file that tells it not to try the download again. In order to fix this issue, you can manually set the XML encoding in the first line of the file to ISO-8859-1, for example.

windows-media-center-movie

Windows Media Center – Movie Library: The final result is worth the effort

Since I detected both issues with the output of DVD Library Manager only after having created a number of files, I hacked a simple Windows .NET console application in C# that allows you to correct both of them automatically. DvdInfoFix takes a single metadata file or a folder as an input. In the first case, it will rename the file to <filename>.xml.backup and generate a new file without direct image references and with a hardcoded ISO-8859-1 encoding. In the latter case, it will do the same for all .xml files in the specified directory. In case you are not satisfied with the output, the application also encompasses the source code, feel free to modify it to make it suit your needs.