[Solved] How to set the NULL (aka double backslash) separator within Multi-Value Tags...?

UPDATE, see below for solutions…

So, I’ve tried this, and it’s not working?

$set(artist,$rreplace(%artist%,\, ,\\))

I’m trying to replace commas with the null backslashes but it doesn’t work.
I’m able to change “text” such as &, feat, etc. but can’t remove replace the comma?
Also I can replace the comma with other things such as a semi-colon, etc. but I can’t do the double backslash.

I need to have this in order for compatibility with MusicBee because they won’t let us use the Semi-Colon or otherwise, they replace ANY separators with the NULL backslashes.

I know I can “manually” edit the tags creating the NULL with the “Edit” function, putting the things on a separate line, etc., but I need this automated.

HELP… It makes me upset MusicBee FORCES us to use NULL, even with ID3 2.3 which null isn’t supported with. I’m trying to switch over to 2.4 because of them, but then with Picard I’m having this issue and possibly others. :frowning:

Thanks

I moved your message into a new topic as this is really getting into a completely different direction than the original question.

There are multiple things wrong with your approach. First, the script does not replace commas with a a double backslash, but with a single backslash. In Picard’s scripting the backslash is a special character used to escape other special characters. E.g. the dollar sign has special meaning, to write a literal dollar sign you use \$ in scripting. Likewise if you want to write a single backslash you need to escape this and write \\. Your script hence replaces , with a single backslash. Two backslashes would be \\\\.

Second, even if that replacement happens it wouldn’t do what you want to have. It would just add backslashes to the tags. But I have tried to explain to you before that when MP3Tag displays these double backslashes it does not mean there are actually double backslashes in the file. It’s MP3Tag’s way to show the separate values of a multi-value tag. There is no such thing as a NULL backslash.

So the proper solution is to convert your comma separated artist list into a proper multi value field. You can use $setmulti for this:

$setmulti(artist,%artist%,\, )

This sets artist as a multi value tag, but instead of the usual "; " as the separator it uses a comma followed by a space. Maybe even better would be to convert the commas to semicolons first, then this would also work with artist values that are multi-value before:

$setmulti(artist,$replace(%artist%,\, ,; ))

Picard will always use a text separator for ID3v2.3. If MusicBee expects this than configure Picard to write v2.4 tags. MusicBee will respect this and also use v2.4 tags when saving the file. Given all your other threads this really seems to be the solution to your problem.

3 Likes

I’m just trying to create the NULL separator, replacing what’s there already with the Null.
However, you want to call it, I’m just saying backslash since that’s how it’s displayed in various editors.

So, please excuse my simple way of explaining things. And honestly I still don’t understand what you want from me with this? I’m just trying to find out how to do what I need. Double-backslash aka Null is the only way I know to say it.

I’ll try to do what you’ve stated. Also, I’m using 2.4 in order to conform to MusicBee’s standard, thus making all separators NULL, even though I would rather use 2.3 and just use a nice simple Semi-colon. I had it all figured out, everything working perfect between programs, then I discovered this issue with MusicBee, so I’m trying to figure out how to configure Picard to save with a NULL separator instead of a Semi-colon etc. which I already got to work.

Thank you for your help… sorry if I’m difficult in some way.

I tried this…

$set(artist,$rreplace(%artist%,\, ,\\\\))

It just created a single backslash and it’s not NULL?

How do I use the scripting or otherwise to create a null separator, I don’t understand what you’re saying otherwise in the scripts? I can use the last script you posted above, but I can’t use the Semi-colon’s anymore because of MusicBee.

I need to make all multi-values with NULL separators, no longer Semi-colons. MusicBee’s methodology has messed everything up when I had everything working great thanks to your all’s help etc. But now I have this issue, need to use NULL separators instead.

I appreciate the help, sorry for the difficulty, it’s just the limitations and issues with these programs per what I’m needing that’s making it difficult.

Ok, then what you need to do is turn the artist tag into a tag with actual multiple values in Picard using the $setmulti function. When saving to ID3 v2.4 the individual values will be separated accordingly with null values.

You can double check before saving with the tag editor. When each artist is on a separate line (see below) it’s a multivalue field. If they are all in one line with some separator character it’s a single value.

grafik

1 Like

I already have these in the scripting…

$setmulti(artist,%artist%)
$setmulti(albumartistsort,%albumartistsort%)
$setmulti(artistsort,%artistsort%)
$setmulti(artists,%artists%)
$setmulti(genre,%genre%)

