Check for string in title and add it?

I’m trying to create a tagger script which will check if the title contains any round brackets with text inside. I’m really not sure what format to use, for example:

$set(title, if no round brackets with any text or spaces inside are found, then add (This Exact Text) at the end of title)

I used actual text, could you help me write a proper tagger script? Thank you

I’m not sure I understand what you’re wanting to do. Can you perhaps provide a couple of examples of the original title and your desired final title (both when the routine is triggered and when it is not triggered). Thanks.

1 Like

Say my song title tag is Dancing, I want to create a script which will transform the title into Dancing (Original Mix). However, if the title is Dancing (Dub), don’t add the (Original Mix) part since it already has a (Mix Type) description.

Basically I want all my song titles to contain a (Mix Type) description next to actual song title. This is standard for DJ libraries, Right now I manually add the missing (Original Mix) part into title tag and I would like to automate that with a tagger script.

Example of title format:

In this specific case, the tagger script should not take any action, as the title already contains a (Mix Type) description.

If I understand correctly, then I think a one-line tagging script (not renaming script) will do what you’re after:

$if($in(%title%,\(),,$set(title,%title% \(Original Mix\)))
3 Likes

That is exactly what I was looking for, thank you! So much easier to work with titles now.

The script will add the missing mix type, always (Original Mix):

Or leave alone the titles who already have defined the mix type:

@rdswift Bob I have a question, with your one line you check only if there is a ( bracket present and take no action. What would be the regex to match the open and closed bracket? I tried, but it would not match the (Some text) content:

$if($in(%title%,\(\\w+\)),,$set(title,%title% \(Original Mix\)))

For regular expressions, you need to use the $rsearch() function rather than the $in() function. Also, the regular expression that you show won’t match if there is a whitespace character between the parentheses.

@rdswift Bob I tried your suggestion, but it would not find the missing brackets with any of the following combinations:

$if($rsearch(%title%,\(.*\)),,$set(title,%title% \(Original Mix\)))
$if($rsearch(%title%,\([A-Za-z0-9 ]+\)),,$set(title,%title% \(Original Mix\)))
$if($rsearch(%title%,\(\\w+\(\\s+\\w+\)*\)),,$set(title,%title% \(Original Mix\)))

What would be the correct format?

The problem is that you were not escaping the parentheses in the regular expression. I believe the following will work for you:

$if($rsearch(%title%,\\\(.*\\\)),,$set(title,%title% \(Original Mix\)))
3 Likes

Thank you, it does work.

1 Like