iTunes was long able to create an XML file, which was a readable dump of its library file, so the apps could access information about your library. This file was also useful to have as a backup; if your iTunes Library file got corrupted, loading the XML file could allow you to recover your library.
In the macOS Catalina Music app, you can no longer have this file created automatically, but you can create it manually. This can be useful if you’re a DJ and want to use it with software that hasn’t been updated to use the iTunesLibrary framework, or if you just want to have a backup of your library.
To do this, choose File > Library > Export Library, name the file, and save it.
Again, there’s no way to automate this, but if you do need the file to use with a DJ app, you can just dump it before your set.
Learn more about the new media apps that replace iTunes in macOS Catalina in my new book, Take Control of macOS Media Apps.
Presumably this _could_ be automated with UI scripting? I’m not saying this is desirable, but surely possible?
I’m not sure about UI scripting, but I know it can’t be done with AppleScript.
Yeah, I saw there are no commands in the scripting dictionary, but UI scripting is a feature of AppleScript where you can describe the UI element you want to select (so you can specify a menu item to select). I’ve not used it much, but I think it could be used as a hack to automate something like this that’s not in the app’s scripting dictionary.
I know. Not something I’ve ever really used, however. It would require that the Music app be open and frontmost, right?
UI scripting is used in standard AppleScripts, so you could use a normal
tell application “Music” to activate
as the first line of the script, and then go into the UI scripting.
Thank you for sharing this. It’s depressing how many tech articles today expressly insisted this manual iTunes XML exporting functionality doesn’t exist in Catalina:
https://www.forbes.com/sites/ewanspence/2019/10/08/apple-macos-catalina-broken-update-mac-imac-macbook-pro-fix-mistake/
https://www.factmag.com/2019/10/08/apple-macos-catalina-update-dj-apps/
https://www.theverge.com/2019/10/7/20903391/apple-macos-catalina-itunes-dj-software-breaks-xml-file-support-removal-update
Yes, that’s why I wrote the article
It indeed is very sad how everyone is repeating each other without due dilligence.
I posted this article on Redit the moment Catalina went public
https://www.reddit.com/r/DJs/comments/dexbwq/itunes_catalina_the_reason_why_you_really_want_to/?utm_source=share&utm_medium=web2x
I contacted Dani and even provided her with a short video showing how this works
https://youtu.be/0VXKg8dJcFw
Still the article has yet to be rectified, but I see it pop up all over the net.
And I got in touch with the editor of the Verge, and he said “We stand by our reporting.” Go figure.
really? that’s nuts. I can’t post on the Verge (yet) but feel free to share my links over there
btw this can’t be AppleScripted (trust me it was the first thing I tried in the Beta).
It can indeed be User Interface (UI) scripted (=recording mouse clicks/movements and key strokes), but that is too sensitive to user interference while the script is in progress, messing up the script’s execution. And it would be language dependent to store the XML at the to be expected location, something you don’t want.
Does it need to have a specific name and be in a specific location, or can you point these DJ apps to the file wherever it is?
it’s safest to keep it in the folder iTunes within the Music folder and name it iTunes Music Library.xml
~/Music/iTunes/iTunes Music Library.xml
not all software allows for chosing a random stored XML. most have the above file path hardcoded
I posted this script on the Slimdevices Forum. It may be of interest to someone here.
This is not meant as a solution to the missing .xml file, I was just looking at what could be done in Catalina. The script is ugly, not very tested, sends keypresses to the Music application, and it will probably break unless used carefully. But it will attempt to tell the Music app to do a File – Library – Export Library… and put it in ~/Music/iTunes/iTunes Music Library.xml which is probably where applications expect to find it. So it is not production ready, but it appears to work. So I figured someone else might want to look at half automating the export of the xml file.
You can open the script in Script Editor and export it as an Application to run it by double clicking on it. You will have to grant it access in Security Preferences of Catalina. With minor modifications it should be able to export specific playlists to xml. And you can of course do the same manually from the Music app on Catalina, which is safer.
[code]
tell application “Music”
activate
end tell
tell application “System Events”
tell application process “Music”
tell menu 1 of menu bar item “File” of menu bar 1
click menu item “Export Library…” of menu 1 of menu item “Library”
end tell
repeat until exists window “Save”
delay 0.1
end repeat
set musicfolderpath to get path to music folder
set libraryxmlpath to POSIX path of musicfolderpath
tell window “Save”
keystroke “g” using {command down, shift down}
repeat until exists sheet 1
delay 0.1
end repeat
tell sheet 1
keystroke libraryxmlpath
keystroke “/iTunes”
click button “Go”
end tell
tell window “Save”
keystroke “iTunes Music Library.xml”
end tell
click button “Save”
if sheet 1 exists then
click button “Replace” of sheet 1
end if
end tell
end tell
end tell
[/code]
@roundjr I’m exactly where you are at in all of the above and have not found a better way to date. Your solution works at my end. I am also on a quest to address the “Music.app” directly without keystrokes.