Code .src Tag Performer from Discogs, help! (Solved+Update)

Good morning,
I’ve resumed work with a fresh installation of Mp3Tag, having removed all PERFORMER tags from the audio files. I can confirm the solution provided in the 19th post: the inconsistencies were caused by pre-existing data, which I should have cleared before starting the test.
As for the script, it may be missing the logic to join similar roles. I’ll see if I can implement that in the future.
This was my first experience in this area, and for now, I’m satisfied with the results.
Thanks again to all the users who contributed. See you :waving_hand:

Hi, regarding the Credits topic I have a project developed in python ready, I have to complete the readme file, in the next few days I will publish it in the Off-Topic section :nerd_face:

Update: Fixed the capture and exclusion of "composer" roles, in the previous version it was too greedy in some cases. Optimized code.

# PERFORMER - Role: Name (Exclude Written/Lyrics/Music - It does not combine equal roles)
outputto "PERFORMER"
json_foreach "tracklist"
json_select_many "extraartists" "name" ""
json_select "position"
ifnot ""
    set "TEMP_Performer"

    json_foreach "extraartists"
        json_select "role"
        regexpreplace "(?i)(?:Written[- ]?By|Lyrics[- ]?By|Music[- ]?By|Composed[- ]?By|Words[- ]?By|Songwriter)[,]?\s*" ""
        ifnot ""
            ifnotoutput "TEMP_Performer"
                outputto "TEMP_Performer"
            else
                say "\\\\"
            endif

            json_select "role"
            regexpreplace "(?i)(?:Written[- ]?By|Lyrics[- ]?By|Music[- ]?By|Composed[- ]?By|Words[- ]?By|Songwriter)[,]?\s*" ""
			sayrest
            say ": "
            
            json_select "name"
            regexpreplace "\s\(\d+\)$" ""     # Remove anv (2), (3), ecc.
            sayrest
        endif
    json_foreach_end

    ifoutput "TEMP_Performer"
        outputto "PERFORMER"
        sayoutput "TEMP_Performer"
        set "TEMP_Performer"
    endif

    say "|"
endif
json_foreach_end

See you!