Search code examples
iosxmlitunes

iTunes Library "Distinguished Kind"


I'm parsing iTunes xml library. Since iTunes 12 new playlists are available (TV Show, PDF, ...)

I would like to filter some of this playlists thanks to the "Distinguished Kind" key value.

Unfortunately these keys doesn't match the documented ITLibDistinguishedPlaylistKind

Where are documented these "Distinguished Kind" values?


Solution

  • I'm looking at an iTunes Music Library.xml file that was written with iTunes 12 and the Distinguished Kind keys do match the Apple documentation for ITLibDistinguishedPlaylistKind but they are offset by one. The enum is a zero-based index but the XML appears to be a one-based index. Subtracting 1 from the value in Distinguished Kind results in a correct match for all of my playlists.

    For example, given the XML entry for my "TV Shows" playlist:

    <dict>
        <key>Name</key><string>TV Shows</string>
        <key>Playlist ID</key><integer>117297</integer>
        <key>Distinguished Kind</key><integer>3</integer>
        <key>TV Shows</key><true/>
        <key>All Items</key><true/>
    </dict>
    

    Matches ITLibDistinguishedPlaylistKindTVShows from the ITLibDistinguishedPlaylistKind enum.