Shorten Label

Is there a way to get a shortened %label%
example: instead of (EPIC; CLEVELAND INTERNATIONAL RECORDS; LEGACY-EK-62171-US)
I want: (EPIC LEGACY-EK-62171-US)

At first glance, that looks like multiple separate labels on one release. If you provide a link to the release where this is showing up, I can try to parse it out.

However, based on the example provided showing the result that you’re hoping for, there may be a piece of information I’m missing - if Legacy is also a label along with Epic but you just don’t want Cleveland International Records, you’ll likely need to work with RegEx or the $replace() function to remove parts of the string you do not want (which will probably feel like a game of whack-a-mole after a while).

In any case, if you are just wanting the first label that comes back, you could use something like the following:

$set(label,$getmulti(%label%,0))
2 Likes

https://musicbrainz.org/release/1f6ef065-4969-458a-a593-3196322d6b94?tport=8000
Here is the link, I would Just like Epic

This is my line of code:

$if($or($ne(%label%,),$ne(%catalognumber%,none),$ne(%releasecountry%,)),-\($upper($if(%label%,%label%,)$if($and(%label%,%catalognumber%),-,)$if($ne(%catalognumber%,none),$trim($rreplace($rreplace(%catalognumber%,[⋅/:*?"<>|],-),[:;|],-)),)$if($and($or(%label%,%catalognumber%),%releasecountry%),-,)$if(%releasecountry%,%releasecountry%,))\),)

and if possible would like to shorten catalog number too when there are several just display the first one. Thanks.

Oof, that’s quite the string. I’m guessing that’s something AI generated. Is it working in any capacity on your system? If I’m reading it properly, I think the code provided just pulls some info with a handful of nested if statements, but never sets it anywhere.

If it were me, I might use something like the following instead:

$set(label,$upper(\($getmulti(%label%,0) $getmulti(%catalognumber%,0)-%releasecountry%\)))

This gets us to (EPIC EK-62171-US).

If you’re looking to refine this script further, reading the Picard documentation is a great start, and contains explanations of all functions mentioned above.

3 Likes

LOL, yes, it was exactly AI-generated, and yet your code looks short, sweet, and to the point. Going to try your way :wink: Thanks.