Creating a taste profile from a directory of MP3 files

One of the most common tasks involved in using taste profiles is creating a profile from a directory on the file system. Since this task fundamentally requires some scripting (rather than a simple API call) this tutorial will show an example written using Python and Pyechonest, the Echo Nest Python library.

Creating and updating a taste profile

To create a taste profile, there are a set of steps that you need to follow. First, you must create a catalog using the catalog/create API call. Then, you must update the catalog based on the songs or tracks in question. The Echo Nest Catalog API performs all of these actions asynchrononously, returning the application developer a ticket which can be used to verify the status of the catalog. After updating the catalog, you may call catalog/status to verify the status of the catalog, by using the ticket provided in the catalog update calls. The Create and Update Taste Profiles tutorial details these steps, but the easiest way to see it is via a scripting language example.

Here's an example in Python.

Explaining the Python Example

This example relies on the eyeD3 python package, for accessing MP3 ID3 tags. It can be found here. It also requires the Pyechonest Python library.

The tutorial will create a catalog with a user-provided name and type, and then will walk a provided directory to find all MP3 files in that directory and all subdirectories. It will create a list of item JSON objects in the catalog/update required format, and then pass them in batches to the catalog/update method.