Dear Lazyweb, anyone got some sample code for talking to iTunes 10 through DAAP?

I tried to use Net::DAAP::Client but it Does Not Go.

(It seems that the search results for this question are poisoned with a billion answers that stopped working around iTunes 4.)

Tags: , , ,

18 Responses:

  1. Sowrray, the computer sez no:

  2. itunes' authentication on daap was never cracked past itunes 7. This is partially my fault.

  3. Ian McKellar says:

    You may be better off talking to iTunes through AppleScript. That's an actually supported, documented API.

    • The iTunes AppleScript API cannot do the essential things that DAAP does, most importantly: actually stream audio over the network. I could go on, but won't.

      The short version of the DAAP answer is that due to the ever-more-baroque encryption involved, No, you cannot talk to Actual iTunes™ using any known open source DAAP library. You can talk to other DAAP servers, e.g., mt-daapd, forked-daapd, as they don't glob encrypted authentication onto everything. But Actual iTunes™? No.

    • jwz says:

      Unfortunately AppleScript doesn't expose the info I'm looking for (how many votes a track has). The iPhone "Remote" app sees it, though, even when not authenticated to iTunes. Does the new iTunes crypto crud prevent you from connecting to iTunes even as an anonymous guest, like you can do with Remote?

      • Investigating this all now. So far:
        - I believe that cryptocrud prevents everything that involves connecting.
        - learned that "iTunes DJ" == "Party Shuffle"
            set DJPlaylist to (get some playlist whose special kind is Party Shuffle)
        - cannot find any API for "votes" yet: not in ObjC, not in ScriptingBridge, not in AppleScript

        There is a "computed rating" for each track (and album), but I have not yet deciphered WTF "computed rating" means. It may be affected by Votes.

        • jwz says:

          I believe the "computed rating" of a track is the average rating of all songs on the same album (or maybe of all rated songs on that album). It's the "hollow star" thing you see sometimes.

          I don't see any evidence of votes being present in iTunes Music Library.xml either.

          BTW, you can provoke ratings without using an iPhone by selecting *"Add to iTunes DJ"* from the context menu of any track in the library. It shows up in iTunes DJ with 1 vote, immediately after any other tracks with votes. (*"Play Next in iTunes DJ"* does not mark it as voted, though.)

      • Dusk says:

        The iTunes remote API is, in fact, not DAAP. It's something else:



        • jwz says:


          I haven't been able to get iTunes to do anything with that so far. It looks like pairing is a complicated dance where you need to have iTunes connect back to your server, but Remote lets you talk to iTunes anonymously without pairing at all, so that shouldn't be necessary, right? I can't get iTunes to give me anything but "501 not implemented" when I do things like in the example: http://localhost:3689/login?pairing-guid=0x0000000000000001

  4. perlguy9 says:

    I think some of this stopped working when iTunes switched to the whole "Home Sharing" tied to your Apple ID model.

  5. Have you taken a look at TunesRemote+ ? Open source android app (I know I know). But it works for me quite well with iTunes whateveristhelatestversion. And ecently it even started showing album covers, rating and whatnot. So perhaps you could take a look inside and see how they do it?

    • jwz says:

      From looking at the code that is inside there, it looks exactly like the sample code I've seen on other sites -- sample code which only works with iTunes 7 and earlier. So if you say that this code works with iTunes 10, I don't see how that's possible.

      E.g., amongst the paucity of comments it contains is:


      which is "501 Not Implemented" in recent iTunes. That API is gone.

      • Well, I am not sure how it does it, but it works for me with my iTunes. I just checked. Odd?

      • just checked #2 - I just tried to connect to a different iTunes instance on my Mac. And what do you know - it failed. Odd all over. Could it be that I have been connected with my phone to iTunes on my home box for about 1.5 years (since I bought this phone). Would iTunes and my phone remember my session for so long? Or is it because my home box is Windows, and iTunes on Windows is substantially different than on Mac and still supports old API?