Store multiple album interpreters in a meaningful way

You are right, it is logical. I thought it could be implemented that %albumartist% either:

  • The first one is the one found if %artists% exists.
  • If it does not exist we use already set %albumartist%.

I had tried it like this:

$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
	$noop( Do nothing on a match. ),
	$noop( No match.  Do renaming. )
		$set(albumartist,$if2($getmulti(%artists%,0),%albumartist%))
		$set(albumartistsort,$swapprefix($if2($getmulti(%artists%,0),%albumartist%)))
)

which unfortunately does not lead to the desired behavior :frowning:

Perhaps the solution is a bit simpler. Does the following tagger script do what you want?

$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
    $noop( Do nothing on a match. ),
    $noop( No match.  Do renaming. )
        $set(albumartist,$getmulti(%_albumartists%,0))
        $set(albumartistsort,$swapprefix(%albumartist%))
)
1 Like

It looks good like this! Thank you for your patience!

If there are to be multiple albumartis gib:

  • The artist directory should be found equal to the first one
  • In the files also only the first one found should be used

My script for the files:

%albumartist%/
%album%/
%artist% - %title%

I have enabled renaming files on save. So I still need to enable the “Move”. This must be in new path, right?

I have to adjust the %artist% - … in the filescript accordingly. That would be the same code as in the tag script, right?

No problem. I should have noticed that sooner.

Right.

I’m not sure I understand what you want there. Do you want all of the track titles to have the same artist name (the first album artist) or do you want them to have the actual artist name for the track? If the former, simply change %artist% in the file naming script to %albumartist%. If the latter, you don’t need to change anything.

I wanted it that way:

If there are several %albumartists% the first one should be used as %albumartist% and also for the filename. But the tag for the artist should be kept.

But for “Various Artists” the actual artist should be used as filename and not Various Artists.

I hope I could explain it understandable.

I just gave it a try:

%albumartist%/
%album%/
$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
		%artist% - %title%,
			%albumartist% - %title%
)

Have now tried only two but could work

I have a problem with the two tag and file scripts:

$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
    $noop( Do nothing on a match. ),
    $noop( No match.  Do renaming. )
        $set(albumartist,$getmulti(%_albumartists%,0))
        $set(albumartistsort,$swapprefix(%albumartist%))
)
%albumartist%/
%album%/
$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
		%artist% - %title%,
			%albumartist% - %title%
)

In the process, AC-DC would be renamed AC_DC. I do not see why.

there is one more point that happens when I enable “move files on save”.

From my folders:

  • Who
  • Beatles
  • Fantastischen Vier

then becomes:

  • The Who
  • The Beatles
  • Die Fantastischen Vier

I named them in the file system because it simplifies the search in the FS.

I have searched here in the forum. My first problem: AC/DC → AC_DC can possibly be solved with %_dirname%.

I guess this does not go into the tag script but into the one for file naming?

With $rreplace() you can exchange characters. Shouldn’t this work with that?

I also read a post that you can’t intervene on the characters “/” and "" at all.

You could wrap the %albumartist% tag that creates the folder with $swapprefix, e.g. $swapprefix(%albumartist%,A,An,The,Die).

Not in file naming scripts, because those are directory separators and if they would end up in the file naming script they would create folders. You don’t want that for AC/DC.

But you can define the replacement character used for directory separators (/ and \) in Options > Compatibility > “Replace directory separators with” (available since Picard 2.9). See File Naming Compatibility Options.

1 Like

ok, I have not seen this small field :frowning: That works quite simply :slight_smile:

So this goes into the file naming script? I tried it this way:

$swapprefix(%albumartist%,A,An,The,Die)/
%album%/
$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
		%artist% - %title%,
			%albumartist% - %title%
)

But do not remove the preceding “The” from the directory:

No, it moves the prefixes to the end. But if you want to have them completely removed you can use the $delprefix function instead. It otherwise works the same, with the same parameters:

$delprefix(%albumartist%,A,An,The,Die)/
%album%/
$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
		%artist% - %title%,
			%albumartist% - %title%
)
1 Like

It looks good like this. Thank you very much!

I will load different folders in Picard and hope that everything fits now.

1 Like

I’m assuming that you mean in the file naming. My guess is that the hyphen in AC-DC is actually a different unicode character (like en-dash) and it is being replaced with an underscore for compatibility reasons (depending on your configuration settings in this regard). To make sure that they are converted to ASCII hyphens, you could start your file naming script with something like:

$setmulti(_alt_hyphens,\u002D; \u058A; \u05BE; \u1806; \u2010; \u2011; \u2012; \u2013; \u2014; \u2015; \uFE58; \uFE63; \uFF0D)
$foreach(%_alt_hyphens%,
  $set(artist,$replace(%artist%,%_loop_value%,-))
  $set(artistsort,$replace(%artistsort%,%_loop_value%,-))
  $set(albumartist,$replace(%albumartist%,%_loop_value%,-))
  $set(albumartistsort,$replace(%albumartistsort%,%_loop_value%,-))
  $set(title,$replace(%title%,%_loop_value%,-))
)

Note that you could probably avoid the loop by using $rreplace() and building the pattern string to include the different alternate hyphen codes, but I thought this would be easier to follow.

These are my settings:

So I have not activated any conversion to ASCI.

Is it advisable to insert this anyway? This goes in the part “file naming” ?

With the current state with the $delprefix(%albumartist%,A,An,The,Die) at the beginning I found a case that is strange. After the directory of the artist “B.V.S.M.P” a _ is inserted:

That’s the trailing dot. Windows does not allow file or folder names to end with a dot, and Picard replaces this with an underscore. This is currently not directly customizable. One way to handle this in the script would be to just remove all trailing dots from this folder name. Replacing the first line of your script with this should do the trick (untested):

$rreplace($delprefix(%albumartist%,A,An,The,Die),\\.+\$,)/

The \\.+$ is a regular expression. “$” indicates the end of the string. \. is a single dot (needs escaping, as a dot is a special character in regular expressions), and the + indicates one or many of the character before.

So “R.E.M.” will become “R.E.M” without the last dot.

1 Like

I have inserted it like this

$rreplace($delprefix(%albumartist%,A,An,The,Die),\\.+$,)/
%album%/
$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),
		%artist% - %title%,
			%albumartist% - %title%
)

This leads to the message: "1:56: Unexpected character ‘,’.

Sorry, there was a missing backslash before the $ sign here. It needs to be \\.+\$ (because the dollar sign is special in Picard and indicates start of a function name).

I updated the script in my post above.

1 Like

Thank you, this correctly names “B.V.S.M.P”.

Does the file naming script use the variables, modified as they come from the tag script? The connection is not really clear to me yet.

Is there an easy way to remove the commas from the folder name (Albumartists)?

Essentially yes. Or rather the file naming script uses the variables and tags exactly as they are for a file when you hit “save”. So usually these get set by scripts and plugins, or in case of the editable tags by manual change.

Do you generally want to remove all commas from the folder name? Shall they stay in the file name?

For just removing all commas from the folder name use another $replace call:

$replace($rreplace($delprefix(%albumartist%,A,An,The,Die),\\.+\$,),\,,)/

It might be a bit hard to read with the many commas :slight_smile: $replace takes 3 parameters, the text to search in, the text that should be replaced and the text that it should be replaced with. So $replace(ABC,B,X) will replace the B with X in the input “ABC”, so it gives you “AXB”.

Now in our case we want to replace the comma with nothing, e.g. if %albumartist% is “A, B” then return “A B”. The comma is special and separates parameter, so we have to escape it:

$replace(%albumartist%,\,,)
2 Likes