I've added the following script to the original Discogs release ID:
# PERFORMER - Role: Name (exclude Written/Lyrics/Music)
outputto "PERFORMER"
json_foreach "tracklist"
set "TEMP_Performer"
json_foreach "extraartists"
json_select "role"
if "Lyrics-By"
else
if "Lyrics By"
else
if "Music-By"
else
if "Music By"
else
if "Written-By"
else
if "Written By"
else
ifnotoutput "TEMP_Performer"
outputto "TEMP_Performer"
else
say "\\\\"
endif
json_select "role"
sayrest
say ": "
json_select "name"
sayrest
endif
endif
endif
endif
endif
endif
json_foreach_end
ifoutput "TEMP_Performer"
outputto "PERFORMER"
sayoutput "TEMP_Performer"
set "TEMP_Performer"
endif
say "|"
json_foreach_end
As shown in the image, the code operates on multi-value fields and works fairly well; however, I have not been able to eliminate the issue of writing to empty fields :.
I have searched the forum, but so far without success.
I could apply a cleanup action to address the problem, but that is not my current objective.
Thanks in advance to anyone who can help.
You could try to check first, if the TEMP_Performer or PERFORMER is not empty and only then say ": "
Untested and not sure about proper way...
How about:
Edit:
Tested a change and it seems to work (and found a better test album):
Here is my changed script
# PERFORMER - Role: Name (exclude Written/Lyrics/Music)
outputto "PERFORMER"
json_foreach "tracklist"
set "TEMP_Performer"
json_foreach "extraartists"
json_select "role"
if "Lyrics-By"
else
if "Lyrics By"
else
if "Music-By"
else
if "Music By"
else
if "Written-By"
else
if "Written By"
else
# My Change:
#ifnot ""
ifnotoutput "TEMP_Performer"
outputto "TEMP_Performer"
else
say "\\\\"
endif
json_select "role"
sayrest
say ": "
json_select "name"
sayrest
#endif # / My Change:
endif
endif
endif
endif
endif
endif
json_foreach_end
ifoutput "TEMP_Performer"
outputto "PERFORMER"
sayoutput "TEMP_Performer"
set "TEMP_Performer"
endif
say "|"
json_foreach_end
Thanks for the interventions.
The post by @LyricsLover raised a flag for me. My initial test was conducted using this distribution r2384105, and later I tested this one r6614765.
In the image, I have highlighted the differences.
The paragraph causes the tracklist to break, which indicates that the issue lies in the incorrect identification of the "Teddy Pendergrass" paragraph, which should be excluded from the capture.
I will review everything again and keep you updated.
Still, if you look at my sample:
So, with my change the empty : are gone.
https://www.discogs.com/release/1072397-U2-18-Singles
thanks for the reply, if you have time try with a MultiSet distribution + disks
I'm running tests with:
json_select "position"
json_foreach_skip
https://www.discogs.com/release/28694644-Bob-Dylan-The-Many-Faces-Of-Bob-Dylan
This is a 3 disc set I could quickly test, but as it does not have PERFORMER data set
i changed the script
#if "Written-By"
#else
to use Written-By to populate the fields:
You have triggered and old interest of mine, to add that kind of data!
So thanks for that @juvalu
sorry I deleted the post, where I said I'm playing with
json_select "position"
ifnot ""
need more...
I'm happy for you, at least we solved one problem
. In order not to dirty this thread after I solved mine, I will share a COMPOSER - Extract "Lyrics-By", "Music-By", "Written-By".src later in another post. Bye
Can you give me an example of how did you solve the non-capture of the paragraph "The Classics And More" and subsequent ones? Thanks
@LyricsLover
i tried to interpret what you suggested by making this change, now I have the problem that the : after the role places them at the end of the text. Sorry I'm learning
ifoutput "TEMP_Performer"
outputto "PERFORMER"
sayoutput "TEMP_Performer"
say ": "
set "TEMP_Performer"
endif
To me it looks like this:
You check if TEMP_Performer is not empty and write the content of TEMP_Performer - additionally - into PERFORMER.
At this code line, it seems that you already have filled PERFORMER with the role (like Arranged by").
So in addition to
Arranged by
the TEMP_Peformer content will be added
Bobby Martin\\Producer Gamble & Huff
and your
:
will be added.
You need to check where and when you put which content into which variable.
You can check the current content of the variable PERFORMER and TEMP_Performer in the debug log file.
I marked it here, but maybe I should have removed the #s
# My Change:
ifnot ""
ifnotoutput "TEMP_Performer"
outputto "TEMP_Performer"
else
say "\\\\"
endif
json_select "role"
sayrest
say ": "
json_select "name"
sayrest
endif # / My Change:
Does that help?
I can create some dummy files and make
them "Teddy Pendergrass – Original Album Classics" so we have some common ground.
Oh, I think I only now understood
The track list has extra "heading", which indicate each disc in this set has a Name/Title usually printed on the CDs -- not just simply disc 1 2 …
https://api.discogs.com/releases/6614765
You are right, it is pretty confusing to see a position 0 with heading only.
And then at position 1 the track 1 and at position 9 a second heading for the second disc followed by the first track of the second disc at position 10 ... 
So you would also need to check the type_ to distinguish whether an entry at a particular position is a "heading" or a "track".
You are a bit too far ahead in your knowledge, I hope I can keep up with you. I made the changes you suggested now the colon is gone but the field is empty because of the "Paragraph" see.
Best Regards
# PERFORMER - Role: Name (exclude Written/Lyrics/Music)
outputto "PERFORMER"
json_foreach "tracklist"
set "TEMP_Performer"
json_foreach "extraartists"
json_select "role"
if "Written-By"
else
if "Written By"
else
if "Lyrics-By"
else
if "Lyrics By"
else
if "Music-By"
else
if "Music By"
else
ifnot ""
ifnotoutput "TEMP_Performer"
outputto "TEMP_Performer"
else
say "\\\\"
endif
json_select "role"
sayrest
say ": "
json_select "name"
sayrest
endif
endif
endif
endif
endif
endif
endif
json_foreach_end
ifoutput "TEMP_Performer"
outputto "PERFORMER"
sayoutput "TEMP_Performer"
set "TEMP_Performer"
endif
say "|"
json_foreach_end
Yeah, I think it was a DOORs box set, that got me years ago…
When ripping, I'll pretty much pull data for each CD in the set and you'll end up having to fix them to a Box Set, it really came in and that was right in front of me.
@juvalu Don't worry to much you are doing pretty good!!
Using the api in the browser helps a great deal, most of the time.
I'll stay on this matter, promised
This. Or load the debug-data file in a specialized JSON-Viewer.
Even for Notepad++ there are plugins to see the data in a much more structured way.
For example, the above screenshot was made with JsonToolsNppPlugin for Notepad++
Just to confirm, this causes issues, as I was thinking.
It is not just empty, there is a shift, due to the extra "heading" in the tracklist array:
To be continued
Finally after many experiments I found the solution
!! with these directives at the beginning of the code:
json_foreach "tracklist"
json_select_many "extraartists" "name" ""
json_select "position"
ifnot ""
full code
# PERFORMER - Role: Name (exclude Written/Lyrics/Music)
outputto "PERFORMER"
json_foreach "tracklist"
json_select_many "extraartists" "name" ""
json_select "position"
ifnot ""
set "TEMP_Performer"
json_foreach "extraartists"
json_select "role"
if "Written-By"
else
if "Written By"
else
if "Lyrics-By"
else
if "Lyrics By"
else
if "Music-By"
else
if "Music By"
else
ifnot ""
ifnotoutput "TEMP_Performer"
outputto "TEMP_Performer"
else
say "\\\\"
endif
json_select "role"
sayrest
say ": "
json_select "name"
sayrest
endif
endif
endif
endif
endif
endif
endif
endif
json_foreach_end
ifoutput "TEMP_Performer"
outputto "PERFORMER"
sayoutput "TEMP_Performer"
set "TEMP_Performer"
endif
say "|"
json_foreach_end
Thanks to in order of appearance @LyricsLover | @make-nz for opening my mind with suggestions that are a bit difficult for my no longer young age
.
Best Regards 
Do you have a Library set up?
When testing, I keep these files outside my library and use the context menu to open files or folders with mp3tag.
One other thing, why do you like to limit this to Performer?
I've been playing with Credits, as this is what you can toggle on/off on discogs:
Too much, yes in times it's a lot, but giving credit where credit is due..
It is a bit OT, I know.