Write multiple tags of the same name to a single track

Something I'd like to see improved is the ability to write to multiple tags of the same name to a single track via the script. Currently, one writes to a single tag with a unique string of characters between each value (e.g. val1#!#val2) which can later then be replaced with \\ using an Mp3tag action to split into multiple. Preferably this wouldn't be a two-step process, but be possible via the script somehow.

A simplified example:

json_foreach "tags"
    json_select "name"
    set "tmp"
    outputto "tmp"
    sayrest
    outputto "tmp_genre"
    ifoutput "tmp_genre"
        say "#!#"
    endif
    sayoutput "tmp"
json_foreach_end
outputto "genre"
sayoutput "tmp_genre"

We use | to write to the same tag across different tracks, but there is no way to write to multiple tags of the same name for the currently processed track as far as I know.

Can you try this preliminary version

https://download.mp3tag.de/support/BEC24A86-ECE4-4F65-BC75-A439E84B7B86-3-11-6-3/mp3tagv311f3setup.exe

with say "\\\\" to produce multiple fields.

1 Like

Appears to work as intended; Multiple tags are split correctly on a per-track basis, thanks!

I've noticed that in one of your bundled scripts you use replace "|" "$verticalBar()". I'm assuming it's a good idea to write some equivalent, such as replace "\\" "$doubleBackslash()" at the top. Or should it be "\\\\"?

The questions I have are:

  • Is $verticalBar() something that Mp3tag handles internally? If so...
  • What is the correct $variable for this backslash sequence of characters? It's rare but possible that a value may contain the number of backslashes needed to cause a split.

I don't want to add this preemptively — if this is going to become a problem I can do something about it.