How to convert multiple genre tag fields into one

Hi. My current player only recognises multiple genres in a file, if they are in a single tag-field (not sure if I'm using correct terminology here!) and separated by ";". Fortunately most of my music library is tagged this way; but some albums, and I don't know where they all are, contain files having multiple genres as separate tag-fields (which my previous player supported), which Mp3tag indicates in the format (e.g.) "Genre1\\Genre2\\Genre3". How can I find all of these files and convert them to a single tag-field, e.g. "Genre1;Genre2;Genre3"?

I tried filtering a selection of files known to contain multiple genre tag-fields, on "%genre% HAS \\", but I don't have enough working knowledge of Mp3tag to know why this didn't work. Thanks for any suggestions.

Here's one way:

  1. Use an action to add a custom field to mark files that have multiple genre fields.
    action to mark files with multiple genres

  2. Filter for files with the custom field.
    filter to find marked files

  3. Use an action to merge the multiple genre fields in the resulting files.
    action to merge all genre fields

  4. Use an action to remove the custom field.
    action to remove mark from files

1 Like

A filter could look like this:
"$if($eql($meta(genre,1),%DUMMY%),0,1)" IS 1
(you would not need to create that extra column then. The rest for merging the fields has been explained by @ryerman

2 Likes

Nice :+1:
I forgot to use double quotes in my initial attempts at a filter expression.
This also seems to work:
"$meta(genre,1)" PRESENT
and also makes creating a temporary field unnecessary.

1 Like

Do I understand this filter correctly:
The ,1 means "at least 2 two genres"? So ,2 would mean "at least 3 genres"?
(Null based index, ,0 would mean "at least 1 genre")?

That is the effect, if not the meaning. :slightly_smiling_face:
From the documentation:
"$meta(x,n) returns the nth value of field x (where n starts at 0, e.g. $meta(artist,1))."

https://help.mp3tag.de/main_scripting.html#metadata

2 Likes

Wow... thank you!

Given that my library contains >13000 tracks across >1200 albums, with each album in its own folder within (generally) an artist (or, for classical, recording label) folder, are there any recommendations on how such a ("global") filter-and-merge should be run? 13000 sounds like a huge amount of tracks to process at once.

I’d run a couple of small batches first and confirm, but there is no reason that mp3tag couldn’t do all 13k for you in one shot.

I would load all the files
then apply the filter
and do the merge only for those filtered files.
If you fear that memory may become a problem, switch on the library function in Tools>Options>Library.

Excellent! I completed the whole process within 15 mins. 193 tracks were identified and "corrected". I'm still amazed that it only required two discrete actions: filter, merge.

Memory was one of my initial concerns, but, even with browser windows up at the same time, memory (8GB fitted) usage never exceeded 46%.

Many thanks, all.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.