What APIs can be used to modify the Music.app library?

Hi everyone,

I'd like to write a one-off app to make some modifications to my own Music.app (aka iTunes) library. This is for content that I have stored using iTunes Match, so it's effectively a library that dates back to the iTunes years.

However, from what I can see, APIs with modification support are essentially... nothing? I can get everything ready in a simple Swift command-line app using https://developer.apple.com/documentation/ituneslibrary, however I can't actually write any changes.

It seems that the only modification solution available is actually still AppleScript. Everything there still works, and in theory I could do the majority of the logic using iTunesLibrary and then do the modifications with AppleScript via NSAppleScript.

In order to do this, I just need an identifier that I can use to correlate items from each API. There is:

However, in my experiments it didn't appear that any of these correlated together

Of course, I could possibly re-write the whole thing using AppleScript, but that would be slow and painful!

So, posting here to see if anyone has any idea how or even if this can be done.

Hope someone can help! Thanks in advance

What APIs can be used to modify the Music.app library?
 
 
Q