Doozle, a proof of concept 

Whenever I’m in my exam period, I need small projects to keep me busy during my study breaks. Doozle is one of them, I started Doozle somewhere this morning, and I finished it a few hours ago.
Everything you’ll see next is educational purpose only, their-for I won’t release it to the public. I respect the artists, and providing such a tool would only kill the spirit of those creating wonderful music.

I always wanted to write an application having the same purpose as the very famous Spotify. I don’t have a large music library, nor the information available. Luckily, there are plenty of websites available for free, providing the needed information. I picked the following:

  • Music data: last.fm
  • Music file: youtube.com
  • Conversion tool: youtube-mp3.org

I used the freely available API from last.fm to gather as much information of a track I need (artist, album, title and cover image). Next, I used that information to find a suitable match on youtube, I wrote a small algorithm that selects the best youtube video when it comes to sound. Channels like the official artist page, or VEVO are priority because of a higher music quality.

So far, so good. I was able to list all the information and pick the needed movie. The harder part is yet to come, converting the youtube file to an mp3 file would require some more work. Instead, I choose to use a publicly available service, named youtube-mp3.org. This is where I got stuck for a short while, they don’t have an API available. I analysed how they handle the requests, and how they eventually process that request. I have a small background in hacking and data analyzing, so it’s not much of a big deal. I was able to snoop some data out of the service, which was enough to keep me going:

info = { "title" : "Hotfire - Girlfriend (CopyLeft)",
"image" : "http://i4.ytimg.com/vi/hTU0tzLwddE/default.jpg",
"length" : "3", "status" : "serving", "progress_speed" : "",
"progress" : "", "ads" : "",
"h" : "d0aa17294103e638fa7f5e0606f839d3" };

The data contains 1 important piece of information, the “h” tag holds a hash. Looking a little further, I noticed that they save the file on their servers for a short while, based on that hash. So basically, I now knew where I should look for the audio file. Accessing the file could then simply be done by executing the following command:

get?video_id=hTU0tzLwddE&h=d0aa17294103e638fa7f5e0606f839d3

As final in touch, the data gathered from the last.fm API is not included in the id3 tags located in the mp3 file. So I had to add them manually. By browsing on the internet, I found this awesome library called “TagLib” (http://developer.kde.org/~wheeler/taglib.html). I managed to add the tags myself (including the image). As result, I got this clean mp3 file containing all needed metadata.

As stated before, I won’t put a download link online for this program. Artists must get paid, right? Else we would run out of music. It’s simply a PoC (Proof of Concept) showing how powerful these three mediums combined are. That’s it for now, my next blog post will reveal some more information about my mobile development projects.