Category Archives: Uncategorized

iTunes to foobar2000

I got sick of iTunes, and decided to move to foobar2000. The biggest things that annoyed me about iTunes:

  • Speed, or lack of. It is the slowest responding application I use, and I really dislike it
  • No support for global media keys, and the plugin I used to use stopped working too..
  • No Milkdrop support (on Windows, Mac users get projectM at least)
  • Sound check sucks. I got sick of some songs getting way too loud for no reason, because the sound check thought the song was too quiet

The list could go on and on.. but I’ll focus on the migration itself.

First, I installed foobar2000 from the website, no issues. Configured a few options to my liking, got it to use my music folder.

My main step was ReplayGain, so I ran it and let it go for 2 hours. Unlike iTunes however, even when something is being processed, foobar2000 still lets me use the main interface which was great. Unfortunately I couldn’t try components, as they need a restart, so that had to wait till later.

Once all my tracks had their ReplayGain data, I decided to import my play counts, ratings, and other similar data from iTunes. This is where I hit a roadblock. I found a couple of posts that seemed to look OK, but didn’t really work our for me. So I decided to come up with a way and document it.


Note: you need foobar2000, iTunes and the play counts and mass tagger components.

1. Make sure all the files in foobar2000 are also in iTunes, and export a m3u playlist from foobar2000. This playlist is used to generate the ratings+play counts in the correct order for mass tagger (which we’ll use later).

2. Do a find+replace in your m3u playlist, or something similar to make sure all paths are absolute. Eg, your m3u lines should not just be “Music\Artist\song.mp3” but more like “C:\Users\UserName\Music\Artist\song.mp3”. A simple replace of “Music” with “C:\User\UserName\Music” would achieve this.

3. Use this application to generate output for mass tagger. Click the button at the bottom, and select the exported playlist, and it will automatically find all the information using the iTunes COM interface. This will take a while (and the progress bar will go through twice). Once it’s done, you’ll have the mass tagger input data on the left, and any error information on the right. (Errors are not a bad thing, more like warnings for files which won’t have data exported).

3. Load up foobar2000, make sure you select the exact same songs you generated the m3u from, right click, choose Tagging > Manage Scripts. Clear any existing actions. Choose Add -> “Input Data (one line per track)”. For the scheme enter:
%rating%|%play_count%|%last_played%|%skip_count%|%last_skipped%|%added%
In the Input data section, copy and paste all the output from the left box from the earlier application and press OK.
Ensure that the data changes in the output preview look OK, and if so, press “Run”. This will take a while.

4. Now, all the data has been written to your tags. You can select all your tracks, right click, and chosoe Playback Satistics -> Import statistics from file tags. This will import all your data into the play counts component. Once imported, feel free to remove tags added (%rating%, %play_count%, %skip_count%, %last_played%, %last_skipped%, %added%) from the tags using mass tagger again.

And that’s it! Hopefully all your data has been imported into foobar2000.

PS: you can check out the source for the above application here.

Python vs C++

I was writing some image processing code (using OpenCV) and found that my python code was too slow for my liking. So I converted it to C++! How painful was this? It took me less than an hour to convert the code, and I got a good 100x speedup! Use the right language for the right task..

Getting around flash streaming sites using a proxy server

Sites that stream music or videos through Flash interfaces are extremely common, and most of the time can be circumvented easily either using:

  • Online sites created solely for the purpose of extracting the real music or video URL
  • Using Chrome’s developer tools to find the exact resources being loaded, and simply opening the largest file
  • Browsing the source, decompiling the flash, and recreating the exact authenticated etc to access the file as if you were the real client.

This works great for most sites, but I recently came across a site that none of these worked on (grooveshark). For the educational value, I decided to try a new approach: write a simple HTTP proxy server that simply cached the file type that I wanted.

The simplest way was to use Python and Twisted, and I found a great example of intercepting specific requests and modifying them here.

I took the code there, and modified it so that it looked for the Content-Type I was looking for (audio/mpeg), and cached those files. I started up my HTTP server, told my browser to go to Grooveshark, listened to the file I wanted, and done! I had a cached copy of the file.

This method will work with any site that uses HTTP.