Troubleshooting With scripting and variables

Hail to all,
I’ve set up my Picard configuration as follows:

Script tagger:

$set(_nomeartista,$if2(%albumartistsort%,%artistsort%,%artist%))
$set(_nomeartista,$replace(%_nomeartista%,…,…))
$set(_anno,$left($if2(%originalyear%,%originaldate%,%date%),4))
$set(discnumber,$if($gt(%totaldiscs%,1),$num(%discnumber%,2)))
$set(title,$replace(%title%,…,…))
$set(album,$replace(%album%,…,…))
$set(discsubtitle,$replace(%discsubtitle%,…,…))

Renaming:

%_nomeartista%/
%_anno% - %album%/
$if($gt(%totaldiscs%,1),$if(%discsubtitle%,CD #%discnumber%։ %discsubtitle%, CD #%discnumber%))/
$num(%tracknumber%,2). %title%

The problem is if a release is not present in the MusicBrainz database, file naming not work as expected: e.g., i obtain the directory of the album to be putted on Music’s top level directory, without Artist/ parent directory, and named “,- album” rather than “date - album”.

If i put all code lines into renaming section (variables first of all), thus picard rename correctly. So, i’ve not understood which is the settings to put into “scripting” section of picard preferences.

Sorry for my english, and thanks in advance.

If it works with everything in the renaming section, then leave it that way. There’s no requirement to have anything in the scripting section.

1 Like

Thank you very much, at this point i’ve only one remaining question: which is the utility of the “Scripting” section?

Because you can easily turn scripts on and off in the scripting section, I use it for setting some processing variables to determine which branch to follow in my renaming script. For example, I have a different naming structure for classical music than for contemporary music. I can easily select between them by setting a variable in the scripting and then check the variable in the renaming script.

1 Like

The scripts in the scripting settings get applied to metadata loaded from MusicBrainz. The main use is to actually manipulate the data for the tags themselves, so you can shape the data MusicBrainz provides to how you want it.

Since the scripts are applied to the data from MB they won’t be applied if you just save your local files.

2 Likes

Excellent clarification. Thanks.