Adding to the genre tag

Hi - I’m new to this so please don’t assume anything is too obvious to check!

I’m trying add to the genre tag but am not having any success. My goal is to inspect an element in the metadata, and use that to conditionally alter the genre tag. As an example; if I had an existing genre of ‘Rock’, I would want to run the below script to get a results that reads ‘Rock; Soundtrack’.

$if($and($in(%releasetype%, soundtrack), $not($in(%genre%, Soundtrack))),$set(genre, %genre%; Soundtrack))

Whenever I run this script I end up with the result in genre being:

; Soundtrack

With any previously entered values being erased.

A similar script I’ve used which does work is:

$if($and($in(%releasetype%, soundtrack), $not($in(%album%, [Soundtrack]))),$set(album, %album% [Soundtrack]))

The above will transform ‘The Piano’ to ‘The Piano [Soundtrack]’.

I’ve tried to do some troubleshooting and identified the following:

  • If I set genre as a protected tag I get the desired result when I run the script manually
  • $set(genre, %genre%) always returns nothing
  • $set(test, %genre%) creates an empty tag

Some files are wma, with these files I seem to encounter another issue. If I $set(test, randomdata) no new tag field is created, but with other file types it is. Is this related?

  • $copy/copymerge(test, %genre%) does not create a tag called ‘test’ regardless of file type

What am I not understanding here? Thanks!

See here for an answer:

1 Like

Unfortunately that script only returns the value ‘Loveparade’ and still blanks all existing values in the genre tag.

If I try to test the $setmulti(genre, %genre%) I get a blank output.

Ok, I think I understand know what the case is here: As I understand you want to add a genres to the genres already in the file, while the above solution is about adding a genre to the genres loaded by Picard (either from MB.org or via a plugin).

If this is right I fear it is currently not possible fully automated because the scripting does not have access to the file data, only to the data loaded from MusicBrainz.

This is currrently a known limitation, and fixing this has turned out to be extremely tricky. Actually I would like to see this fixed myself, because I have a couple of existing tags I would like to change via scripting.

Maybe I overlook something and somebody else has another idea how to solve this?

No, this is unrelated, and this is actually expected behavior. Picard currently does not support writing custom tags to WMA or MP4. Only know tags with defined mapping will be written. Hence it doesn’t show the tag in the list for WMA and MP4 files.

2 Likes

My Classical Extras plugin will add genres from tags to those already in the file. It doesn’t need to be a classical release and will run at normal speed (almost) if there are no works to look up.

1 Like