I'm close, but not quite there...Renaming - Want to name folder with original year and date only if different

$if($ne(%albumartist%,),$left(%originaldate%,4) \($left(%date%,4))\) - %album% /$if($gt(%totaldiscs%,1),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) - ,)$if(%_multiartist%,%artist% - ,)%title%

So, I want this:

1967 (2018) - Sgt. Pepper’s Lonely Hearts Club Band (super deluxe edition)

I don’t want this:

1982 (1982) - Asia

The (1982) should not show up

I think I need something like:
$gt($left(%originaldate%,4) \($left(%date%,4))\))
But after many hours, I can’t seem to make it work.

Thank you for any help!

I think it would be easiest to check for equality of the two dates, and then set your date section output as:

$left(%originaldate%,4)$if($eq($left(%originaldate%,4),$left(%date%,4)),, \($left(%date%,4)\))
2 Likes

That worked. Thank you!
For anyone else that’s interested, the final naming looked like this:

$if($ne(%albumartist%,),$left(%originaldate%,4)$if($eq($left(%originaldate%,4),$left(%date%,4)),, \($left(%date%,4)\))) - %album% /$if($gt(%totaldiscs%,1),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) - ,)$if(%_multiartist%,%artist% - ,)%title%
3 Likes

i am about to embark on a filenaming script. out of interest does the picard language support more of a multiline approach with setting, testing and building variables with multiple branches / separate naming statements…or does everything have to be done ‘on one line’.

i will have a lot of conditions, like original year present, discnumber present, disc subtitle present, various artist album artist…manual path tag present…ive shyed away from doing this in picard as it looked daunting with that many nested if statements. now youve done it, do you have any thoughts.

I’m afraid that is a bit beyond my expertise, but I have saved these pages which might also be of interest to you:


and
2 Likes

What I do to format my file naming script are the following two steps:

  1. Save the filename or the full path to a temporary variable with $set(_path,abc) where abc is my filenaming script that includes newlines and tabs to format and indent nested functions/brackets.
  2. Remove these formatting characters (which are invalid for file paths and would cause trouble for Picard IIRC) and output the constructed path with $rreplace(%_path%,[\\t\\n]+,).

Edit: These posts should probably be split into a new topic.

2 Likes

thanks this will get me started.