Preserve only a specified tag if MB value is blank

I’m sure this has been answered before but I’m unsure how to word my search…

I like using Clear Existing Tags to weed out a lot of erroneous junk.

I want to preserve, let’s say COMPOSER, if MusicBrainz has no value for that tag.

I want COMPOSER to be overwritten if MusicBainz does have a value.

What combination of Tags Options and function can I use here?

2 Likes

The behaviour you desire is NOT to Clear Existing Tags. If MB has no data for a certain tag, Picard will keep it, and if there is, it will overwrite it’s content. But it’s not possible to decide automatically what’s erroneous junk and what should be preserved.

BTW, if information is not available on MB, you should add it :slight_smile:

2 Likes

Just an idea, but try this script (set it in Options > Scripting):

$if(%composer%,$set(composer,%composer%))

The idea is that since the tags in the files are made available in scripting %composer% will have a value if it is in the file tags or has a value provided by MB. By using $set explicitly you make this value part of the new metadata Picard will write. Hence existing value from the file will be written again, but MB data will overwrite it.

I haven’t tried it myself, but let me know if it works. Instead of $set you might want to use $setmulti if you want to preserve multi value tags.

1 Like