iTunes

gnat on 2003-05-08T21:56:04

I spent a fun day yesterday with this gentleman, pulling the iTunes sharing protocol to pieces. Todd did all the hard work and I wrote some Perl code to implement it.

It turns out that iTunes sharing is just HTTP, as pudge observed. The problem is that you can't just make a single GET to download a file. You need to get a session ID, figure out which database you're accessing, and learn the unique ID of the song you want to download. And the responses from all these requests are DMAP files, a hideous binary pseudo-XML-with-types that's a turd to parse (I know because I've written three turds of parsers so far). The only thing I don't have sussed is authentication, but I believe that's easy to add.

I've got Quicktime and mpeg4 demoing the command-line shell for connecting, searching, and downloading files from someone else's iTunes. I'm not releasing the source, though, until I talk with Tim O'Reilly and Apple and figure out whether I'll be getting my arse sued off ...

--Nat


nicely done

garron on 2003-05-09T04:31:49

I will never question your priorities Nat. A hacker to the end.

Looking forward to a cookbook chapter on iTunes. ;)

Bravo!

wickline on 2003-05-09T11:26:46

You da man!

Good luck with the legal schtuff :)

-matt

Server

pudge on 2003-05-09T12:09:03

Don't forget the server code, so we can play via iTunes MP3s sitting on a server without iTunes on it. :-)

I've wanted to work on this, I wish I had time to help out, but we are moving in about a month and I am doing my darndest to get Mac::Glue out. It is almost ready, too! Wooo!

Have you seen iTunesdl? It's a Cocoa app that shows you a library and lets you download MP3s. No docs or source.

Anyway, thanks for moving forward on this, we need it. If you decide you can't release it, maybe you can launder the source to someone else who can. :-)

Re:Server

gnat on 2003-05-09T16:35:06

Todd's got his eye on the server side of things. My thought is that it should be possible to have an Apache::MP3 type module that pretends to be an iTunes server. I already checked and you can pass a port argument when you connect (my.hostname.com:3690 makes iTunes connect to port 3690).

iTunesdl is cute. But with my code, you could mirror a remote iTunes database, write a gnutella-to-iTunes gateway (Rael suggested making gnutella look like an iTunes server), aggregate multiple iTunes servers through a proxy, etc.

Also, Todd's now looking to find other dmap files on the system. For instance, the iTunes database and the databases on your iPod all seem to be some variant of dmap format. I'd love to be able to copy specific songs and albums back off my iPod without having to id3info every damn mp3 file. And of course, making your iPod available as an iTunes server is a very real possibility ...

--Nat

Re:Server

ryaker on 2003-05-10T00:35:49

I just want to get the playlist data so that I can manipulate it and show my library through a web browser. Present different views of my iTunes library. SO I am looking forward to your release of the perl code because I want to do this in PHP.

Thanks for the efforts.

Re:Server

oberd on 2003-05-10T13:35:46

I'm working on a standalone daap server (daapd). An Apache module is a nice idea, though, and I just happened to think about proxies this morning, too :)

I hope that I have something to release at the end of the weekend. Let me know how the legal issues turn out. Apropos O'Reilly: Rob Flickenger has done some work on the Rendezvous side of things.

I'm the guy with the daap wiki.