Scripting using $unset or $delete

Using Picard 2.7.3. Running against this album https://musicbrainz.org/release/8e1d722d-d4cf-4100-9d44-2a81e13da083?tport=8000

Created the following snippet to split long album names into album/subtitle, and to use a different field name for Vorbis tags.

$set(mediasubtitle,%discsubtitle%)

$if($find(%album%,:),

$set(_myalbumsubtitle,$trim($right(%album%,$sub(-$find(%album%,:),1))))

$set(album,$trim($left(%album%,$find(%album%,:))))

)

$if($eq($lower(%_extension%),mp3),

$set(discsubtitle,%_myalbumsubtitle%)

,

$set(setsubtitle,%_myalbumsubtitle%)$unset(discsubtitle)

)

If I remove the $unset statement, it works fine. The only problem is that two fields are created in Vorbis tags, and they are redundant.

However with the $unset statement (or $delete) in place, the very first $set statement is random; the %mediasubtitle% variable is set for some tracks, and not for others. It’s almost like the statements aren’t running sequentially.

Am I missing something obvious, I hope?

Ok, that was a completely different bug, not really because of the script logic. For some reason, Picard was running the scripts as I scrolled through the matched list of tracks, as if I was manually running the script. Just after I realized this, the program crashed. On restart I can’t reproduce it.

I don’t really know what you want to achieve. Okay, you like to write %discsubtitle% to a custom tag and subtitle of your release to discsubtitle - this tag contains the title of each medium which is usually useful … and you do that only for mp3 files (why?) … for other discs you like to write it to “setsubtitle” - or is this a typo?
Is this for special media software? I would not recommend this for Kodi. Could you please try again to explain?

Btw, are you sure all your releases have a meaningful title preceding the colon. For live bootlegs with a generic title (“date: location”), the title would be shortened to a date!

Hi, thanks for the reply. The point of the script was to break album names that have a “:” into albumtitle : albumsubtitle, in order to shorten the file/directory names in my naming scripts.

I put the album subtitle into Picards %discsubtitle% field. (It’s usually blank, but Picard does store medium names if they are available.) Picard maps this field to id3:TSST and Vorbis:discsubtitle.

I’m using MusicBee to organize my files now, and it had a field called SetSubTitle, which it maps to id3:TSST and to Vorbis:setsubtitle. That’s why I use %discsubtitle% for MP3s, but I use a custom field for FLACs.

As it turned out, the script logic wasn’t the problem anyway. But thanks for looking at it.

1 Like