Feat. Artist script

Hello, could someone help me to write action script that will move all artists except of main album artist to the title and they will go by feat. And then remove all artists except of the main one from artist category.

For example
Title of song - Artist - Album Artist
Happy - Pharell;Orange;Banana - Pharell

Happy feat. Orange, Banana - Pharell - Pharell

I tried to do this but it was moving me even main artist to the featuring.
And also if theres no featuring it wont edit the title to Happy feat. and stay like this

You did not even bother to use the search function in this forum, did you.
There are so many threads that deal with the featuring artist and moving it, see e.g. here: