SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Find and replace Performer (or part)

Hi
Find and replace is not working for Performer exept first entry. Bug?
I like to change the instrument or part of it.

Correct, seems to apply to apply to all multi value fields - https://jthink.atlassian.net/browse/JAIKOZ-1332

I assume it is difficult to solve

Not top priority, I just don’t have enough time.

Hi, workaround is you could do this now with Scripter or Set Value with Scripter.

Hard to start
What is the code to replace “performer_name” from
Bill Evans ‐-----> Bill Evans (Sax)

performername=performername.replaceAll('Bill Evans', 'Bill Evans (Sax)');

e.g
In Example 1 Bill Evans is the second value but still gets changed

Although note performername is just meant to store the name not name and instrument that is the purpose of the performer field. If you really want to store instruments in the performername field you could consider using

performername=performer;

ok, easier than I thought. :slightly_smiling_face:
Thank you very much.
FYI Performer_name Bill Evans (Sax) is intentional. There is another Bill Evans pianist.

So for Performer
performer=performer.replaceAll(‘Bill Evans’, ‘Bill Evans (Sax)’);

musicbrainz delivers
(membranophone) or (drums [drum set])
but I want (drums)

performer=performer.replaceAll('membranophone', 'drums');
performer=performer.replaceAll('drums [drum set]', 'drums');
performer=performer.replaceAll('(drums [drum set])', '(drums)');
  1. works 2. and 3. not
    which is the better solution

got it with
performer=performer.replace('drums [drum set]', 'drums');

Hi, so with replaceAll the first argument is a regular expression, and [ and ] are special characters in regular expressions so we have to do this by escaping them with a backslash \. However, backslash is also a special character so we have escape this as well, so a working solution is

performer=performer.replaceAll('drums \\[drum set\\]', 'drums');

Your solution with replace is fine because this doesnt use regex, and will work as long as there is only one value to replace.

1 Like