Folder naming from first entry in [artists] multitag?

So I’ve noticed that the default file naming script in Picard is this:

$if2(%albumartist%,%artist%)/$if($ne(%albumartist%,),%album%/)$if($gt(%totaldiscs%,1),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%

Which works great in most instances for albums. However if I add non-album tracks that also have “feat” artist credits, they get their own folder, like this:

\PrinceWhateverer\album\track.mp3
\PrinceWhateverer feat. CG Scrambles & ShadyVox\track.mp3
\PrinceWhateverer feat. Dreamchan\track.mp3
\PrinceWhateverer, Poni1Kenobi & Turquoise Splash\track.mp3

Is there any simple way to adjust the naming script so it pulls the first artist name from the delimited [artists] multitag if [albumartist] is missing? For reference, the tag looks like this for the last track above:

Artists: PrinceWhateverer / Poni1Kenobi / Turquoise Splash


On a related note, does anyone know what ever happened to this bug report / pull request to have a [primaryartist] variable? That would be perfect for what I need.

https://tickets.musicbrainz.org/browse/PICARD-643

I just solved this today!

The easiest two solutions would be to use either the Feat. Artists in Titles or Feat. Artists Removed plugins found here.

I however prefer them in the artist tag. What I have done is use this string:

$left($rreplace($if2(%albumartistsort%,%albumartist%,%artistsort%,%artist%),; [^\)]+,), 60)

The if2 will use the album artist (if it exists) before using artist. Typically the album artist will not include the featured artist.

If you are having trouble fitting that string into your script here is mine:

$replace($rreplace(
$if($eq(%albumartist%,Various Artists),
        [Various Artists],
	$left($if2(%albumartistsort%,%albumartist%,%artistsort%,%artist%),1)
/
$left($rreplace($if2(%albumartistsort%,%albumartist%,%artistsort%,%artist%),; [^\)]+,), 60))
/
$if(%date%,[$left(%date%,4)] )$left($replace(%album%,/,), 70)
/
$if($gt(%totaldiscs%,1),$if(%discnumber%, \(Disc %discnumber%\),),)
/
$num(%tracknumber%,2). $left(%title%,120),[:?"_]+,),  , )

This script will give you an output of:
\B\Beatles, The\[1965] Help!\07. Ticket to Ride.mp3 \[Various Artists]\[2005] Coup d'État, Volume 1 Ku De Ta Prologue\(Disc 2)\05. I've Got to Learn the Mambo.mp3

Hope this helps!

2 Likes

I have the same problem, wihich can not be solved by paulcoms solution.

The %artists field contains two entries and the %artist, %albumartist, %albumartistsort and %artistsort all contain the artist with the addition of “read by …”, but I would like to name the folder to the first entry of %artists.

How do I get the first entry, seperated by ; from the %artists field?

Edit: I see no possibility to either get the length of %artists until ; symbol and cut it to that length nor to return the entries until the ; symbol.

Have a look at the Additional Artists Variables plugin on the Picard plugins page. I think this will provide the information to meet your needs. There is also a User Guide to help explain how the plugin works and can be used.

2 Likes

Yes, thank you. The Additional Artists Variables plugin did the job. I needed the %_artists_album_primary_std% value.
Thanks a lot!

2 Likes