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
I will never question your priorities Nat. A hacker to the end.
Looking forward to a cookbook chapter on iTunes.
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.