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%))
)
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.
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:
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:
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.
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):
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.
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).
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:
It might be a bit hard to read with the many commas $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: