Help with Scripting PLEASE!

Tags: #<Tag:0x00007fbb441eaad0>

Can anyone help me with this please?
TITLE: Into the Lens (single version)

I would like the end result to be:
TITLE:: Into the Lens
SUBTITLE: Single Version

I know this has to be possible but I’m still figuring out the whole scripting stuff.
Any help is appreciated :slight_smile:

Assuming that the title is in the %title% tag, you could try something like this:


This will create a tag called %subtitle% containing the information in the brackets in title case. If this tag is not empty, it will modify the %title% tag to remove the portion in the brackets.

You should now be able to process the two parts separately as required.

You can get more information on the scripting functions and stuff in the documentation.


Thank you, thank you! I will give this a shot. Appreciate it.


Your suggestion so far has worked. I have come across something though that perhaps you can help me with.
There are some titles like this:
Harvest For The World (Single Version) > (Single Version) would be Subtitle
There there is this:
This Old Heart Of Mine (Is Weak For You) > These words are actually part of the title.

I thought I could do a little manual manipulation before the Picard process like anything I want to be Subtitles use Brackets instead of Parenthesis. That wouldn’t be hard for me to but I can’t for the life of me get what you sent to work. I keep getting invalid character!!

Any thoughts? Please :slight_smile:

Can you post the script that is giving you the error and I’ll see what I can find. If it’s just that you want to process the information surrounded by brackets instead of parentheses, try this:


I think that’s going to work!!! I work with RegEx but I can’t break this down to make any sense. In your spare time maybe you can help explain it.

Hey, you have been a tremendous help. I thank you sincerely :slight_smile:

It’s pretty much standard regular expressions except that you have to escape a backslash “\”, and the left and right parentheses “(” and “)” in order for Picard to not try to interpret them as part of the script command. In other words, for it to be interpreted as \[(.*)\].* it must be entered as \\[\(.*\)\\].*

Also I found a mistake in my earlier code. I had a closing bracket rather than a period near the end of the extraction regular expression. It still worked, but technically was incorrect. The revised version is:


I really should add a bit of an explanation of the required escaping to the documentation.


Great help and explanation. Thanks!

UGHHH!! What is wrong with this? I just wanted to change the parenthesis to brackets! :frowning:


Caldonia Mission (live)

Probably better to use a simple $replace rather than a regular expression. Try:

1 Like

You make it look so easy!! :frowning: Thanks

Except I left in the change I made for my testing… It should be %title% rather than %ttitle%.

Hello. I don’t know if this could be done but you seem to have all the answers so…
Picard spits out “Release Type” as say “album; compilation”, or “album; live”

I would like to grab the second word only (compilation, or live) and ultimately that is what I would send to Helium.

Is that possible?

Have a look at the _secondaryreleasetype variable in the documentation and see if that provides what you want.


UGHH my head is spinning out of control :frowning:

RELEASE TYPE: album; soundtrack; live
$if(%_primaryreleasetype%,Live),$set(TESTTHIS,Live performance)
$if(%_primaryreleasetype%,soundtrack),$set(TESTTHIS,Sound Effects)

TESTTHIS: Sound Effects

No matter what order the original Release Type is in I always get Sound Effects. I tried looking at the _secondaryreleasetype variable but that was a disaster.

I just want what is always in the second position of the original Release Type. I’ve been messing with this all day :frowning: (crying)

This is actually a simple problem… You are doing the $set() operations outside of the $if() functions, so they are always being executed.

Also, there is a problem with some of your tests. You are testing %_primaryreleasetype% in each of the tests, but it will only contain one value from the list: “album”, “single”, “ep”, “broadcast” and “other”. Testing for “live” and “soundtrack” will always fail.

The variable %_secondaryreleasetype% can contain zero or more items from the list: “audio drama”, “audiobook”, “compilation”, “demo”, “dj-mix”, “interview”, “live”, “mixtape/street”, “remix”, “soundtrack” and “spokenword”.

Because you are testing for items that could be contained in both %_primaryreleasetype% and %_secondaryreleasetype%, you might be better off testing against the %releasetype% tag, which contains the items from both the %_primaryreleasetype% and %_secondaryreleasetype% variables.

Perhaps something like:

$if($in(%releasetype%,live),$set(TESTTHIS,Live Performance))
$if($in(%releasetype%,other),$set(TESTTHIS,Sound Effects))

Note that this will only retain the setting from the latest match. If you only want one match saved, then you would do your tests in the order from least preferred (first) to most preferred (last).

If you want to match and keep more than one setting, I would do something like:

$if($in(%releasetype%,single),$set(TESTTHIS,%TESTTHIS%; Single))
$if($in(%releasetype%,live),$set(TESTTHIS,%TESTTHIS%; Live Performance))
$if($in(%releasetype%,ep),$set(TESTTHIS,%TESTTHIS%; EP))
$if($in(%releasetype%,soundtrack),$set(TESTTHIS,%TESTTHIS%; Soundtrack))
$if($in(%releasetype%,other),$set(TESTTHIS,%TESTTHIS%; Sound Effects))
$set(TESTTHIS,$trim(%TESTTHIS%,; ))

This would keep adding each match to the %TESTTHIS% tag, separating the items with a semicolon and space. The final line trims off the extra semicolon and space that would appear at the beginning of the combined %TESTTHIS% tag.


If I were doing something like this for myself, I would probably set the separator in a variable. That way, if I changed my mind as to what I wanted to use to separate the choices I would only need to make the change in one place rather than in every $set() statement. Something like:

$set(_separator,; )
$if($in(%releasetype%,live),$set(TESTTHIS,%TESTTHIS%%_separator%Live Performance))
$if($in(%releasetype%,other),$set(TESTTHIS,%TESTTHIS%%_separator%Sound Effects))

You ARE incredible. Not only do you help provide an answer but you so clearly explain it all.
I don’t know how to thank you enough :slight_smile:


I still ask a million questions (@Zas and @outsidecontext can confirm that :wink:) and I always appreciate the extra time they take to explain things. I try to do the same when I can, as a way of paying it forward. That’s what the Community is all about.