Author Topic: Making all MusicBrainz' Picard ID tags available using only one custom tag.  (Read 5042 times)

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
(I've posted this idea a while back already, but it has gotten lost a bit in the general Picard Q & A thread. Considering the ongoing interest in Picard/MusicBrainz tagging I thought to update the older post and post it as a dedicated 'Tip & Trick'.)

MusicBrainz' Picard can provide several types of MusicBrainz ID tags.
These tags are not recognised by MusicBee out-of-the-box, so you will need to create custom tags for each of them if you want to use them in MusicBee.

But considering the restricted amount of available custom tag slots, this can pose a problem for some 'power users'.
To circumvent this problem, I created a Picard script that makes it possible to have all these MusicBrainz ID tags available in MusicBee, using only one custom tag.

The script will make Picard create a single tag (called MUSICBRAINZIDS) that contains all MBIDs.
(well, at least the ones that I think are useful)

Then after creating a custom tag for 'MUSICBRAINZIDS' in MusicBee, you can use virtual tags to retrieve the desired MBID information.
Considering MusicBee has twice as much virtual tags than custom tags available, this should be a useful alternative solution.

This is the script for Picard:
 
Code
$set(MUSICBRAINZIDS,TRACK_%musicbrainz_trackid%_ART_%musicbrainz_artistid%_REC_%musicbrainz_recordingid%_REL_%musicbrainz_albumid%_RELART_%musicbrainz_albumartistid%_RELGRP_%musicbrainz_releasegroupid%_WORK_%musicbrainz_workid%_RELTYPE_%releasetype%)

The custom tag for MusicBee should look like this:
 


 
These are virtual tags that you could then setup:
(you don't need to create all of them, you can use only the ones that interest you)
 
label:
formula:
MusicBrainz Track Id$Split(<MusicBrainz IDs>,"_",2)
MusicBrainz Artist Id$Split(<MusicBrainz IDs>,"_",4)
MusicBrainz Recording Id$Split(<MusicBrainz IDs>,"_",6)
MusicBrainz Release Id$Split(<MusicBrainz IDs>,"_",8)
MusicBrainz Release Artist Id$Split(<MusicBrainz IDs>,"_",10)
MusicBrainz Release Group Id$Split(<MusicBrainz IDs>,"_",12)
MusicBrainz Work Id$Split(<MusicBrainz IDs>,"_",14)
MusicBrainz Release Type$Split(<MusicBrainz IDs>,"_",16)

The last one, 'MusicBrainz Release Type' is not really an 'ID', but I found it useful to add it for displaying the release type, such as e.g.: album, ep, single, soundtrack, live, etc.

The others can be used to create custom web links to open relevant pages on MusicBrainz.
Examples:
 
Open the concerning release page, highlighting the track:
MusicBrainz Track Id
Code
https://musicbrainz.org/track/<MusicBrainz Track Id>
Open the artist page:
MusicBrainz Artist Id
Code
https://musicbrainz.org/artist/<MusicBrainz Artist Id>
Open the recording page, showing all releases that contain it:
MusicBrainz Recording Id
Code
https://musicbrainz.org/recording/<MusicBrainz Recording Id>
Open the album (release) page:
MusicBrainz Release Id
Code
https://musicbrainz.org/release/<MusicBrainz Release Id>
Open the album artist page:
MusicBrainz Release Artist Id
Code
https://musicbrainz.org/artist/<MusicBrainz Release Artist Id>
Open the page for the release group that the album is a part of:
MusicBrainz Release Group Id
Code
https://musicbrainz.org/release-group/<MusicBrainz Release Group Id>
Open the work (song/composition) page, useful for e.g. finding other versions/performances of the song, or cover versions by other artists:
MusicBrainz Work Id
Code
https://musicbrainz.org/work/<MusicBrainz Work Id>
that's it!
Last Edit: February 28, 2022, 07:28:50 AM by hiccup

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
In the interest of actually trying to learn something…
Why do the bottom 4 virtual tag examples use <> instead of []?

I tried making the release type tag, but the formula is giving me a parse error @ >,"_",16)

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
Why do the bottom 4 virtual tag examples use <> instead of []?
<...> is how other tags are specified in a virtual tag. I don't understand why you think only the last 4 have them? They all do.
I made typos there. Corrected that now, thanks for noticing and reporting.
 
Quote
I tried making the release type tag, but the formula is giving me a parse error @ >,"_",16)
You probably made a typo somewhere. Perhaps in the custom tag?
Last Edit: February 28, 2022, 07:10:42 AM by hiccup

