Handling Composer in tagger scripts

Tags: #<Tag:0x00007f6d4d52fd70> #<Tag:0x00007f6d4d52fc80> #<Tag:0x00007f6d4d52fb90>

Hi there. I’ve been using a Picard tagger script for ages and I’ve recently spotted a bug that I’m not sure how to solve.

I like to display the Composer field in my music player. When some recordings have a Writer but not a Composer, I want to copy Writer to Composer. But only if there is no Composer. So I’ve been using this script:

$if($not(%composer%),$if(%writer%,$copy(composer,writer)))

My problem is that if I have an MP3 file that already has some bogus tags in it (for example Composer = “banana”) and MB has no Composer, but Writer = “John Smith” then my tagger script won’t overwrite “banana” with “John Smith”.

I work around this by ticking “Clear existing tags” to get rid of bogus tags. But now if I load the MP3 into Picard the 1st time, it clears the Composer tag. If I save, quit and reload the MP3 into Picard a 2nd time, it now fills in the Composer tag from Writer. But if I load it a 3rd time, it removes the tags again!

I could simplify my script my dropping the $if() conditional, but I don’t want to unconditionally copy Writer to Composer if there is already valid data in Composer.

Is there a way to tell in tagger scripts whether a tag value has come from the MB API or whether it was read from the MP3? Thanks

I am pretty sure what you want to do is not possible. A possible workaround would involve moving all of your COMPOSER tags into a temporary field, so that your composer values no longer share the same field as the server’s composer values.

I haven’t fully understood:

I suppose, you disabled “Clear existing tags” again, after you removed the bogus tags, didn’t you?
But then the tags should not be removed…
You like to run this script as a standard feature, every time you load new files?
I recommend the “copymerge” function. It keeps the existing, adds what is missing without creating duplicate values.