But, I’m not getting the Null separation?

I’m assuming I need to have another script so it works? That’s the part I have issue with.

This is my scripting currently…

$unset(totaltracks)
$unset(totaldiscs)
$unset(media)
$unset(compilation)
$unset(discnumber)
$delete(discnumber)
$unset(discsubtitle)
$unset(setsubtitle)
$delete(setsubtitle)
$setmulti(artist,%artist%,\, )
$set(date,$year(date,date_order="ymd"))
$set(originaldate,$year(%originaldate%,date_order="ymd"))
$set(artist,$rreplace(%artist%, with ,\\))
$set(artist,$rreplace(%artist%, feat. ,\\))
$set(artist,$rreplace(%artist%, and ,\\))
$set(artist,$rreplace(%artist%, & ,\\))
$set(artist,$rreplace(%artist%,\, ,\\\\))
$set(albumartist,$rreplace(%albumartist%, with ,\\))
$set(albumartist,$rreplace(%albumartist%, feat. ,\\))
$set(albumartist,$rreplace(%albumartist%, and ,\\))
$set(albumartist,$rreplace(%albumartist%, & ,\\))
$set(albumartist,$rreplace(%albumartist%, \, ,\\))
$set(artistsort,$rreplace(%artistsort%, feat. ,\\))
$set(artistsort,$rreplace(%artistsort%, with ,\\))
$set(artistsort,$rreplace(%artistsort%, and ,\\))
$set(artistsort,$rreplace(%artistsort%, & ,\\))
$set(albumartistsort,$rreplace(%albumartistsort%, with ,\\))
$set(albumartistsort,$rreplace(%albumartistsort%, feat. ,\\))
$set(albumartistsort,$rreplace(%albumartistsort%, and ,\\))
$set(albumartistsort,$rreplace(%albumartistsort%, & ,\\))
$setmulti(artist,%artist%)
$setmulti(albumartistsort,%albumartistsort%)
$setmulti(artistsort,%artistsort%)
$setmulti(artists,%artists%)
$setmulti(genre,%genre%)

Obviously the slashes used to have Semi-colon’s there, having been trying different things to get this to work.

Ok, need to get some more insight into what you are doing. On a file before you save it:

  • Is it on the left / middle pane, or on the right matched to MusicBrainz data (only in the second case the script has been run automatically)
  • When you look at the artist values in the tag editor, does it show multiple entries or just a single one?
  • How is artist displayed, with semicolon or comma as separator?
  • Have you configured Picard to use ID3v2.4 or 2.3?
1 Like

I think I got it to work…

Let me do some more testing and configuring…

Okay, so I got it to work by using these for example… Are these correct? That’s all I need right.

$setmulti(artist,%artist%,\, )
$setmulti(albumartist,%albumartist%,\, )

Also, I need to delete all the set rreplace scripts above that change feat., &, and, with etc. and replace them with these new equivalent scripts right? I do the same with them as I did here I’m sure right?

Oh wait, I think I put the Semi-Colon back right? Trying to use my brain according to logic?
Nope, that didn’t work. Trying to figure this out.

Okay, I figured that part out…

So I keep the replace functions but have them look like this…

$set(artist,$rreplace(%artist%, with , ))

Seems to work?

Okay, think I’m done… Think everything is working?

$unset(totaltracks)
$unset(totaldiscs)
$unset(media)
$unset(compilation)
$unset(discnumber)
$delete(discnumber)
$unset(discsubtitle)
$unset(setsubtitle)
$delete(setsubtitle)
$set(date,$year(date,date_order="ymd"))
$set(originaldate,$year(%originaldate%,date_order="ymd"))
$set(artist,$rreplace(%artist%, with , ))
$set(artist,$rreplace(%artist%, feat. , ))
$set(artist,$rreplace(%artist%, and , ))
$set(artist,$rreplace(%artist%, & , ))
$set(albumartist,$rreplace(%albumartist%, with , ))
$set(albumartist,$rreplace(%albumartist%, feat. , ))
$set(albumartist,$rreplace(%albumartist%, and , ))
$set(albumartist,$rreplace(%albumartist%, & , ))
$set(albumartistsort,$rreplace(%albumartistsort%, with , ))
$set(albumartistsort,$rreplace(%albumartistsort%, feat. , ))
$set(albumartistsort,$rreplace(%albumartistsort%, and , ))
$set(albumartistsort,$rreplace(%albumartistsort%, & , ))
$set(artistsort,$rreplace(%artistsort%, feat. , ))
$set(artistsort,$rreplace(%artistsort%, with , ))
$set(artistsort,$rreplace(%artistsort%, and , ))
$set(artistsort,$rreplace(%artistsort%, & , ))
$set(albumartistsort,$rreplace(%artists%, with , ))
$set(albumartistsort,$rreplace(%artists%, feat. , ))
$set(albumartistsort,$rreplace(%artists%, and , ))
$set(albumartistsort,$rreplace(%artists%, & , ))
$setmulti(artist,%artist%,\, )
$setmulti(albumartist,%albumartist%,\, )
$setmulti(genre,%genre%,\, )
$setmulti(albumartistsort,%albumartistsort%,\, )
$setmulti(artistsort,%artistsort%,\, )
$setmulti(artists,%artists%,\, )

