Thanks a lot! That's awesome!
I tested a new MB generated iTunes xml with the above patch in my target software right away as this got me rather excited, i.e. Serato SSL / Scratch 2.5, SDJ Pro 2 Beta, Rekordbox, Traktor 2....
But unfortunately that fix has introduced a few issues on all of them and the xml is not useable as is for neither of them (empty playlists, erratic consistency/missing entries/files & iTunes playlists pop up all over the place now [usually they are contained in an 'iTunes' node in all of them that can be expanded, looks like the empty playlists that just act as parents are to blame here...])
So I had a look around and installed an older iTunes 10 version on an old pc to see what might be amiss, and from what I can see, one little step is missing still. i.e. this is what an iTunes generated xml with nested/parented playlists looks like:
<dict>
<key>Name</key><string>iTunesPlaylistStaticGroup</string>
<key>Playlist ID</key><integer>171</integer>
<key>Playlist Persistent ID</key><string>4A91BFFA25BC6435</string>
<key>All Items</key><true/>
<key>Folder</key><true/>
<key>Playlist Items</key>
<array>
<dict>
<key>Track ID</key><integer>76</integer>
</dict>
<dict>
<key>Track ID</key><integer>78</integer>
</dict>
<dict>
<key>Track ID</key><integer>284</integer>
</dict>
<dict>
<key>Track ID</key><integer>276</integer>
</dict>
<dict>
<key>Track ID</key><integer>80</integer>
</dict>
<dict>
<key>Track ID</key><integer>281</integer>
</dict>
</array>
</dict>
<dict>
<key>Name</key><string>iTunesPlaylistStaticGrouped1</string>
<key>Playlist ID</key><integer>177</integer>
<key>Playlist Persistent ID</key><string>FBCF922FE783DB99</string>
<key>Parent Persistent ID</key><string>4A91BFFA25BC6435</string>
<key>All Items</key><true/>
<key>Playlist Items</key>
<array>
<dict>
<key>Track ID</key><integer>80</integer>
</dict>
<dict>
<key>Track ID</key><integer>76</integer>
</dict>
<dict>
<key>Track ID</key><integer>78</integer>
</dict>
</array>
</dict>
<dict>
<key>Name</key><string>iTunesPlaylistStaticGrouped2</string>
<key>Playlist ID</key><integer>300</integer>
<key>Playlist Persistent ID</key><string>C5A498A0298059DB</string>
<key>Parent Persistent ID</key><string>4A91BFFA25BC6435</string>
<key>All Items</key><true/>
<key>Playlist Items</key>
<array>
<dict>
<key>Track ID</key><integer>284</integer>
</dict>
<dict>
<key>Track ID</key><integer>281</integer>
</dict>
<dict>
<key>Track ID</key><integer>276</integer>
</dict>
</array>
</dict>
And 2 unparented ones of the same:
<dict>
<key>Name</key><string>iTunesPlaylistStatic1</string>
<key>Playlist ID</key><integer>165</integer>
<key>Playlist Persistent ID</key><string>F82339FC6F0069EF</string>
<key>All Items</key><true/>
<key>Playlist Items</key>
<array>
<dict>
<key>Track ID</key><integer>78</integer>
</dict>
<dict>
<key>Track ID</key><integer>80</integer>
</dict>
<dict>
<key>Track ID</key><integer>76</integer>
</dict>
</array>
</dict>
<dict>
<key>Name</key><string>iTunesPlaylistStatic2</string>
<key>Playlist ID</key><integer>245</integer>
<key>Playlist Persistent ID</key><string>4AA0360DE815561F</string>
<key>All Items</key><true/>
<key>Playlist Items</key>
<array>
<dict>
<key>Track ID</key><integer>276</integer>
</dict>
<dict>
<key>Track ID</key><integer>284</integer>
</dict>
<dict>
<key>Track ID</key><integer>281</integer>
</dict>
</array>
</dict>
So looks like the parent declared in
<key>Parent Persistent ID</key>
needs to recursively hold references ('Track ID') to ALL of its' child playlists contents ('Track ID') as it looks.
What do you reckon / what's best here for you - revert to the previous state, which mostly worked bar not having the parent folders, or add the feature to populate the parent playlist as per how apple/itunes does it themselves ?
Also, while on the topic of itunes xml & playlists - and feel free to ignore this... { I can relate, I get angry having to deal with the itunes rubbish, unfortunately the above Dj software bits are all equally useless when it comes to internal library & playlist management (no multi value metadata support, only very basic smart playlists, no access to many standard as well as custom metadata frames [i.e. some trivia - Serato hasn't managed to support the POPM field... despite it being requested by thousands of people every year still... since 2004 ish...]) }
But the last little annoyance with MB & iTunes I have to work around on a weekly basis (when exporting the xml to the target app):
Is there a way to push a specific sorting for smart-playlists into the resulting iTunes playlist sorting ?
As is, static playlist come through fine via ''natural sorting' (so I am using this work around:
https://getmusicbee.com/forum/index.php?topic=20764.msg127533#msg127533 )
but smart-playlists -> itunes playlist always end up being sorted sequentially by iTunes'
<key>Track ID</key><integer>1</integer>
which never has anything to do with the sorting one might actually be after or what is switched on as the active sorting (which seems to be the trigger for static playlist exports that I shoe-horn for this)...
So if you can think of an easy way to push MB's active sorting for smart-playlist/s to the respective iTunes xmls playlist/s, that would be rather awesome!
Cheerio.
c.