porsh
porsh

Reputation: 143

Parsing itunes library xml only for smart and user created playlists

I am trying to parse itunes music library xml for itunes 10. The requirement is to parse only the smart and user created playlists and skip Library, Music, Movies, Tv Shows.

Smart playlists have Smart Info and Smart Criteria. Let say I have a user created playlist called Library and Music, how can I distinguish them from original Library and Music containing all my music?

<key>Playlists</key>
<array>
    <dict>
        <key>Name</key><string>Library</string>
        <key>Master</key><true/>
        <key>Playlist ID</key><integer>893</integer>
        <key>Playlist Persistent ID</key><string>1BEAC6B526CA9EE0</string>
        <key>Visible</key><false/>
        <key>All Items</key><true/>
        <key>Playlist Items</key>
        <array>
        .....
        </array>
    </dict>
    ...
    ...
    <dict>
    <key>Name</key><string>Library</string>
    <key>Playlist ID</key><integer>1509</integer>
    <key>Playlist Persistent ID</key><string>8F9656FD7FC595B1</string>
    <key>All Items</key><true/>
    <key>Playlist Items</key>
    <array>
    ....
    </array>
    </dict>
</array>

The only major difference I see the 'Visible' text.. Master is not available for Music, Tv Shows, so can not use it either. Am guessing there should be distinction possible based upon playlist id or playlist persistent id.

Upvotes: 0

Views: 1310

Answers (2)

porsh
porsh

Reputation: 143

After playing around with multiple possibilities, required result was obtained by excluding those playlists with one of the following 3 keys:

<key>Distinguished Kind</key>
<key>Master</key>
<key>Folder</key>

Upvotes: 2

jackjr300
jackjr300

Reputation: 7191

You must exclude those with one of these Keys

<key>Distinguished Kind</key>
<key>Master</key>

Upvotes: 1

Related Questions