dougscripts.com

October 24 2019 - 6:16 pm

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.)

  1. ITLibrary does not know about Work and Movement tags.
  2. 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.
  3. 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.
  4. Ditto Loved and Disliked for tracks
  5. Ditto Loved and Disliked for playlists
  6. ITLibrary does not distinguish among types of cloud tracks (uploaded, matched, duplicate, etc)
  7. 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.

Site contents © 2001 - 2024 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not be interrupting the one who is doing it.