Page content

Exporting the Winamp CDDB Database

Introduction

You can let Winamp download album information from CDDB automatically for each audio CD you play. It is only a matter of time for the local Winamp CDDB database you build by playing your CD's with Winamp to contain information of almost all of your albums. Of course you'd like to do something with this database, but unfortunatily Winamp doesn't store is as plain text (the Windows CD player, for example, does).

Play List Converter

So you'll need something to extract your album information from the local Winamp CDDB database. After some searching I found a tool to do this for you, Play List Converter by Alex Yakovlev (it's Freeware).

With this tool you can generate an HTML report of your album database. From there, the steps to create different representations of this data are quite trivial.

From HTML to XML ...

I wrote a simple XSL script to transform the HTML report to an XML format (I was lucky, because the HTML report was well-formed XML). This is an example of an output XML document:

<?xml version="1.0" encoding="UTF-8"?>
<collection>
   <album>
      <artist>Ciccone Youth</artist>
      <title>The Whitey Album</title>
   </album>
   <album>
      <artist>Steve Miller Band</artist>
      <title>The Joker</title>
   </album>
</collection>

... to HTML again

Once you have this XML file you are really free to transform it to whatever format you like. I wrote another XSLT stylesheet to transform this XML to an XHTML representation.

<?xml version="1.0" encoding="UTF-8"?>

<xsl:transform version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns="http://www.w3.org/1999/xhtml">

<xsl:output method="xml" indent="yes" encoding="UTF-8"
     doctype-public="-//W3C//DTD XHTML 1.1//EN"
     doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>

<xsl:template match="/">

   <html>

   <head>
      <title>Music list</title>
   </head>

   <body>

   <h1>Music list</h1>

   <xsl:apply-templates select="collection"/>

   </body>

   </html>

</xsl:template>


<xsl:template match="collection">

   <table>
      <thead>
         <tr>
            <td>Artist</td>
            <td>Album</td>
         </tr>
      </thead>
      <tbody>
         <xsl:apply-templates select="album">
            <xsl:sort data-type="text" order="ascending"
                                       select="artist"/>

            <xsl:sort data-type="text" order="ascending"
                                       select="title"/>
         </xsl:apply-templates>
      </tbody>
   </table>

</xsl:template>


<xsl:template match="album">

   <tr>
      <td><xsl:value-of select="artist"/></td>
      <td><xsl:value-of select="title"/></td>
   </tr>

</xsl:template>


</xsl:transform>

Write your own tool

Because using the Play List Converter is far from ideal, I'm about to write a simple Perl program to extract the album information from the local Winamp CDDB database (and, of course, prints it as XML data). This database is stored in the file 'in_cdda.cdb' in your Winamp Plugins directory.

(Update: don't expect anything from me this decade, as I have other things to do...)