Picard Scripting Help Requests

This thread is a catch-all for requests to help with tagging and file naming scripts for MusicBrainz Picard. For example scripts that have already been developed, please refer to the thread:

If you already have a start on your script and need help resolving an issue (something isn’t working as intended), please post a copy of the script along with an explanation of what it is doing (or not doing) that needs to be fixed.

If you haven’t yet started, please provide a thorough description of your needs with examples if possible. You should also have a look at the Writing a File Naming Script tutorial in the Picard User Guide for more information to help you get started.

4 Likes

Copying the post from the old thread and adding link to the release I’m trying to tag
I’m trying to tag this release but I get the annotation from this other one

And this is an example of one release working properly.


There seems to be a mistake in my approach for this, I’m trying to get the disambiguation comment, if any, and append it to the Album field of a release. But if it doesn’t find one in that specific release, it uses another release comment as fallback.

$set(album,$if(%_releasecomment%,%album% [$title(%_releasecomment%)],%album%))

I’m matching the CD version but I get the Digital disambiguation comment

If it does have a disambiguation comment, then it gets the correct one

I can’t seem to reproduce the error here. When I use this release:

I get no comment in the %_releasecomment% variable, but when I use the release:

I get “Mastered for iTunes” in the %_releasecomment% variable.

Your screen shots didn’t show it, but if you scroll down to the MusicBrainz Release Id setting, is it “64d7c880-e76b-4792-9fb5-a479903243fe” or is it “11961fc7-c4d6-4f7c-a808-222e593bc12b”? If it’s the latter then it looks like you’ve somehow selected the “Mastered for iTunes” release.

1 Like

That looks like a bug to me rather than a scripting error, but it is unclear whether it is a bug in MusicBrainz (i.e. incorrect data sent to Picard) or in Picard (incorrect interpretation of data sent).

1 Like

In fact there are other glitches in the screen shots - the one for the iTunes version also shows the catalog number and media type have changed (even though they have the same values).

So not sure what is going on.

1 Like

@Totosaurio3279, what version of Picard are you using and on what platform (linux, windows macos)? Also, what plugins (if any) do you have installed, and which ones are enabled? As @Sophist mentioned, something looks strange, and I’m wondering if it’s possibly something from a plugin. Thanks.

EDIT: Another thought… Were the files previously tagged using the digital version release id? If so, it may be reloading that release’s information automatically if you have the Ignore MBIDs when loading new files option unchecked.

1 Like

Version 2.6.3 on Win10

That was it! That fixed it, thanks!

1 Like

Excellent! Good to hear that you have it working, and glad that we could help.

I need help with figuring out how to make Picard not overwrite a specific tag (lyrics) if it’s not empty.

@gzippedfrog are you using a plugin to add new lyrics?

A default Picard doesn’t add Lyrics, so you probably just need to add the lyrics tag to the “preserve these tags” list.

1 Like

Thanks, that did the job. And yes, I used plugin to add extra lyrics.

2 Likes

I’m trying to understand how to add a comment tag to files, specifically FLAC files. I think I’m missing something.

If I add this to my renaming script:
$set(comment,%catalognumber%)

I don’t see the tag if I examine the file using mediainfo, nor in the details displayed in the lower section of Picard.

edit: Ah, I see that you need a plugin to write comments? I’ll look around, but does anyone know of one?

The renaming script is for naming files, not for setting metadata. Add you script to Options > Scripts instead and it will be applied automatically to data loaded from MusicBrainz or when you run it manually on files.

3 Likes

Ah, thanks!

Another thing I’m trying to do, is set a variable depending on what data is in the catalogue number field. I’m doing this via a tagger script, not in my renaming script.

$if(
	$eq_any(%catalognumber%,[none],[NONE],),
	$set(_cat_number,Blah),
	$set(_cat_number,[$upper(%catalognumber%)])
)

$set(comment,%_cat_number% %albumartist% — %album% \(%_release_issue_date%\))

I’m trying to match for [none] in both upper and lower case, and no data. Trying this on three releases, one with no data, one with [none], and one with a cat number. All result in _cat_number being set to Blah.

$if checks for empty. A line break and a tab are not empty. If you remove those 2 characters, you will no longer see Blah.

3 Likes

Good catch. I think I’ll actually add a note about that in the documentation because I suspect that it catches a lot of people.

EDIT: Pull Request entered.

4 Likes