Extract Nth value from multi-value variable

picard
taggerscript
Tags: #<Tag:0x00007fcb4d43f588> #<Tag:0x00007fcb4d43f448>

#1

Amateur here… read the scripting wiki to death and tried all sorts of experiments to get what i want

Lets suppose i have a multi-value variable with values separated by a semi-colon (:wink:

How would i pull out the nth value to use and overwrite another or the same variable?

Example (keeping it simple where the 1st value is desired):

Current:
Artist: 50 Cent; Eminem; Snoop Dogg
Desired:
Artist: 50 Cent

Ideas?

Thanks


#2

You might be able to do something in the scripting, but even if you could I think the code would be horrendous. I wouldn’t consider doing it this way.

If it was a specific tag (and always the same one) that you wanted to separate, you could create a plugin to return the elements as separate tags to access within your script. This is sort of what I’ve done in the AlbumArtist Extension plugin. In that case, I extracted the first entry from the AlbumArtist tag and made it available as the “Primary” album artist, which is something I wanted for path naming in my file renaming script.