psychoadept

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 10691
<...> is how other tags are specified in a virtual tag. I don't understand why you think only the last 4 have them? They all do.

In your post, the first four use square brackets:

label:
formula:
MusicBrainz Track Id$Split([MusicBrainz IDs],"_",2)
MusicBrainz Artist Id$Split([MusicBrainz IDs],"_",4)
MusicBrainz Recording Id$Split([MusicBrainz IDs],"_",6)
MusicBrainz Release Id$Split([MusicBrainz IDs],"_",8)
MusicBee Wiki
Use & improve MusicBee's documentation!

Latest beta patch (3.5)
(Unzip and overwrite existing program files)

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
In your post, the first four use square brackets:
Ah, I was looking at the formulas below those in the code fields.
Fixed that.

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
Why do the bottom 4 virtual tag examples use <> instead of []?
<...> is how other tags are specified in a virtual tag. I don't understand why you think only the last 4 have them? They all do.
I made typos there. Corrected that now, thanks for noticing and reporting.
 
Quote
I tried making the release type tag, but the formula is giving me a parse error @ >,"_",16)
You probably made a typo somewhere. Perhaps in the custom tag?

I literally copy/pasted off your directions.

One weird thing I noticed last night with Picard is that sometimes after writing the MUSICBRAINZIDS to a group of files, when I did a refresh Picard would want to write the tag again so I end up with both a "MUSICBRAINZIDS" and a "musicbrainzids" tag - I've also noticed sometimes Picard wouldn't bother writing tags at all.

Since I'm using your virtual tags, the default musicbrainz_* tags are pretty much redundant. Is there anyway to stop Picard from writing them in the first place - I tried using $unset, but it still added them (I guess it isn't an issue having them, just wondering)

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
One weird thing I noticed last night with Picard is that sometimes after writing the MUSICBRAINZIDS to a group of files, when I did a refresh Picard would want to write the tag again so I end up with both a "MUSICBRAINZIDS" and a "musicbrainzids" tag
That's probably because Picard is not very clever where it concerns higher/lower case characters in tags.
That particular issue has been raised over there more than once, but has been met by deaf ears.

Quote
Since I'm using your virtual tags, the default musicbrainz_* tags are pretty much redundant. Is there anyway to stop Picard from writing them in the first place - I tried using $unset, but it still added them (I guess it isn't an issue having them, just wondering)
You could use the $delete function at the end of your script for that.
But I would suggest to just leave them in. They don't take up much space, don't cause any problems, and you never know if you may have some use for them later on.

HRO

  • Newbie
  • *
  • Posts: 10
In the interest of actually trying to learn something…
Why do the bottom 4 virtual tag examples use <> instead of []?

I tried making the release type tag, but the formula is giving me a parse error @ >,"_",16)
I'm getting the same error and I copied the updated tags. Still don't know what's wrong

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
Forgot about this one until now, but I'm still getting an error using you virtual tag formula…

The tags I want to use are the release ID and type, but the formula keeps giving an error - this specifically is for the release ID

I directly copy/pasted the formulas from your earlier post, so I'm not sure where I went askew…

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
In your screenshot I notice some square brackets [ ] that I think should be arrows? < >
Is that it maybe?

edit:
Also, the double quotation marks shouldn't be there.
Perhaps it is related to the ordering of your virtual tags. I have experienced such issues when a virtual tag is referring to another virtual tag that is positioned lower in the chain.
Last Edit: November 20, 2022, 09:26:24 PM by hiccup

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
The one with the square brackets was an older one (with typos) that should be disregarded: the template editor is the "correct" one.

Your point about ordering might be right. I remember now that once I had a virtual tag that was giving the same type of error. I copied it from its existing tag position to one of the bottom tags (virtual 12 or something) and strangely it worked fine there.

<update>
I tried redoing the tag in a position with no other tags above or below and get the same error.
Is there a way to backup the virtual tags? I was thinking about trying to erase the others and see if it'll work on its own (just to confirm there's no conflict with any other tags)

<update again>
seems the virtual tags was correct. the problem was a typo in the custom tag display name :-[
Last Edit: November 20, 2022, 10:37:54 PM by Mr. Trev