Tag to filename format string for original date and release date

hi there,

i’ve made a tag to filename format string to put music in my collection

x:\Music\Collection\%tvepisodeid%\$if($eql(%tvepisodeid%,Box Sets),,%albumartist%)\[%tvnetwork%]\[%tvseason%]\$if($eql(%origyear%,),%year% - ,%origyear% - )%album%$if($eql(%origyear%,),,$if($eql(%year%,%origyear%),, (%year%)))\[CD$num(%discnumber%,2)][ - %Disc Title%]\$num(%track%,2) - %title% - %artist%

(its all music im just using the tv tags to map the tag panel to mediamonkeys custom tags)

seems to be working correctly in testing, the bit im looking for advise on is

\$if($eql(%origyear%,),%year% - ,%origyear% - )%album%$if($eql(%origyear%,),,$if($eql(%year%,%origyear%),, (%year%)))\

Im using both dates to keep the same album separate so..

Collection\Studio Albums\The Beatles\1964 - A Hard Day’s Night (2009)\

Collection\Studio Albums\The Beatles\1964 - A Hard Day’s Night\

So before the album name the logic is if the tag original year is blank put the year in front, otherwise put original year tag

Then after album name if original year is blank put nothing and if original year and year are the same put nothing, this stops it being 1964 - A Hard Day’s Night (1964) otherwise put year

My question - is there a better function to use? It works but just seems really clumsy, and i dont know what i dont know, ive had a look through the manual and cant find a better function to use than nested ifs.

thanks for your time :smile:

You could use
[$if2((%origyear%,%year%) - ]
The more complicated condition behind the album ...
could also be expressed like this:
$replace([ ($replace(%origyear%,%year%,))],'()',)

deleted this, it was correct as above

thanks very much, it looks much neater now

The logic of the second part is a cludge ...
If i replace look in ORIGYEAR for YEAR and replace it with nothing, then just the two parenthesis () will be left over. And they get replaced with the second replace.