Daap with an itunes Server

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Daap with an itunes Server

Post by Todd_Z »

So I'm trying to write a program that will scan the computers on my network for the song databases, and run some sort of statistical analysis, just for fun i guess - partially to learn the DAAP protocol. However, I think i'm missing something:

http://daap.sourceforge.net/docs/index.html

It seems as if when you send a /login request, you should get a session id that you then append to the next request, such as daap://server/databases?session-id=<sid> to be "authenticated".

However, this is the response I get from a /login:

Code: Select all

mlog^@^@^@^Xmstt^@^@^@^D^@^@^@M-Hmlid^@^@^@^D^\qKM-^I
The mlid information stores the session id, however I can't see how. Any ideas?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

I bet it's in binary. Could you post a hex dump of the info you're getting from the /login request?
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Post by Todd_Z »

6d6c6f67000000186d73747400000004000000c86d6c69640000000400007335

bin2hex( $response )
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

ok, let's split that out:

Code: Select all

0x6d6c6f67 => mlog
0x00000018 => length of the response (24 bytes)

    0x6d737474 => mstt
    0x00000004 => length of the mstt chunk (4 bytes)
       0x000000c8 => mstt content (status, 200 in decimal, means 'OK')

    0x6d6c6964 => mlid
    0x00000004 => length of the mlid chunk (4 bytes)
       0x00007335 => mlid content ( big-endian, 29493 in decimal)
The docs you're linked to does not say how you pass the session id back to server, but if you're sure it should be passed as get param session-id then try:
daap://server/databases?session-id=29493
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Post by Todd_Z »

How does one properly parse out that session id then? I'm guessing a substr() wont cut it.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Post Reply