iTunes Library.xml v. ITLibrary
A couple of years ago, Apple added a new option to iTunes Preferences:
This, and the fact that the support doc for this feature referred to the "Legacy library XML", was Apple's way of telling developers that the XML was going to go away.
The iTunes Library.xml file is a condensed version of the iTunes Library database periodically exported as a property-list-like text file by iTunes itself, generally whenever a change occurred to the database: you played or tagged a track, created or deleted a playlist, and so on. It can easily be imported and parsed quickly by an application, even an AppleScript. You've probably used an AppleScript from this site that asked you to turn the "Share" option on, right?
A year or two before the "Share" option was added, Apple introduced the ITLibrary framework, which is an API that developers can use to get info about the iTunes library (and now the Music and TV apps) instead of having to use the iTunes Library.xml file.
So anyway, the XML has finally gone away, effectively, since it is no longer automatically exported.
I've been trying to incorporate the ITLibrary framework into my projects whenever I can, especially for apps that need to display lots of tracks or playlists (like Media Folder Files Not Added).
But ITLibrary was apparently last updated for macOS 10.13. And now that iTunes has been split out into the media apps, it's usefulness over the XML file has not been improved.
(And please. Don't let me hear anyone suggest some groovy way of exporting the XML automatically. Forget about the XML. Unless it's for backups or something.)
- ITLibrary does not know about Work and Movement tags.
- ITLibrary does not know the difference between playlists in the Music app and playlists in the TV app. You can ask for discrete music tracks or TV tracks or movie tracks, but not discrete playlists from either app.
- ITLibrary does not know what a subscription playlist is. It's an Apple Music playlist you have added to your library. ITLibrary sees it as a Regular playlist.
- Ditto Loved and Disliked for tracks
- Ditto Loved and Disliked for playlists
- ITLibrary does not distinguish among types of cloud tracks (uploaded, matched, duplicate, etc)
- ITLibrary does not provide a Track ID which is used to correlate the tracks in a playlist to their library entries and vice versa.
And I'm sure I've run into other minor impediments. Wait, bonus gripe: converting decimal persistent IDs to hexidecimal. (Strangely, the ITLibrary required you codesign your app in order to use it, but I'm not seeing this prohibition in Catalina. Am I missing something?)
It would be great if someone over there could give us a dusted up version of ITLibrary. Meanwhile, there's still AppleScript.