I had a whole bunch of music where only some of the ARTIST tags contained a featured artist(s) and I wanted to move that to the TITLE tag and then remove the featured artist information from the ARTIST tag
I tried various potential solutions from this forum, but none of them worked
This is what I came up with though, and thought I'd share (as I can't be the only one to struggle with this)
Example ARTIST tag: "Madvillain feat. Viktor Vaughn"
Example TITLE tag: "Fancy Clown"
End result ARTIST tag: "Madvillain"
End result TITLE tag: "Fancy Clown feat. Viktor Vaughn"
If the ARTIST does not contain " feat." then leave the tags alone
I created myself a new Action Group with two steps
- move the " feat. <artist(s)>" from the ARTIST tag to the end of the TITLE tag
- remove " feat. <artist(s)>" from the ARTIST tag
Step 1 is a Format Tag Field action
Field = TITLE
Format = $ifgreater($strstr(%artist%,' feat.'),0,%title% feat. $mid(%artist%,$add($strstr(%artist%,'feat. '),6),$len(%artist%)),%title%)
Step 2 is a Format tag Field action
Field = ARTIST
Format = $ifgreater($strstr(%artist%,' feat.'),0,$left(%artist%,$add($strstr(%artist%,' feat.'),-1)),%artist%)
Note: the $strstr() function returns a number (0 if the search string isn't found) so I couldn't use $if() I needed to use the math $ifgreater() function
$ifgreater(a,b,x,y) if number a is greater than number b, x is returned, otherwise y.
If the $strstr() returned zero (it didn't find a " feat.") then I just retained the original field
I also had to use $add() around the $left() function in Step 2 to remove the trailing space after the artist name and before the "feat." string (this was done by "adding" -1 to the length of the string we return)
Hope this helps...
Please feel free to simplify (e.g. there may be a way to wrap the whole Action Group using the "if ARTIST doesn't contain 'feat.'" then exit/do nothing