Help with a renaming script as I'm clueless

I’m a foobar user so have normally used it for tagging my files but I’ve recently started using Picard for that. I have a renaming script that I use in foobar but it won’t work in Picard, was hoping someone could convert it.

[%album artist%]\%year% - [%album%]\$ifgreater(%totaldiscs%,1,Disc %discnumber%\%discnumber%.[%tracknumber%]. [%title%],[%tracknumber%]. [%title%])

If I try to use it I get the error:

1:9: Unexpected character ’ ’

I’ve tried deleting things, changing things but if I’m honest I haven’t a clue what I’m doing.Here is a screenshot from foobar showing it does:

z8nxh7Z.png (1192×797) (imgur.com)

While the syntax is similar, Picard is not foobar2000 and there are differences in available functions, variable / tag names and even syntax (variable names with spaces are not allowed in Picard).

Try this (untested):

[%albumartist%]$year(%date%) - [%album%]$if($gt(%totaldiscs%,1),Disc %discnumber%.[%tracknumber%]. [%title%],[%tracknumber%]. [%title%])

Some notes: You had duplicated disc number in the script, I removed one. But if that was intentional just add it again. Not sure about the square brackets. Do they have a special meaning in fb2k? In the Picard script they will just be literal square bracket characters as part of the filename.

See also the Picard documentation for details about the scripting:

2 Likes

Thanks for this, unfortunately it’s not working but that’s my fault for not explaining what the foobar script achieves. When used in foobar the result is as follows:

1 Disc:

Multidisc:

As for square brackets, they instruct foobar2000 to only display the text therein if all referenced metadata fields are present.

I hope this makes sense :smile: and I really appreciate the help.

1 Like

A post was merged into an existing topic: Help with naming scripts

So probably this:

$if2(%albumartist%,%artist%)/
$if(%date%,$year(%date%) - )%album%/
$if($gt(%totaldiscs%,1),Disc %discnumber%/%discnumber%.)$num(%tracknumber%,2). %title%

You can use a slash or backslash to mark a directory to be created (note that you have to use double backslash \\ in tagger script as a backslash alone is used for escaping control characters, so a slash is easier to use).

The square brackets are not needed in your example, as they only ever surround a single variable. But if I understood correctly you would instead use an $if in Picard to check if the variables exist. I did this with the $if(%date%,...) to only print the date and the following " - " if the date is actually set.

As an additional extra I added a fallback to artist for the folder name if albumartist is not set (which might happen if you use Picard to save local files without tagging them with full MB metadata).

This is how it looks like in Picard:

5 Likes

This is perfect, you’re an absolute star :smiley: :smiley:

3 Likes