Project Details

Type Mashup
Client John Price
Duration March 2011 until March 2011

Technologies, Languages & Frameworks Used

Services Used

Instant Playlist Beta

Music playlist generator

  • Case study by John
  • March 12th, 2011
  • Updated on April 12th, 2011

Instant Playlist generates playlists independently, based on the tags entered by a user. It uses Last.fm and The Hype Machine to retrieve a tracklist, and bases a playlist on that.

How does it work?

Firstly, before any processing or generation is done, the user's input parameters have to be accepted. The user must enter up to 5 tags which describe the type of music they want to hear. The next parameter to be set allows the user (using a sliding scale) to choose what kind of music they would prefer to listen to - between all currently hyped & trending tracks, to all time popular tracks (or a mix of both). Finally, the user must choose a title for the playlist, after which the generation process can begin.

Instant Playlist utilises the Last.fm API and The Hype Machine's JSON hooks (on their search pages) to retrieve tracklistings based on tags entered by a user (e.g. 'summer', 'dance', 'rock', 'female vocalists', 'britpop', etc.). For each tag, Instant Playlist retrieves a list of tracks from both Last.fm and The Hype Machine matching those tags. These tracklists are checked for duplicate tracks (which would be pointless and annoying when creating a playlist). The tracklists are then counted, shuffled (randomised), and based on the level of hyped and popular tracks the user chose, proportionally truncated.

Finally, after all this has happened, all tracklists are merged into one, shuffled again, and truncated to a maximum of 60 tracks, and a minimum of 10 tracks (if there are fewer than 10 tracks, the user is sent to the beginning of the playlist creation process and prompted to try a different mix of tags and hyped/popular tracks). The maximum number of tracks is likely to increase in the future, but for now it seems to be a good maximum length for a playlist to be.

The tracklist is then stored in the database (in track, artist, track position, tag and playlist tables).

After this has been completed, the Spotify lookup process is initiated, and the user is redirected to the new playlist page which contains a message that tracks are being processed.

The Spotify lookup process is a Python script which uses the Spotify Metadata API to lookup track data in Spotify, to attempt to find playable tracks. If a track is playable via Spotify, the Spotify URL is saved to Instant Playlist's track table (which also displays the 'Listen' link on playlist pages). After all tracks in the new playlist have been checked, the playlist is updated to reflect that (removing the 'track processing' message from playlist pages). It takes an average of 1 second per track to retrieve playability information from Spotify (a 'polite' wait period between lookups is set to 1 second). Tracks which already have playability information are not checked twice.

Design and aesthetics

The design is very minimalist and spartan. The only purpose of the site is to list playlists, and allow the user to create a playlist very quickly. In this regard, it succeeds. There are also no adverts (part of the ToS of using the Last.fm API).

Future improvements to the UI include adding a 'browse' page, which will allow users to browse playlists by tag, search tracks and artists, and see the more popular playlists. A search function will also be developed to search playlists from any page.

On artist and playlist pages, additional information is presented from Gatekrash of potentially relevant UK event listings. On artist pages, this is based on the artist themselves, and on playlist pages, it is based on the tags used to generate the playlist. This uses the Gatekrash API to retrieve event listings.

Future development

There are several future improvements to the UI and other parts of the site, which I've set out in a blog post. As they're implemented, I'll update this case study with more information.

More information

If you would like more information about Instant Playlist, please don't hesitate to get in touch!