How to use $delprefix for multiple artists?

Hello,

I currently use the following custom tagging script…

$setmulti(artistssort,$delprefix(%artists%,The))

This works fine for most occasions, but it clearly doesn’t loop through each artist - so a release by The Six Parts Seven & The Black Keys will be tagged as…

Six Parts Seven; The Black Keys

I am not hugely familiar with the scripting language but it looks like i maybe need to use $foreach in my script - i’m just not sure how to use this function in combination with the above script so that I end up removing ‘The’ prefix from all artists to give the following result…

Six Parts Seven; Black Keys

Could anyone give me a gentle nudge?!
Cheers!

This is how I’d do it:
$setmulti(artistssort,$map(%artistssort%,$delprefix(%_loop_value%,The)))

Just in case you don’t know, there is a plural artistsort variable available (%_artists_sort%).

1 Like

Thanks very much, but sadly that doesn’t work as artistssort is a custom tag so there is nothing to map so it produces no tag at all.

I then tried changing the script to use the variable _artists_sort that you suggested as per below…

$setmulti(artistssort,$map(%_artists_sort%,$delprefix(%_loop_value%,The)))

But this tag has already moved the ‘The’ to the end so it’s no longer a prefix but a suffix!!

I might have to rethink my tagging structure!

Cheers ,

James

Sorry that was the code I used for testing (couldn’t find an album with multiple artists beginning with “The”), just use %artists%
$setmulti(artistssort,$map(%artists%,$delprefix(%_loop_value%,The)))

EDIT: I know LMS supports artistssort but I don’t think many systems do.

Yes tried that too but that actually strips the “The” from the Artists tag too, not just the artistsort tag

Does it! I’ll try it out, in the meantime:

$setmulti(artistssort,%artists%)
$setmulti(artistssort,$map(%artistssort%,$delprefix(%_loop_value%,The)))

EDIT: I’ve just tested the code and it doesn’t strip it from %artists%

$setmulti(artistssort,$map(%artists%,$delprefix(%_loop_value%,The)))

Hmmm. It does if I set it manually:

$setmulti(artists,The Band; The Beatles)
$setmulti(artistssort,$map(%artists%,$delprefix(%_loop_value%,The)))

weirdly it does for me - ive turned off all other scripts and running that code tries to adjust both the Artists tag and the artistssort tag. maybe i need to walk away for a bit!

cheers for the help

It looks like the behaviour is slightly different on Picard v2 so probably best to use:

$setmulti(artistssort,%artists%)
$setmulti(artistssort,$map(%artistssort%,$delprefix(%_loop_value%,The)))
1 Like

ooh wait this might be it!

sorry didn’t think to mention what version i was on - are you using picard version 3?

Yes I’ve moved to v3. I have a pretty simple workflow (only a couple of plug-ins) and it’s been working well for me.

I’ve not tried it yet, so i need to read up on the changes as think it’s due for release soon!

Cheers for your help - that last script is working great thanks