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 09:06 PM

Reply

Similar questions

11 replies

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

Mar 7, 2025 07: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.

Mar 7, 2025 08: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

Mar 7, 2025 09: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

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

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.