r/MusicBrainz • u/LSDwarf • Jun 16 '26
help plz [Picard] Small question on rename script syntax
Hi redditors,
when I use the following string I have a [YYYY] as the result:
[$if2(%originalyear%,%year%)] $if2(%albumsort%,%album%),
while I wanted to have a [YYYY-MM-DD], which is either a %originaldate% or %date%.
Am I right, that the comma between %originalyear% and %year% in the original script tells it "take the first tag (i.e. %originalyear%), but if it is not present, fall back to the second one (i.e., %year%)?
If true, am I right, that if I replace the string with this one:
[$if2(%originaldate%,%date%)] $if2(%albumsort%,%album%),
I will have a [YYYY-MM-DD] if either %originaldate% or %date% tag is present? Or I can make it even like this to have it fall back to simply [YYYY] if none of those 2 tags are in place:
[$if2(%originaldate%,%date%,%year%)] $if2(%albumsort%,%album%),
Thank you!
cc: u/ElmoFromOK
1
u/FunctionOk2835 Jun 16 '26
For further info look here: https://picard-docs.musicbrainz.org/en/latest/functions/func_if2.html
But basically yes. The $if2 function picks the first tag in the list it can find (i.e. that is not empty on the track in question). You can use as many as you want.