Steves Code Corner

Saturday, January 14, 2006

View iPod Nano songs without iTunes, C# Express, Part 2

In this post, I'll discuss the application goals, and describe the general idea of what we are creating.

Application Goals: What are we creating?

Basically what we want to create is a C# application that resides on the iPod Nano. When this application is run, it will bring up a list of all the songs on the iPod (both protected and non-protected). Once the list is populated, the user can select a song and play it using the default song player (NOTE: This is not a hack program. If the song is a protected iTunes mp4 file, it will not play unless the user has iTunes installed and is licensed to view the song).

Another function the user can perform is to the extract song(s) from the iPod to the current machine. The extracted songs will be placed in a readable Artist\Album\Song Name directory structure format.

Here is a screenshot of what we want to create...

In order to create this application, we will need to answer a couple questions:
1 - Where is the song list stored, and in what format?
2 - Where are the songs themselves stored?
3 - Where does that one missing sock go after washing my clothes?

Although we may never know the answer to 3, we can answer the first two questions with some degree of certainty.

1 - The song list is stored in the \iPod_Control\ITunes\iTunesDB file on the iPod. This is the good news. The bad news is that the data is stored in binary and in a rather funky structure. Luckily all the hard work to decipher what the bytes mean and how the file is structured has already been figured out by the folks at ipodlinux.org. Here is the page that describes the database file in all it's grisly glory: http://ipodlinux.org/ITunesDB. Make sure to bookmark this page (as I did) if you plan on extending this code or writing your own database file reader. It's an invaluable resource.

2 - The songs themselves are stored in the \iPod_Control\Music directory, in one of the F0# subfolders. If you open any of these subfolders, you will see that the songs have a bizarre naming structure "XXXX.mp#", where the XXXX is stuff like ABCD and DDCF. Why they did it this way is anyone's guess, though I suspect it's so nobody could do something as useful as copying songs from the iPod to a machine that doesn't have iTunes.

So that's the goal of the app - To open the binary db file, get the song list, and be able to associate that list to the actual song files. Once we have that associated list, we can play or copy the songs to a machine that doesn't have iTunes installed.

In the next post, I'll describe the two assemblies we are going to build: the database reader library and the UI.

0 Comments:

Post a Comment

<< Home