I’m not very good with this sort of thing, but I’ve cobbled this together so far for my naming script, but still need help to get the desired result I’m looking for.
Right now, this outputs: DiscNumLeadingZero.TrackNumLeadingZero - Artist - Album - Title … and places them in a directory named Artist - Album (YYYY)
What I want to get is (forgive my pseudo-code): Directory per album:%artist% - %album% ([if exists]%Original Release YYYY% [if not]%Release YYYY%) Tracks:DiscNumLeadingZero.TrackNumLeadingZero - Artist - Album - Title Banned Characters: replace / with |
I just want to clean up the script, and get an if statement for the Original Release Year (YYYY) if it exists, and Release Year (YYYY) if not.
That’s actually not as easy as using $replace in the naming script. The slash / is a special character that is used as a folder separator in the naming script. To prevent that a slash in any variable is treated as a folder separator it gets replaced in all variables before the scripting is actually executed. That means if you have %artist% set to AC/DC it will be converted to AC_DC before being processed by the script. If that would not happen you would end up with a folder hierarchy of AC > DC. But that also means you can’t use $replace in the renaming script to change it.
If you want to replace / with any other character, e.g. |, you will need to do this before the renaming script is applied. If you set the following script in Options > Advanced > Scripting it will replace any slash in the %artist% variable accordingly:
$set(artist,$replace(%artist%,/,|))
That will of course have the downside that it will also replace the / character in the tags. To fix that don’t change the %artist% variable itself but create a new one, e.g. %_artist%:
$set(_artist,$replace(%artist%,/,|))
The leading underscore in the variable name makes this a hidden variable, that will not be written to the tags. But you can use it in your renaming script (just use %_artist% instead of %artist%). If you do this for every variable you use in the renaming script you will have the result you wanted.
For anybody coming to this now (and since it’s been linked, there’s probably a few), just know that the order of parameters for $replace has changed: it would be $replace(%artist%,/,|) instead.