Does it all look right to you…?

Thanks again for your help. :slight_smile:

BTW, for others info as outsidecontext indicated above, Picard doesn’t use the “double backslash” to indicate the NULL value/separator in Picard like is done in some other editors. You simply set the null either within the Editor by putting items on separate lines (instead of one line), or use a script like above which will automatically create the null separators, auto putting the items on separate lines as will show in the Editor.

In general I think this works. As a general note you should use $replace instead of $rreplace here.$replace is just text replacement, while $rreplace replaces using regular expressions. This might not do what you expect, e.g. $set(artist,$rreplace(%artist%,.,-)) will not replace dots with dashes but every single character with a dlash (because . in a regular expression means “any character”).

Also for the above consider using the $artists variable, which already contains all the artists as a multi value tag. Similar variables exist for album artist and the sort names. I think you can replace all the artist name handling with this code:

$setmulti(artist,%artists%)
$setmulti(artistsort,%_artists_sort%)
$setmulti(albumartist,%_albumartists%)
$setmulti(albumartistsort,%_albumartists_sort%)

A word of warning: Multi value tags for these artist variables are not well supported. If MusicBee handles them this is great, but don’t expect every player to do. Players might just use the first value or totally fail. Especially for the sort tags I don’t know if and how players would handle this.

2 Likes

Hey, have an issue… I’m using this code.

$unset(totaltracks)
$unset(totaldiscs)
$unset(media)
$unset(compilation)
$unset(discnumber)
$delete(discnumber)
$unset(discsubtitle)
$unset(setsubtitle)
$delete(setsubtitle)
$set(date,$year(date,date_order="ymd"))
$set(originaldate,$year(%originaldate%,date_order="ymd"))
$set(artist,$replace(%artist%, with , ))
$set(artist,$replace(%artist%, feat. , ))
$set(artist,$replace(%artist%, and , ))
$set(artist,$replace(%artist%, & , ))
$set(albumartist,$replace(%albumartist%, with , ))
$set(albumartist,$replace(%albumartist%, feat. , ))
$set(albumartist,$replace(%albumartist%, and , ))
$set(albumartist,$replace(%albumartist%, & , ))
$set(artistsort,$replace(%artistsort%, feat. , ))
$set(artistsort,$replace(%artistsort%, with , ))
$set(artistsort,$replace(%artistsort%, and , ))
$set(artistsort,$replace(%artistsort%, & , ))
$set(albumartistsort,$replace(%albumartistsort%, with , ))
$set(albumartistsort,$replace(%albumartistsort%, feat. , ))
$set(albumartistsort,$replace(%albumartistsort%, and , ))
$set(albumartistsort,$replace(%albumartistsort%, & , ))
$setmulti(artist,%artists%)
$setmulti(artistsort,%_artists_sort%)
$setmulti(albumartist,%_albumartists%)
$setmulti(albumartistsort,%_albumartists_sort%)
$setmulti(genre,%genre%)

For the Artist when I select “use original values” on the artist “John Williams” that’s from the database and the original values have “commas” in them,
for example I have this “John Williams, Royal Liverpool Philharmonic Orchestra, Carl Davis
Instead of the Null being added after I RUN the Script manually to add the NULL, this text disappears and it goes back to John Williams again.

This occurs with the above script… This didn’t occur with my version, but your version I noticed fixes the sort order comma being removed, the one it shouldn’t remove, so I don’t necessarily want to go back to my version.
Any idea how to fix this?

Now, I CAN create a separate script:

$setmulti(artist,%artist%,\, )

And run this separately, and it adds the NULL separators properly.
Also, when I have this script in the above script and RUN it, it does the same thing, after running the field reverts back to John Williams.