Prune Artist Name from Track Name in Song Metadata

I have a quite a few songs from an older hard drive that have the artist name contained in the song name after a dash. After poking around Dougs scripts and searching this forum I can't quite find a script that searches for one conditional metadata attribute within another. In this case "- [artist name here]" within song name. Any help would be awesome. Hoping to get something in my menu bar after dropping into my Music's ascriptions folder.


Current Song Metadata:

Song Name: "Like a Rolling Stone - Bob Dylan"

Artist Name: "Bob Dylan"


Preferred Song Metadata:

Song Name: "Like a Rolling Stone"

Artist Name: "Bob Dylan"

MacBook Pro 13″, macOS 12.7

Posted on Jan 15, 2025 9:06 PM

Reply
11 replies
Sort By: 

Jan 25, 2025 11:35 AM in response to pixelchefs

Hi,


I've made two related scripts, one to remove the artist name from the name if it is there, and another to add it back so I could create tracks to test the process with. Here are some screenshots:




The scripts can be downloaded from this link which is a .zip file in my OneDrive. The scripts should be unpacked into ~/Library/Music/Scripts (you will need to make the last two folders yourself if they don't already exist) if you want access from the Music toolbar, or you can run the scripts from the Script Editor, which is less fun. Select some tracks then run the desired script from the menu bar. The Append script will only add the artist to the name if it isn't already there, and the Remove script only removes the artist when it is there. Any other name that happens to include " - " will be left as is.


tt2

Reply

Jan 16, 2025 9:50 PM in response to christopher rigby1

I have to do this for 5200 songs. I was hoping for some apple script way to do this. Doug's scripts are only find and replace strings not conditional to whatever the artist name to remove e.g. Dougs would only let me do one name at a time



[Edited by Moderator]

Reply

Jan 24, 2025 10:43 AM in response to pixelchefs

Hi pixelchefs.


I think I can manage a script to do that if you don't mind waiting a few days.


To be clear I would make it specifically replace " - <Artist>" in <Name> with nothing, i.e. "" throughout a selection of tracks, where <Artist> and <Name> refer to the values of those properties in each selected track.


tt2

Reply

Mar 7, 2025 7:12 AM in response to turingtest2

Hi, I would like to remove from selected track names everything until an underscore ("_"). For instance "Di Sarli52_Marianito" should become "Marianito". Could you please make one for this? I know how to do all this if I had a text file with track names etc as input but as far as I can tell all that is stored as binary in Music, and that is what I do not know how to deal with. Thank you for considering.

Reply

Mar 7, 2025 8:48 AM in response to sridharH

sridharH wrote:

Hi, I would like to remove from selected track names everything until an underscore ("_"). For instance "Di Sarli52_Marianito" should become "Marianito". Could you please make one for this? I know how to do all this if I had a text file with track names etc as input but as far as I can tell all that is stored as binary in Music, and that is what I do not know how to deal with. Thank you for considering.


Sure, I can do that for you. Give me a day or so.


tt2

Reply

Mar 7, 2025 9:43 AM in response to sridharH

turingtest2 wrote:

Sure, I can do that for you. Give me a day or so.

tt2


Actually I found time to do it now. Use this link to download TrimUnderscore.zip from my OneDrive. There are two files inside, Trim Underscore to LHS.scpt and Trim Underscore to RHS.scpt. You want the second one which:


Changes names of the form <LHS>_<RHS> to <RHS>. Neither <LHS> nor <RHS> can be empty strings.


The other is there in case someone else needs to keep the other half of the string, and both could be adapted for a different separator character/string fairly easily. Backup before you start. This action isn't reversible. Test with a couple of tracks first before doing a big batch.


tt2

Reply

Prune Artist Name from Track Name in Song Metadata

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.