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

hiccup

  • Hero Member
  • *****
  • Posts: 6186
(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: 405
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

  • Hero Member
  • *****
  • Posts: 6186
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
  • Hero Member
  • *****
  • Posts: 10677
<...> 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

  • Hero Member
  • *****
  • Posts: 6186
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: 405
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

  • Hero Member
  • *****
  • Posts: 6186
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: 8
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