I want to use the Shortcuts app on macOS Monterey to modify M4A/AAC audio file metadata for files that I have ripped from CD to my local Music app library.
How can I use a regular expression on track titles to replace text that matches a certain regex pattern?
I have already written the regex, I just need help with the Shortcuts app.
I've started my shortcut with a "Find Music" action connected to a "Repeat with Each" loop action.
Within the loop, I use a "Get Details of Music" action to get the title, which is passed to a "Replace Text" action using my regex.
I just don't know how to write the correct new title into the music file's title/name metadata field. I tried a "Rename File" action with type "iTunes media" to try to set the "Title" field, but the field wasn't updated either in the Music app or in the M4A/AAC file itself. I couldn't find any other actions that seemed like they might be able to modify the field.
I'd prefer a solution that goes through the Music app / its APIs, rather than directly modifying the M4A on the file system, because the latter would force me to have the Music app scan for changed files after the files we're modified.